refactor: openapi - update Tribe schema
This commit is contained in:
parent
cde03857a2
commit
a863c7af2e
|
@ -813,6 +813,28 @@ components:
|
|||
$ref: "#/components/schemas/Building"
|
||||
wood:
|
||||
$ref: "#/components/schemas/Building"
|
||||
TribeOpponentsDefeated:
|
||||
type: object
|
||||
required:
|
||||
- rankAtt
|
||||
- scoreAtt
|
||||
- rankDef
|
||||
- scoreDef
|
||||
- rankTotal
|
||||
- scoreTotal
|
||||
properties:
|
||||
rankAtt:
|
||||
type: integer
|
||||
scoreAtt:
|
||||
type: integer
|
||||
rankDef:
|
||||
type: integer
|
||||
scoreDef:
|
||||
type: integer
|
||||
rankTotal:
|
||||
type: integer
|
||||
scoreTotal:
|
||||
type: integer
|
||||
Tribe:
|
||||
type: object
|
||||
required:
|
||||
|
@ -826,12 +848,7 @@ components:
|
|||
- numVillages
|
||||
- rank
|
||||
- dominance
|
||||
- rankAtt
|
||||
- scoreAtt
|
||||
- rankDef
|
||||
- scoreDef
|
||||
- rankTotal
|
||||
- scoreTotal
|
||||
- opponentsDefeated
|
||||
- bestRank
|
||||
- bestRankAt
|
||||
- mostVillages
|
||||
|
@ -862,18 +879,8 @@ components:
|
|||
dominance:
|
||||
type: number
|
||||
format: double
|
||||
rankAtt:
|
||||
type: integer
|
||||
scoreAtt:
|
||||
type: integer
|
||||
rankDef:
|
||||
type: integer
|
||||
scoreDef:
|
||||
type: integer
|
||||
rankTotal:
|
||||
type: integer
|
||||
scoreTotal:
|
||||
type: integer
|
||||
opponentsDefeated:
|
||||
$ref: "#/components/schemas/TribeOpponentsDefeated"
|
||||
bestRank:
|
||||
type: integer
|
||||
bestRankAt:
|
||||
|
|
|
@ -4,31 +4,37 @@ import (
|
|||
"gitea.dwysokinski.me/twhelp/corev3/internal/domain"
|
||||
)
|
||||
|
||||
func NewTribeOpponentsDefeated(od domain.OpponentsDefeated) TribeOpponentsDefeated {
|
||||
return TribeOpponentsDefeated{
|
||||
RankAtt: od.RankAtt(),
|
||||
RankDef: od.RankDef(),
|
||||
RankTotal: od.RankTotal(),
|
||||
ScoreAtt: od.ScoreAtt(),
|
||||
ScoreDef: od.ScoreDef(),
|
||||
ScoreTotal: od.ScoreTotal(),
|
||||
}
|
||||
}
|
||||
|
||||
func NewTribe(t domain.Tribe) Tribe {
|
||||
converted := Tribe{
|
||||
AllPoints: t.AllPoints(),
|
||||
BestRank: t.BestRank(),
|
||||
BestRankAt: t.BestRankAt(),
|
||||
CreatedAt: t.CreatedAt(),
|
||||
Dominance: t.Dominance(),
|
||||
Id: t.ID(),
|
||||
MostPoints: t.MostPoints(),
|
||||
MostPointsAt: t.MostPointsAt(),
|
||||
MostVillages: t.MostVillages(),
|
||||
MostVillagesAt: t.MostVillagesAt(),
|
||||
Name: t.Name(),
|
||||
NumMembers: t.NumMembers(),
|
||||
NumVillages: t.NumVillages(),
|
||||
Points: t.Points(),
|
||||
ProfileUrl: t.ProfileURL().String(),
|
||||
Rank: t.Rank(),
|
||||
RankAtt: t.OD().RankAtt(),
|
||||
RankDef: t.OD().RankDef(),
|
||||
RankTotal: t.OD().RankTotal(),
|
||||
ScoreAtt: t.OD().ScoreAtt(),
|
||||
ScoreDef: t.OD().ScoreDef(),
|
||||
ScoreTotal: t.OD().ScoreTotal(),
|
||||
Tag: t.Tag(),
|
||||
AllPoints: t.AllPoints(),
|
||||
BestRank: t.BestRank(),
|
||||
BestRankAt: t.BestRankAt(),
|
||||
CreatedAt: t.CreatedAt(),
|
||||
Dominance: t.Dominance(),
|
||||
Id: t.ID(),
|
||||
MostPoints: t.MostPoints(),
|
||||
MostPointsAt: t.MostPointsAt(),
|
||||
MostVillages: t.MostVillages(),
|
||||
MostVillagesAt: t.MostVillagesAt(),
|
||||
Name: t.Name(),
|
||||
NumMembers: t.NumMembers(),
|
||||
NumVillages: t.NumVillages(),
|
||||
Points: t.Points(),
|
||||
ProfileUrl: t.ProfileURL().String(),
|
||||
Rank: t.Rank(),
|
||||
OpponentsDefeated: NewTribeOpponentsDefeated(t.OD()),
|
||||
Tag: t.Tag(),
|
||||
}
|
||||
|
||||
if deletedAt := t.DeletedAt(); !deletedAt.IsZero() {
|
||||
|
|
Loading…
Reference in New Issue