2023-10-31 22:40:14 +00:00
|
|
|
package storage
|
|
|
|
|
|
|
|
import "github.com/lib/pq"
|
|
|
|
|
|
|
|
type Tabler interface {
|
|
|
|
TableName() string
|
|
|
|
}
|
|
|
|
|
|
|
|
type DB_Person struct {
|
2023-11-05 01:58:00 +00:00
|
|
|
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[]"`
|
2023-11-05 01:58:00 +00:00
|
|
|
Profiles []DB_Profile `gorm:"foreignkey:PersonID"`
|
2023-12-10 23:54:31 +00:00
|
|
|
Stats []DB_SeasonStat `gorm:"foreignkey:PersonID"`
|
2024-02-04 10:56:21 +00:00
|
|
|
Purchases []DB_Purchase `gorm:"foreignkey:ProfileID"`
|
2023-12-10 00:52:59 +00:00
|
|
|
Discord DB_DiscordPerson `gorm:"foreignkey:PersonID"`
|
2024-02-04 10:56:21 +00:00
|
|
|
BanHistory []DB_BanStatus `gorm:"foreignkey:PersonID"`
|
2023-10-31 22:40:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (DB_Person) TableName() string {
|
|
|
|
return "Persons"
|
|
|
|
}
|
|
|
|
|
2024-01-29 23:46:22 +00:00
|
|
|
type DB_Relationship struct {
|
2024-01-30 16:34:17 +00:00
|
|
|
FromPersonID string `gorm:"primary_key"`
|
|
|
|
TowardsPersonID string `gorm:"primary_key"`
|
2024-01-29 23:46:22 +00:00
|
|
|
Status string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (DB_Relationship) TableName() string {
|
|
|
|
return "Relationships"
|
|
|
|
}
|
|
|
|
|
2023-10-31 22:40:14 +00:00
|
|
|
type DB_Profile struct {
|
2023-11-05 01:58:00 +00:00
|
|
|
ID string `gorm:"primary_key"`
|
2024-01-31 16:21:04 +00:00
|
|
|
PersonID string `gorm:"index"`
|
2023-11-05 01:58:00 +00:00
|
|
|
Items []DB_Item `gorm:"foreignkey:ProfileID"`
|
|
|
|
Gifts []DB_Gift `gorm:"foreignkey:ProfileID"`
|
|
|
|
Quests []DB_Quest `gorm:"foreignkey:ProfileID"`
|
2024-02-04 02:05:31 +00:00
|
|
|
Attributes []DB_Attribute `gorm:"foreignkey:ProfileID"`
|
2023-11-20 21:20:26 +00:00
|
|
|
Loadouts []DB_Loadout `gorm:"foreignkey:ProfileID"`
|
2023-11-05 01:58:00 +00:00
|
|
|
Type string
|
2023-12-10 00:52:59 +00:00
|
|
|
Revision int
|
2023-10-31 22:40:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (DB_Profile) TableName() string {
|
|
|
|
return "Profiles"
|
|
|
|
}
|
|
|
|
|
2024-02-04 02:05:31 +00:00
|
|
|
type DB_Attribute struct {
|
2023-11-05 01:58:00 +00:00
|
|
|
ID string `gorm:"primary_key"`
|
2023-10-31 22:40:14 +00:00
|
|
|
ProfileID string
|
2023-11-05 01:58:00 +00:00
|
|
|
Key string
|
2023-11-01 00:05:17 +00:00
|
|
|
ValueJSON string
|
2023-11-05 01:58:00 +00:00
|
|
|
Type string
|
2023-10-31 22:40:14 +00:00
|
|
|
}
|
|
|
|
|
2024-02-04 02:05:31 +00:00
|
|
|
func (DB_Attribute) TableName() string {
|
2023-10-31 22:40:14 +00:00
|
|
|
return "Attributes"
|
|
|
|
}
|
|
|
|
|
2023-11-20 21:20:26 +00:00
|
|
|
type DB_Loadout struct {
|
|
|
|
ID string `gorm:"primary_key"`
|
2024-01-31 16:21:04 +00:00
|
|
|
ProfileID string `gorm:"index"`
|
2023-11-20 21:20:26 +00:00
|
|
|
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 {
|
2023-11-05 01:58:00 +00:00
|
|
|
ID string `gorm:"primary_key"`
|
2024-01-31 16:20:13 +00:00
|
|
|
ProfileID string `gorm:"index"`
|
2023-10-31 22:40:14 +00:00
|
|
|
TemplateID string
|
2023-11-05 01:58:00 +00:00
|
|
|
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"
|
|
|
|
}
|
|
|
|
|
2024-02-04 02:05:31 +00:00
|
|
|
type DB_Purchase struct {
|
|
|
|
ID string `gorm:"primary_key"`
|
|
|
|
ProfileID string `gorm:"index"`
|
|
|
|
Loot []DB_PurchaseLoot `gorm:"foreignkey:PurchaseID"`
|
|
|
|
OfferID string
|
|
|
|
PurchaseDate int64
|
|
|
|
FreeRefundExpiry int64
|
|
|
|
RefundExpiry int64
|
2024-02-04 10:56:21 +00:00
|
|
|
RefundedAt int64
|
|
|
|
TotalPaid int
|
2024-02-04 02:05:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (DB_Purchase) TableName() string {
|
|
|
|
return "Purchases"
|
|
|
|
}
|
|
|
|
|
|
|
|
type DB_PurchaseLoot struct {
|
|
|
|
ID string `gorm:"primary_key"`
|
|
|
|
PurchaseID string `gorm:"index"`
|
|
|
|
TemplateID string
|
|
|
|
Quantity int
|
|
|
|
ProfileType string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (DB_PurchaseLoot) TableName() string {
|
|
|
|
return "PurchaseLoot"
|
|
|
|
}
|
|
|
|
|
2023-10-31 22:40:14 +00:00
|
|
|
type DB_VariantChannel struct {
|
2023-11-05 01:58:00 +00:00
|
|
|
ID string `gorm:"primary_key"`
|
2024-01-31 16:21:04 +00:00
|
|
|
ItemID string `gorm:"index"`
|
2023-11-01 21:33:25 +00:00
|
|
|
Channel string
|
2023-11-05 01:58:00 +00:00
|
|
|
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 {
|
2023-11-05 01:58:00 +00:00
|
|
|
ID string `gorm:"primary_key"`
|
2024-01-31 16:21:04 +00:00
|
|
|
ProfileID string `gorm:"index"`
|
2023-10-31 22:40:14 +00:00
|
|
|
TemplateID string
|
2023-11-05 01:58:00 +00:00
|
|
|
State string
|
2023-10-31 22:40:14 +00:00
|
|
|
Objectives pq.StringArray `gorm:"type:text[]"`
|
|
|
|
ObjectiveCounts pq.Int64Array `gorm:"type:bigint[]"`
|
2023-11-05 01:58:00 +00:00
|
|
|
BundleID string
|
2023-10-31 22:40:14 +00:00
|
|
|
ScheduleID string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (DB_Quest) TableName() string {
|
|
|
|
return "Quests"
|
|
|
|
}
|
|
|
|
|
|
|
|
type DB_Gift struct {
|
2023-11-05 01:58:00 +00:00
|
|
|
ID string `gorm:"primary_key"`
|
2024-01-31 16:21:04 +00:00
|
|
|
ProfileID string `gorm:"index"`
|
2023-10-31 22:40:14 +00:00
|
|
|
TemplateID string
|
2023-11-05 01:58:00 +00:00
|
|
|
Quantity int
|
|
|
|
FromID string
|
|
|
|
GiftedAt int64
|
|
|
|
Message string
|
2024-02-04 02:05:31 +00:00
|
|
|
Loot []DB_GiftLoot `gorm:"foreignkey:GiftID"`
|
2023-10-31 22:40:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (DB_Gift) TableName() string {
|
|
|
|
return "Gifts"
|
|
|
|
}
|
|
|
|
|
2024-02-04 02:05:31 +00:00
|
|
|
type DB_GiftLoot struct {
|
2023-11-05 01:58:00 +00:00
|
|
|
ID string `gorm:"primary_key"`
|
2024-01-31 16:21:04 +00:00
|
|
|
GiftID string `gorm:"index"`
|
2023-10-31 22:40:14 +00:00
|
|
|
TemplateID string
|
2023-11-05 01:58:00 +00:00
|
|
|
Quantity int
|
|
|
|
ProfileType string
|
2023-10-31 22:40:14 +00:00
|
|
|
}
|
|
|
|
|
2024-02-04 02:05:31 +00:00
|
|
|
func (DB_GiftLoot) TableName() string {
|
|
|
|
return "GiftLoot"
|
2023-12-10 00:52:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type DB_DiscordPerson struct {
|
|
|
|
ID string `gorm:"primary_key"`
|
|
|
|
PersonID string
|
|
|
|
Username string
|
2023-12-16 22:08:37 +00:00
|
|
|
Avatar string
|
|
|
|
Banner string
|
2023-12-10 00:52:59 +00:00
|
|
|
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
|
2024-02-04 02:05:31 +00:00
|
|
|
SeasonXP int
|
|
|
|
SeasonalLevel int
|
|
|
|
SeasonalTier int
|
|
|
|
BattleStars int
|
2023-12-10 23:54:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (DB_SeasonStat) TableName() string {
|
|
|
|
return "Stats"
|
2024-02-04 02:05:31 +00:00
|
|
|
}
|
2024-02-04 10:56:21 +00:00
|
|
|
|
|
|
|
type DB_BanStatus struct {
|
|
|
|
ID string `gorm:"primary_key"`
|
|
|
|
PersonID string `gorm:"index"`
|
|
|
|
IssuedBy string
|
|
|
|
Expiry int64
|
|
|
|
Reason string
|
|
|
|
}
|
|
|
|
|
|
|
|
func (DB_BanStatus) TableName() string {
|
|
|
|
return "Bans"
|
|
|
|
}
|