Skip to content

Commit

Permalink
feat: refactor models + add fields
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed Mar 15, 2019
1 parent d1d015f commit ccbc256
Show file tree
Hide file tree
Showing 6 changed files with 7,531 additions and 2,271 deletions.
66 changes: 43 additions & 23 deletions entity/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,63 @@ func ByName(name string) interface{} {
func AllMap() map[string]interface{} {
return map[string]interface{}{
"Achievement": Achievement{},
"AuthMethod": AuthMethod{},
"Coupon": Coupon{},
"CouponValidation": CouponValidation{},
"Event": Event{},
"Hypervisor": Hypervisor{},
"InventoryItem": InventoryItem{},
"Level": Level{},
"LevelFlavor": LevelFlavor{},
"LevelInstance": LevelInstance{},
"LevelSubscription": LevelSubscription{},
"Level": Level{},
"LevelValidation": LevelValidation{},
"LevelVersion": LevelVersion{},
"Notification": Notification{},
"ShopItem": ShopItem{},
"TeamMember": TeamMember{},
"Team": Team{},
"TournamentTeam": TournamentTeam{},
"TeamMember": TeamMember{},
"Tournament": Tournament{},
"UserSession": UserSession{},
"TournamentMember": TournamentMember{},
"TournamentTeam": TournamentTeam{},
"User": User{},
"UserSession": UserSession{},
"WhoswhoAttempt": WhoswhoAttempt{},
}
}

func All() []interface{} {
return []interface{}{
Achievement{},
Coupon{},
Event{},
Hypervisor{},
LevelFlavor{},
LevelInstance{},
LevelSubscription{},
Level{},
Notification{},
ShopItem{},
TeamMember{},
Team{},
TournamentTeam{},
Tournament{},
UserSession{},
User{},
WhoswhoAttempt{},
out := []interface{}{}
for _, entry := range AllMap() {
out = append(out, entry)
}
return out
}

func ForeignKeys() [][3]string {
return [][3]string{
{"TeamMember", "user_id", "user(id)"},
{"TeamMember", "team_id", "team(id)"},
{"TournamentMember", "user_id", "user(id)"},
{"TournamentMember", "tournament_team_id", "tournament_team(id)"},
{"UserSession", "user_id", "user(id)"},
{"LevelVersion", "level_id", "level(id)"},
{"TournamentTeam", "tournament_id", "tournament(id)"},
{"TournamentTeam", "team_id", "team(id)"},
{"WhoswhoAttempt", "author_id", "tournament_member(id)"},
{"WhoswhoAttempt", "target_member_id", "tournament_member(id)"},
{"WhoswhoAttempt", "target_team_id", "tournament_team(id)"},
{"LevelValidation", "level_subscription_id", "level_subscription(id)"},
{"LevelSubscription", "tournament_team_id", "tournament_team(id)"},
{"LevelSubscription", "level_flavor_id", "level_flavor(id)"},
{"InventoryItem", "owner_id", "tournament_member(id)"},
{"LevelFlavor", "level_id", "level(id)"},
{"LevelInstance", "hypervisor_id", "hypervisor(id)"},
{"LevelInstance", "flavor_id", "level_flavor(id)"},
{"Notification", "user_id", "user(id)"},
{"Coupon", "tournament_id", "tournament(id)"},
{"CouponValidation", "author_id", "tournament_member(id)"},
{"CouponValidation", "coupon_id", "coupon(id)"},
{"Achievement", "author_id", "tournament_member(id)"},
{"Achievement", "level_validation_id", "level_validation(id)"},
}
}
Loading

0 comments on commit ccbc256

Please sign in to comment.