Profile schema and discord hook
This commit is contained in:
81
profiles/data.py
Normal file
81
profiles/data.py
Normal file
@@ -0,0 +1,81 @@
|
||||
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
|
||||
Reference in New Issue
Block a user