Files
profiles-plugin/profiles/data.py

82 lines
1.8 KiB
Python

from data import Registry, Table, RowModel
from data.columns import String, Integer, Timestamp
class UserProfile(RowModel):
_tablename_ = 'user_profiles'
_cache_ = {}
profileid = Integer(primary=True)
nickname = String()
timezone = String()
locale_hint = String()
locale = String()
avatar = String()
migrated = Integer()
created_at = Timestamp()
last_seen = Timestamp()
_timestamp = Timestamp()
class DiscordProfileLink(RowModel):
_tablename_ = 'profiles_discord'
_cache_ = {}
linkid = Integer()
profileid = Integer()
userid = Integer(primary=True)
linked_at = Timestamp()
class TwitchProfileLink(RowModel):
_tablename_ = 'profiles_twitch'
_cache_ = {}
linkid = Integer()
profileid = Integer()
userid = String(primary=True)
linked_at = Timestamp()
class Community(RowModel):
_tablename_ = 'communities'
_cache_ = {}
communityid = Integer(primary=True)
migrated = Integer()
created_at = Timestamp()
last_seen = Timestamp()
_timestamp = Timestamp()
class DiscordCommunityLink(RowModel):
_tablename_ = 'communities_discord'
_cache_ = {}
linkid = Integer()
guildid = Integer(primary=True)
communityid = Integer()
linked_at = Timestamp()
class TwitchCommunityLink(RowModel):
_tablename_ = 'communities_twitch'
_cache_ = {}
linkid = Integer()
channelid = String(primary=True)
communityid = Integer()
linked_at = Timestamp()
class ProfilesData(Registry):
VERSION = ('PROFILES', 1)
user_profiles = UserProfile.table
profiles_discord = DiscordProfileLink.table
profiles_twitch = TwitchProfileLink.table
communities = Community.table
communities_discord = DiscordCommunityLink.table
communities_twitch = TwitchCommunityLink.table