snow/storage/tables.go

169 lines
3.1 KiB
Go
Raw Normal View History

2023-10-31 22:40:14 +00:00
package storage
import "github.com/lib/pq"
type Tabler interface {
TableName() string
}
type DB_Person struct {
ID string
2023-10-31 22:40:14 +00:00
DisplayName string
2023-12-14 19:47:54 +00:00
Permissions pq.StringArray `gorm:"type:text[]"`
IsBanned bool
Profiles []DB_Profile `gorm:"foreignkey:PersonID"`
2023-12-10 23:54:31 +00:00
Stats []DB_SeasonStat `gorm:"foreignkey:PersonID"`
Discord DB_DiscordPerson `gorm:"foreignkey:PersonID"`
2023-10-31 22:40:14 +00:00
}
func (DB_Person) TableName() string {
return "Persons"
}
type DB_Profile struct {
ID string `gorm:"primary_key"`
PersonID string
Items []DB_Item `gorm:"foreignkey:ProfileID"`
Gifts []DB_Gift `gorm:"foreignkey:ProfileID"`
Quests []DB_Quest `gorm:"foreignkey:ProfileID"`
2023-10-31 22:40:14 +00:00
Attributes []DB_PAttribute `gorm:"foreignkey:ProfileID"`
Loadouts []DB_Loadout `gorm:"foreignkey:ProfileID"`
Type string
Revision int
2023-10-31 22:40:14 +00:00
}
func (DB_Profile) TableName() string {
return "Profiles"
}
type DB_PAttribute struct {
ID string `gorm:"primary_key"`
2023-10-31 22:40:14 +00:00
ProfileID string
Key string
2023-11-01 00:05:17 +00:00
ValueJSON string
Type string
2023-10-31 22:40:14 +00:00
}
func (DB_PAttribute) TableName() string {
return "Attributes"
}
type DB_Loadout struct {
ID string `gorm:"primary_key"`
ProfileID string
TemplateID string
LockerName string
BannerID string
BannerColorID string
CharacterID string
PickaxeID string
BackpackID string
GliderID string
DanceID pq.StringArray `gorm:"type:text[]"`
ItemWrapID pq.StringArray `gorm:"type:text[]"`
ContrailID string
LoadingScreenID string
MusicPackID string
}
func (DB_Loadout) TableName() string {
return "Loadouts"
}
2023-10-31 22:40:14 +00:00
type DB_Item struct {
ID string `gorm:"primary_key"`
ProfileID string
2023-10-31 22:40:14 +00:00
TemplateID string
Quantity int
Favorite bool
HasSeen bool
Variants []DB_VariantChannel `gorm:"foreignkey:ItemID"`
2023-10-31 22:40:14 +00:00
}
func (DB_Item) TableName() string {
return "Items"
}
type DB_VariantChannel struct {
ID string `gorm:"primary_key"`
ItemID string
Channel string
Owned pq.StringArray `gorm:"type:text[]"`
Active string
2023-10-31 22:40:14 +00:00
}
func (DB_VariantChannel) TableName() string {
return "Variants"
}
type DB_Quest struct {
ID string `gorm:"primary_key"`
ProfileID string
2023-10-31 22:40:14 +00:00
TemplateID string
State string
2023-10-31 22:40:14 +00:00
Objectives pq.StringArray `gorm:"type:text[]"`
ObjectiveCounts pq.Int64Array `gorm:"type:bigint[]"`
BundleID string
2023-10-31 22:40:14 +00:00
ScheduleID string
}
func (DB_Quest) TableName() string {
return "Quests"
}
type DB_Gift struct {
ID string `gorm:"primary_key"`
ProfileID string
2023-10-31 22:40:14 +00:00
TemplateID string
Quantity int
FromID string
GiftedAt int64
Message string
Loot []DB_Loot `gorm:"foreignkey:GiftID"`
2023-10-31 22:40:14 +00:00
}
func (DB_Gift) TableName() string {
return "Gifts"
}
type DB_Loot struct {
ID string `gorm:"primary_key"`
GiftID string
2023-10-31 22:40:14 +00:00
TemplateID string
Quantity int
ProfileType string
2023-10-31 22:40:14 +00:00
}
func (DB_Loot) TableName() string {
return "Loot"
}
type DB_DiscordPerson struct {
ID string `gorm:"primary_key"`
PersonID string
Username string
Avatar string
Banner string
AccessToken string
RefreshToken string
}
func (DB_DiscordPerson) TableName() string {
2023-12-10 23:54:31 +00:00
return "Discords"
}
type DB_SeasonStat struct {
ID string `gorm:"primary_key"`
PersonID string
Build string
XP int
2023-12-26 03:18:12 +00:00
Level int
LevelClaimed int
2023-12-26 03:18:12 +00:00
Stars int
Tier int
2023-12-10 23:54:31 +00:00
TierClaimed int
}
func (DB_SeasonStat) TableName() string {
return "Stats"
2023-10-31 22:40:14 +00:00
}