feat: player - add more fields to api
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c545ebd7d7
commit
8739572c9b
|
@ -8,23 +8,30 @@ import (
|
|||
)
|
||||
|
||||
type Player struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
NumVillages int64 `json:"numVillages"`
|
||||
Points int64 `json:"points"`
|
||||
Rank int64 `json:"rank"`
|
||||
Tribe NullTribeMeta `json:"tribe" extensions:"x-nullable"`
|
||||
RankAtt int64 `json:"rankAtt"`
|
||||
ScoreAtt int64 `json:"scoreAtt"`
|
||||
RankDef int64 `json:"rankDef"`
|
||||
ScoreDef int64 `json:"scoreDef"`
|
||||
RankSup int64 `json:"rankSup"`
|
||||
ScoreSup int64 `json:"scoreSup"`
|
||||
RankTotal int64 `json:"rankTotal"`
|
||||
ScoreTotal int64 `json:"scoreTotal"`
|
||||
ProfileURL string `json:"profileUrl"`
|
||||
CreatedAt time.Time `json:"createdAt" format:"date-time"`
|
||||
DeletedAt NullTime `json:"deletedAt" swaggertype:"string" format:"date-time" extensions:"x-nullable"`
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
NumVillages int64 `json:"numVillages"`
|
||||
Points int64 `json:"points"`
|
||||
Rank int64 `json:"rank"`
|
||||
Tribe NullTribeMeta `json:"tribe" extensions:"x-nullable"`
|
||||
RankAtt int64 `json:"rankAtt"`
|
||||
ScoreAtt int64 `json:"scoreAtt"`
|
||||
RankDef int64 `json:"rankDef"`
|
||||
ScoreDef int64 `json:"scoreDef"`
|
||||
RankSup int64 `json:"rankSup"`
|
||||
ScoreSup int64 `json:"scoreSup"`
|
||||
RankTotal int64 `json:"rankTotal"`
|
||||
ScoreTotal int64 `json:"scoreTotal"`
|
||||
ProfileURL string `json:"profileUrl"`
|
||||
BestRank int64 `json:"bestRank"`
|
||||
BestRankAt time.Time `json:"bestRankAt" format:"date-time"`
|
||||
MostPoints int64 `json:"mostPoints"`
|
||||
MostPointsAt time.Time `json:"mostPointsAt" format:"date-time"`
|
||||
MostVillages int64 `json:"mostVillages"`
|
||||
MostVillagesAt time.Time `json:"mostVillagesAt" format:"date-time"`
|
||||
LastActivityAt time.Time `json:"lastActivityAt" format:"date-time"`
|
||||
CreatedAt time.Time `json:"createdAt" format:"date-time"`
|
||||
DeletedAt NullTime `json:"deletedAt" swaggertype:"string" format:"date-time" extensions:"x-nullable"`
|
||||
} // @name Player
|
||||
|
||||
func NewPlayer(p domain.PlayerWithRelations) Player {
|
||||
|
@ -36,22 +43,29 @@ func NewPlayer(p domain.PlayerWithRelations) Player {
|
|||
}
|
||||
}
|
||||
return Player{
|
||||
ID: p.ID,
|
||||
Name: p.Name,
|
||||
NumVillages: p.NumVillages,
|
||||
Points: p.Points,
|
||||
Rank: p.Rank,
|
||||
Tribe: t,
|
||||
RankAtt: p.RankAtt,
|
||||
ScoreAtt: p.ScoreAtt,
|
||||
RankDef: p.RankDef,
|
||||
ScoreDef: p.ScoreDef,
|
||||
RankSup: p.RankSup,
|
||||
ScoreSup: p.ScoreSup,
|
||||
RankTotal: p.RankTotal,
|
||||
ScoreTotal: p.ScoreTotal,
|
||||
ProfileURL: p.ProfileURL,
|
||||
CreatedAt: p.CreatedAt,
|
||||
ID: p.ID,
|
||||
Name: p.Name,
|
||||
NumVillages: p.NumVillages,
|
||||
Points: p.Points,
|
||||
Rank: p.Rank,
|
||||
Tribe: t,
|
||||
RankAtt: p.RankAtt,
|
||||
ScoreAtt: p.ScoreAtt,
|
||||
RankDef: p.RankDef,
|
||||
ScoreDef: p.ScoreDef,
|
||||
RankSup: p.RankSup,
|
||||
ScoreSup: p.ScoreSup,
|
||||
RankTotal: p.RankTotal,
|
||||
ScoreTotal: p.ScoreTotal,
|
||||
ProfileURL: p.ProfileURL,
|
||||
BestRank: p.BestRank,
|
||||
BestRankAt: p.BestRankAt,
|
||||
MostPoints: p.MostPoints,
|
||||
MostPointsAt: p.MostPointsAt,
|
||||
MostVillages: p.MostVillages,
|
||||
MostVillagesAt: p.MostVillagesAt,
|
||||
LastActivityAt: p.LastActivityAt,
|
||||
CreatedAt: p.CreatedAt,
|
||||
DeletedAt: NullTime{
|
||||
Time: p.DeletedAt,
|
||||
Valid: !p.DeletedAt.IsZero(),
|
||||
|
|
|
@ -23,14 +23,22 @@ func TestNewPlayer(t *testing.T) {
|
|||
RankTotal: 2,
|
||||
ScoreTotal: 1,
|
||||
},
|
||||
ID: 997,
|
||||
Name: "name 997",
|
||||
NumVillages: 5,
|
||||
Points: 4,
|
||||
Rank: 2,
|
||||
ProfileURL: "profile-997",
|
||||
ServerKey: "pl151",
|
||||
CreatedAt: time.Now(),
|
||||
ID: 997,
|
||||
Name: "name 997",
|
||||
NumVillages: 5,
|
||||
Points: 4,
|
||||
Rank: 2,
|
||||
TribeID: 0,
|
||||
ProfileURL: "profile-997",
|
||||
BestRank: 111,
|
||||
BestRankAt: time.Now(),
|
||||
MostPoints: 1112,
|
||||
MostPointsAt: time.Now().Add(-5 * time.Minute),
|
||||
MostVillages: 1113,
|
||||
MostVillagesAt: time.Now().Add(time.Minute),
|
||||
LastActivityAt: time.Now().Add(time.Second),
|
||||
ServerKey: "pl151",
|
||||
CreatedAt: time.Now(),
|
||||
},
|
||||
}
|
||||
assertPlayer(t, playerWithoutTribe, model.NewPlayer(playerWithoutTribe))
|
||||
|
@ -47,15 +55,22 @@ func TestNewPlayer(t *testing.T) {
|
|||
RankTotal: 2,
|
||||
ScoreTotal: 1,
|
||||
},
|
||||
ID: 997,
|
||||
Name: "name 997",
|
||||
NumVillages: 5,
|
||||
Points: 4,
|
||||
Rank: 2,
|
||||
TribeID: 1234,
|
||||
ProfileURL: "profile-997",
|
||||
CreatedAt: time.Now(),
|
||||
ServerKey: "pl151",
|
||||
ID: 997,
|
||||
Name: "name 997",
|
||||
NumVillages: 5,
|
||||
Points: 4,
|
||||
Rank: 2,
|
||||
TribeID: 1234,
|
||||
ProfileURL: "profile-997",
|
||||
BestRank: 1117,
|
||||
BestRankAt: time.Now(),
|
||||
MostPoints: 1115,
|
||||
MostPointsAt: time.Now().Add(-5 * time.Second),
|
||||
MostVillages: 1114,
|
||||
MostVillagesAt: time.Now().Add(time.Hour),
|
||||
LastActivityAt: time.Now().Add(time.Minute),
|
||||
CreatedAt: time.Now(),
|
||||
ServerKey: "pl151",
|
||||
},
|
||||
Tribe: domain.NullTribeMeta{
|
||||
Valid: true,
|
||||
|
@ -248,15 +263,22 @@ func TestNewListPlayersResp(t *testing.T) {
|
|||
RankTotal: 2,
|
||||
ScoreTotal: 1,
|
||||
},
|
||||
ID: 997,
|
||||
Name: "name 997",
|
||||
NumVillages: 5,
|
||||
Points: 4,
|
||||
Rank: 2,
|
||||
TribeID: 1234,
|
||||
ProfileURL: "profile-997",
|
||||
ServerKey: "pl151",
|
||||
CreatedAt: time.Now(),
|
||||
ID: 997,
|
||||
Name: "name 997",
|
||||
NumVillages: 5,
|
||||
Points: 4,
|
||||
Rank: 2,
|
||||
TribeID: 1234,
|
||||
ProfileURL: "profile-997",
|
||||
BestRank: 1117,
|
||||
BestRankAt: time.Now(),
|
||||
MostPoints: 1115,
|
||||
MostPointsAt: time.Now().Add(-5 * time.Second),
|
||||
MostVillages: 1114,
|
||||
MostVillagesAt: time.Now().Add(time.Hour),
|
||||
LastActivityAt: time.Now().Add(time.Minute),
|
||||
ServerKey: "pl151",
|
||||
CreatedAt: time.Now(),
|
||||
},
|
||||
Tribe: domain.NullTribeMeta{
|
||||
Valid: true,
|
||||
|
@ -280,15 +302,22 @@ func TestNewListPlayersResp(t *testing.T) {
|
|||
RankTotal: 7,
|
||||
ScoreTotal: 8,
|
||||
},
|
||||
ID: 998,
|
||||
Name: "name 998",
|
||||
NumVillages: 2,
|
||||
Points: 3,
|
||||
Rank: 4,
|
||||
TribeID: 0,
|
||||
ProfileURL: "profile-998",
|
||||
ServerKey: "pl151",
|
||||
CreatedAt: time.Now(),
|
||||
ID: 998,
|
||||
Name: "name 998",
|
||||
NumVillages: 2,
|
||||
Points: 3,
|
||||
Rank: 4,
|
||||
TribeID: 0,
|
||||
ProfileURL: "profile-998",
|
||||
BestRank: 111,
|
||||
BestRankAt: time.Now(),
|
||||
MostPoints: 1112,
|
||||
MostPointsAt: time.Now().Add(-5 * time.Minute),
|
||||
MostVillages: 1113,
|
||||
MostVillagesAt: time.Now().Add(time.Minute),
|
||||
LastActivityAt: time.Now().Add(time.Second),
|
||||
ServerKey: "pl151",
|
||||
CreatedAt: time.Now(),
|
||||
},
|
||||
Tribe: domain.NullTribeMeta{
|
||||
Valid: false,
|
||||
|
@ -317,14 +346,21 @@ func TestNewGetPlayerResp(t *testing.T) {
|
|||
RankTotal: 2,
|
||||
ScoreTotal: 1,
|
||||
},
|
||||
ID: 997,
|
||||
Name: "name 997",
|
||||
NumVillages: 5,
|
||||
Points: 4,
|
||||
Rank: 2,
|
||||
ProfileURL: "profile-997",
|
||||
ServerKey: "pl151",
|
||||
CreatedAt: time.Now(),
|
||||
ID: 997,
|
||||
Name: "name 997",
|
||||
NumVillages: 5,
|
||||
Points: 4,
|
||||
Rank: 2,
|
||||
ProfileURL: "profile-997",
|
||||
BestRank: 1117,
|
||||
BestRankAt: time.Now(),
|
||||
MostPoints: 1115,
|
||||
MostPointsAt: time.Now().Add(-5 * time.Second),
|
||||
MostVillages: 1114,
|
||||
MostVillagesAt: time.Now().Add(time.Hour),
|
||||
LastActivityAt: time.Now().Add(time.Minute),
|
||||
ServerKey: "pl151",
|
||||
CreatedAt: time.Now(),
|
||||
},
|
||||
}
|
||||
assertPlayer(t, player, model.NewGetPlayerResp(player).Data)
|
||||
|
@ -347,6 +383,13 @@ func assertPlayer(tb testing.TB, dp domain.PlayerWithRelations, rp model.Player)
|
|||
assert.Equal(tb, dp.RankTotal, rp.RankTotal)
|
||||
assert.Equal(tb, dp.ScoreTotal, rp.ScoreTotal)
|
||||
assert.Equal(tb, dp.ProfileURL, rp.ProfileURL)
|
||||
assert.Equal(tb, dp.BestRank, rp.BestRank)
|
||||
assert.Equal(tb, dp.BestRankAt, rp.BestRankAt)
|
||||
assert.Equal(tb, dp.MostPoints, rp.MostPoints)
|
||||
assert.Equal(tb, dp.MostPointsAt, rp.MostPointsAt)
|
||||
assert.Equal(tb, dp.MostVillages, rp.MostVillages)
|
||||
assert.Equal(tb, dp.MostVillagesAt, rp.MostVillagesAt)
|
||||
assert.Equal(tb, dp.LastActivityAt, rp.LastActivityAt)
|
||||
assert.Equal(tb, dp.CreatedAt, rp.CreatedAt)
|
||||
assertNullTribeMeta(tb, dp.Tribe, rp.Tribe)
|
||||
assertNullTime(tb, dp.DeletedAt, rp.DeletedAt)
|
||||
|
|
|
@ -79,15 +79,22 @@ func TestPlayer_list(t *testing.T) {
|
|||
RankTotal: 2,
|
||||
ScoreTotal: 1,
|
||||
},
|
||||
ID: 997,
|
||||
Name: "name 997",
|
||||
NumVillages: 5,
|
||||
Points: 4,
|
||||
Rank: 2,
|
||||
TribeID: 1234,
|
||||
ProfileURL: "profile-997",
|
||||
ServerKey: server.Key,
|
||||
CreatedAt: now,
|
||||
ID: 997,
|
||||
Name: "name 997",
|
||||
NumVillages: 5,
|
||||
Points: 4,
|
||||
Rank: 2,
|
||||
TribeID: 1234,
|
||||
ProfileURL: "profile-997",
|
||||
BestRank: 111,
|
||||
BestRankAt: now,
|
||||
MostPoints: 1112,
|
||||
MostPointsAt: now.Add(-5 * time.Minute),
|
||||
MostVillages: 1113,
|
||||
MostVillagesAt: now.Add(time.Minute),
|
||||
LastActivityAt: now.Add(time.Second),
|
||||
ServerKey: server.Key,
|
||||
CreatedAt: now,
|
||||
},
|
||||
Tribe: domain.NullTribeMeta{
|
||||
Valid: true,
|
||||
|
@ -111,15 +118,22 @@ func TestPlayer_list(t *testing.T) {
|
|||
RankTotal: 7,
|
||||
ScoreTotal: 8,
|
||||
},
|
||||
ID: 998,
|
||||
Name: "name 998",
|
||||
NumVillages: 2,
|
||||
Points: 3,
|
||||
Rank: 4,
|
||||
TribeID: 0,
|
||||
ProfileURL: "profile-998",
|
||||
ServerKey: server.Key,
|
||||
CreatedAt: now,
|
||||
ID: 998,
|
||||
Name: "name 998",
|
||||
NumVillages: 2,
|
||||
Points: 3,
|
||||
Rank: 4,
|
||||
TribeID: 0,
|
||||
ProfileURL: "profile-998",
|
||||
BestRank: 1117,
|
||||
BestRankAt: now,
|
||||
MostPoints: 1115,
|
||||
MostPointsAt: now.Add(-5 * time.Second),
|
||||
MostVillages: 1114,
|
||||
MostVillagesAt: now.Add(time.Hour),
|
||||
LastActivityAt: now.Add(time.Minute),
|
||||
ServerKey: server.Key,
|
||||
CreatedAt: now,
|
||||
},
|
||||
Tribe: domain.NullTribeMeta{
|
||||
Valid: false,
|
||||
|
@ -136,20 +150,27 @@ func TestPlayer_list(t *testing.T) {
|
|||
expectedResponse: &model.ListPlayersResp{
|
||||
Data: []model.Player{
|
||||
{
|
||||
RankAtt: 8,
|
||||
ScoreAtt: 7,
|
||||
RankDef: 6,
|
||||
ScoreDef: 5,
|
||||
RankSup: 4,
|
||||
ScoreSup: 3,
|
||||
RankTotal: 2,
|
||||
ScoreTotal: 1,
|
||||
ID: 997,
|
||||
Name: "name 997",
|
||||
NumVillages: 5,
|
||||
Points: 4,
|
||||
Rank: 2,
|
||||
ProfileURL: "profile-997",
|
||||
RankAtt: 8,
|
||||
ScoreAtt: 7,
|
||||
RankDef: 6,
|
||||
ScoreDef: 5,
|
||||
RankSup: 4,
|
||||
ScoreSup: 3,
|
||||
RankTotal: 2,
|
||||
ScoreTotal: 1,
|
||||
ID: 997,
|
||||
Name: "name 997",
|
||||
NumVillages: 5,
|
||||
Points: 4,
|
||||
Rank: 2,
|
||||
ProfileURL: "profile-997",
|
||||
BestRank: 111,
|
||||
BestRankAt: now,
|
||||
MostPoints: 1112,
|
||||
MostPointsAt: now.Add(-5 * time.Minute),
|
||||
MostVillages: 1113,
|
||||
MostVillagesAt: now.Add(time.Minute),
|
||||
LastActivityAt: now.Add(time.Second),
|
||||
Tribe: model.NullTribeMeta{
|
||||
Valid: true,
|
||||
Tribe: model.TribeMeta{
|
||||
|
@ -162,20 +183,27 @@ func TestPlayer_list(t *testing.T) {
|
|||
CreatedAt: now,
|
||||
},
|
||||
{
|
||||
RankAtt: 1,
|
||||
ScoreAtt: 2,
|
||||
RankDef: 3,
|
||||
ScoreDef: 4,
|
||||
RankSup: 5,
|
||||
ScoreSup: 6,
|
||||
RankTotal: 7,
|
||||
ScoreTotal: 8,
|
||||
ID: 998,
|
||||
Name: "name 998",
|
||||
NumVillages: 2,
|
||||
Points: 3,
|
||||
Rank: 4,
|
||||
ProfileURL: "profile-998",
|
||||
RankAtt: 1,
|
||||
ScoreAtt: 2,
|
||||
RankDef: 3,
|
||||
ScoreDef: 4,
|
||||
RankSup: 5,
|
||||
ScoreSup: 6,
|
||||
RankTotal: 7,
|
||||
ScoreTotal: 8,
|
||||
ID: 998,
|
||||
Name: "name 998",
|
||||
NumVillages: 2,
|
||||
Points: 3,
|
||||
Rank: 4,
|
||||
ProfileURL: "profile-998",
|
||||
BestRank: 1117,
|
||||
BestRankAt: now,
|
||||
MostPoints: 1115,
|
||||
MostPointsAt: now.Add(-5 * time.Second),
|
||||
MostVillages: 1114,
|
||||
MostVillagesAt: now.Add(time.Hour),
|
||||
LastActivityAt: now.Add(time.Minute),
|
||||
Tribe: model.NullTribeMeta{
|
||||
Valid: false,
|
||||
},
|
||||
|
@ -223,16 +251,23 @@ func TestPlayer_list(t *testing.T) {
|
|||
RankTotal: 7,
|
||||
ScoreTotal: 8,
|
||||
},
|
||||
ID: 998,
|
||||
Name: "name 998",
|
||||
NumVillages: 2,
|
||||
Points: 3,
|
||||
Rank: 4,
|
||||
TribeID: 0,
|
||||
ProfileURL: "profile-998",
|
||||
ServerKey: server.Key,
|
||||
CreatedAt: now,
|
||||
DeletedAt: now,
|
||||
ID: 998,
|
||||
Name: "name 998",
|
||||
NumVillages: 2,
|
||||
Points: 3,
|
||||
Rank: 4,
|
||||
TribeID: 0,
|
||||
ProfileURL: "profile-998",
|
||||
BestRank: 1117,
|
||||
BestRankAt: now,
|
||||
MostPoints: 1115,
|
||||
MostPointsAt: now.Add(-5 * time.Second),
|
||||
MostVillages: 1114,
|
||||
MostVillagesAt: now.Add(time.Hour),
|
||||
LastActivityAt: now.Add(time.Minute),
|
||||
ServerKey: server.Key,
|
||||
CreatedAt: now,
|
||||
DeletedAt: now,
|
||||
},
|
||||
Tribe: domain.NullTribeMeta{},
|
||||
},
|
||||
|
@ -253,20 +288,27 @@ func TestPlayer_list(t *testing.T) {
|
|||
expectedResponse: &model.ListPlayersResp{
|
||||
Data: []model.Player{
|
||||
{
|
||||
RankAtt: 1,
|
||||
ScoreAtt: 2,
|
||||
RankDef: 3,
|
||||
ScoreDef: 4,
|
||||
RankSup: 5,
|
||||
ScoreSup: 6,
|
||||
RankTotal: 7,
|
||||
ScoreTotal: 8,
|
||||
ID: 998,
|
||||
Name: "name 998",
|
||||
NumVillages: 2,
|
||||
Points: 3,
|
||||
Rank: 4,
|
||||
ProfileURL: "profile-998",
|
||||
RankAtt: 1,
|
||||
ScoreAtt: 2,
|
||||
RankDef: 3,
|
||||
ScoreDef: 4,
|
||||
RankSup: 5,
|
||||
ScoreSup: 6,
|
||||
RankTotal: 7,
|
||||
ScoreTotal: 8,
|
||||
ID: 998,
|
||||
Name: "name 998",
|
||||
NumVillages: 2,
|
||||
Points: 3,
|
||||
Rank: 4,
|
||||
ProfileURL: "profile-998",
|
||||
BestRank: 1117,
|
||||
BestRankAt: now,
|
||||
MostPoints: 1115,
|
||||
MostPointsAt: now.Add(-5 * time.Second),
|
||||
MostVillages: 1114,
|
||||
MostVillagesAt: now.Add(time.Hour),
|
||||
LastActivityAt: now.Add(time.Minute),
|
||||
Tribe: model.NullTribeMeta{
|
||||
Valid: false,
|
||||
},
|
||||
|
@ -323,16 +365,23 @@ func TestPlayer_list(t *testing.T) {
|
|||
RankTotal: 7,
|
||||
ScoreTotal: 8,
|
||||
},
|
||||
ID: 998,
|
||||
Name: "name 998",
|
||||
NumVillages: 2,
|
||||
Points: 3,
|
||||
Rank: 4,
|
||||
TribeID: 0,
|
||||
ProfileURL: "profile-998",
|
||||
ServerKey: server.Key,
|
||||
CreatedAt: now,
|
||||
DeletedAt: now,
|
||||
ID: 998,
|
||||
Name: "name 998",
|
||||
NumVillages: 2,
|
||||
Points: 3,
|
||||
Rank: 4,
|
||||
TribeID: 0,
|
||||
ProfileURL: "profile-998",
|
||||
BestRank: 1117,
|
||||
BestRankAt: now,
|
||||
MostPoints: 1115,
|
||||
MostPointsAt: now.Add(-5 * time.Second),
|
||||
MostVillages: 1114,
|
||||
MostVillagesAt: now.Add(time.Hour),
|
||||
LastActivityAt: now.Add(time.Minute),
|
||||
ServerKey: server.Key,
|
||||
CreatedAt: now,
|
||||
DeletedAt: now,
|
||||
},
|
||||
Tribe: domain.NullTribeMeta{},
|
||||
},
|
||||
|
@ -351,20 +400,27 @@ func TestPlayer_list(t *testing.T) {
|
|||
expectedResponse: &model.ListPlayersResp{
|
||||
Data: []model.Player{
|
||||
{
|
||||
RankAtt: 1,
|
||||
ScoreAtt: 2,
|
||||
RankDef: 3,
|
||||
ScoreDef: 4,
|
||||
RankSup: 5,
|
||||
ScoreSup: 6,
|
||||
RankTotal: 7,
|
||||
ScoreTotal: 8,
|
||||
ID: 998,
|
||||
Name: "name 998",
|
||||
NumVillages: 2,
|
||||
Points: 3,
|
||||
Rank: 4,
|
||||
ProfileURL: "profile-998",
|
||||
RankAtt: 1,
|
||||
ScoreAtt: 2,
|
||||
RankDef: 3,
|
||||
ScoreDef: 4,
|
||||
RankSup: 5,
|
||||
ScoreSup: 6,
|
||||
RankTotal: 7,
|
||||
ScoreTotal: 8,
|
||||
ID: 998,
|
||||
Name: "name 998",
|
||||
NumVillages: 2,
|
||||
Points: 3,
|
||||
Rank: 4,
|
||||
ProfileURL: "profile-998",
|
||||
BestRank: 1117,
|
||||
BestRankAt: now,
|
||||
MostPoints: 1115,
|
||||
MostPointsAt: now.Add(-5 * time.Second),
|
||||
MostVillages: 1114,
|
||||
MostVillagesAt: now.Add(time.Hour),
|
||||
LastActivityAt: now.Add(time.Minute),
|
||||
Tribe: model.NullTribeMeta{
|
||||
Valid: false,
|
||||
},
|
||||
|
@ -616,15 +672,22 @@ func TestPlayer_getByID(t *testing.T) {
|
|||
RankTotal: 2,
|
||||
ScoreTotal: 1,
|
||||
},
|
||||
ID: 997,
|
||||
Name: "name 997",
|
||||
NumVillages: 5,
|
||||
Points: 4,
|
||||
Rank: 2,
|
||||
TribeID: 1234,
|
||||
ProfileURL: "profile-997",
|
||||
ServerKey: server.Key,
|
||||
CreatedAt: now,
|
||||
ID: 997,
|
||||
Name: "name 997",
|
||||
NumVillages: 5,
|
||||
Points: 4,
|
||||
Rank: 2,
|
||||
TribeID: 1234,
|
||||
ProfileURL: "profile-997",
|
||||
BestRank: 111,
|
||||
BestRankAt: now,
|
||||
MostPoints: 1112,
|
||||
MostPointsAt: now.Add(-5 * time.Minute),
|
||||
MostVillages: 1113,
|
||||
MostVillagesAt: now.Add(time.Minute),
|
||||
LastActivityAt: now.Add(time.Second),
|
||||
ServerKey: server.Key,
|
||||
CreatedAt: now,
|
||||
},
|
||||
Tribe: domain.NullTribeMeta{
|
||||
Valid: true,
|
||||
|
@ -644,21 +707,28 @@ func TestPlayer_getByID(t *testing.T) {
|
|||
target: &model.GetPlayerResp{},
|
||||
expectedResponse: &model.GetPlayerResp{
|
||||
Data: model.Player{
|
||||
ID: 997,
|
||||
Name: "name 997",
|
||||
NumVillages: 5,
|
||||
Points: 4,
|
||||
Rank: 2,
|
||||
RankAtt: 8,
|
||||
ScoreAtt: 7,
|
||||
RankDef: 6,
|
||||
ScoreDef: 5,
|
||||
RankSup: 4,
|
||||
ScoreSup: 3,
|
||||
RankTotal: 2,
|
||||
ScoreTotal: 1,
|
||||
ProfileURL: "profile-997",
|
||||
CreatedAt: now,
|
||||
ID: 997,
|
||||
Name: "name 997",
|
||||
NumVillages: 5,
|
||||
Points: 4,
|
||||
Rank: 2,
|
||||
RankAtt: 8,
|
||||
ScoreAtt: 7,
|
||||
RankDef: 6,
|
||||
ScoreDef: 5,
|
||||
RankSup: 4,
|
||||
ScoreSup: 3,
|
||||
RankTotal: 2,
|
||||
ScoreTotal: 1,
|
||||
ProfileURL: "profile-997",
|
||||
BestRank: 111,
|
||||
BestRankAt: now,
|
||||
MostPoints: 1112,
|
||||
MostPointsAt: now.Add(-5 * time.Minute),
|
||||
MostVillages: 1113,
|
||||
MostVillagesAt: now.Add(time.Minute),
|
||||
LastActivityAt: now.Add(time.Second),
|
||||
CreatedAt: now,
|
||||
Tribe: model.NullTribeMeta{
|
||||
Tribe: model.TribeMeta{
|
||||
ID: 1234,
|
||||
|
|
Reference in New Issue
Block a user