add new fields to Player/Tribe models

This commit is contained in:
Dawid Wysokiński 2020-06-25 13:36:40 +02:00
parent 9768e416ae
commit 16e0e71c77
2 changed files with 35 additions and 23 deletions

View File

@ -5,17 +5,23 @@ import "time"
type Player struct {
tableName struct{} `pg:"?SERVER.players,alias:player"`
ID int `json:"id" pg:",pk" gqlgen:"id"`
Name string `json:"name" gqlgen:"name"`
Exist *bool `json:"exist" pg:",use_zero" gqlgen:"exist"`
TotalVillages int `json:"totalVillages" pg:",use_zero" gqlgen:"totalVillages"`
Points int `json:"points" pg:",use_zero" gqlgen:"points"`
Rank int `json:"rank" pg:",use_zero" gqlgen:"rank"`
TribeID int `json:"-" pg:",use_zero" gqlgen:"tribeID"`
Tribe *Tribe `json:"tribe,omitempty" gqlgen:"-"`
DailyGrowth int `json:"dailyGrowth" pg:",use_zero" gqlgen:"dailyGrowth"`
JoinedAt time.Time `json:"joinedAt" pg:"default:now(),use_zero" gqlgen:"joinedAt"`
DeletedAt time.Time `json:"deletedAt" pg:",use_zero" gqlgen:"deletedAt"`
ID int `json:"id" pg:",pk" gqlgen:"id"`
Name string `json:"name" gqlgen:"name"`
Exist *bool `json:"exist" pg:",use_zero" gqlgen:"exist"`
TotalVillages int `json:"totalVillages" pg:",use_zero" gqlgen:"totalVillages"`
Points int `json:"points" pg:",use_zero" gqlgen:"points"`
Rank int `json:"rank" pg:",use_zero" gqlgen:"rank"`
TribeID int `json:"-" pg:",use_zero" gqlgen:"tribeID"`
Tribe *Tribe `json:"tribe,omitempty" gqlgen:"-"`
DailyGrowth int `json:"dailyGrowth" pg:",use_zero" gqlgen:"dailyGrowth"`
BestRank int `json:"bestRank" pg:",use_zero" gqlgen:"bestRank"`
BestRankAt time.Time `json:"bestRankAt" pg:"default:now(),use_zero" gqlgen:"bestRankAt"`
MostPoints int `json:"mostPoints" pg:",use_zero" gqlgen:"mostPoints"`
MostPointsAt time.Time `json:"mostPointsAt" pg:"default:now(),use_zero" gqlgen:"mostPointsAt"`
MostVillages int `json:"mostVillages" pg:",use_zero" gqlgen:"mostVillages"`
MostVillagesAt time.Time `json:"mostVillagesAt" pg:"default:now(),use_zero" gqlgen:"mostVillagesAt"`
JoinedAt time.Time `json:"joinedAt" pg:"default:now(),use_zero" gqlgen:"joinedAt"`
DeletedAt time.Time `json:"deletedAt" pg:",use_zero" gqlgen:"deletedAt"`
OpponentsDefeated
}

View File

@ -5,18 +5,24 @@ import "time"
type Tribe struct {
tableName struct{} `pg:"?SERVER.tribes,alias:tribe"`
ID int `json:"id" gqlgen:"id"`
Name string `json:"name" gqlgen:"name"`
Tag string `json:"tag" gqlgen:"tag"`
TotalMembers int `json:"totalMembers" gqlgen:"totalMembers" pg:",use_zero"`
TotalVillages int `json:"totalVillages" gqlgen:"totalVillages" pg:",use_zero"`
Points int `json:"points" gqlgen:"points" pg:",use_zero"`
AllPoints int `json:"allPoints" gqlgen:"allPoints" pg:",use_zero"`
Rank int `json:"rank" gqlgen:"rank" pg:",use_zero"`
Dominance float64 `json:"dominance" gqlgen:"dominance" pg:",use_zero"`
Exist *bool `json:"exist" gqlgen:"exist" pg:",use_zero"`
CreatedAt time.Time `json:"createdAt" pg:"default:now(),use_zero" gqlgen:"createdAt"`
DeletedAt time.Time `json:"deletedAt" pg:",use_zero" gqlgen:"deletedAt"`
ID int `json:"id" gqlgen:"id"`
Name string `json:"name" gqlgen:"name"`
Tag string `json:"tag" gqlgen:"tag"`
Exist *bool `json:"exist" gqlgen:"exist" pg:",use_zero"`
TotalMembers int `json:"totalMembers" gqlgen:"totalMembers" pg:",use_zero"`
TotalVillages int `json:"totalVillages" gqlgen:"totalVillages" pg:",use_zero"`
Points int `json:"points" gqlgen:"points" pg:",use_zero"`
AllPoints int `json:"allPoints" gqlgen:"allPoints" pg:",use_zero"`
Rank int `json:"rank" gqlgen:"rank" pg:",use_zero"`
Dominance float64 `json:"dominance" gqlgen:"dominance" pg:",use_zero"`
BestRank int `json:"bestRank" pg:",use_zero" gqlgen:"bestRank"`
BestRankAt time.Time `json:"bestRankAt" pg:"default:now(),use_zero" gqlgen:"bestRankAt"`
MostPoints int `json:"mostPoints" pg:",use_zero" gqlgen:"mostPoints"`
MostPointsAt time.Time `json:"mostPointsAt" pg:"default:now(),use_zero" gqlgen:"mostPointsAt"`
MostVillages int `json:"mostVillages" pg:",use_zero" gqlgen:"mostVillages"`
MostVillagesAt time.Time `json:"mostVillagesAt" pg:"default:now(),use_zero" gqlgen:"mostVillagesAt"`
CreatedAt time.Time `json:"createdAt" pg:"default:now(),use_zero" gqlgen:"createdAt"`
DeletedAt time.Time `json:"deletedAt" pg:",use_zero" gqlgen:"deletedAt"`
OpponentsDefeated
}