feat: village meta - add 3 new fields to rest api: x, y, continent
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Dawid Wysokiński 2022-12-26 09:07:17 +01:00
parent efb84b4611
commit b7d0d9746f
Signed by: Kichiyaki
GPG Key ID: B5445E357FB8B892
3 changed files with 18 additions and 0 deletions

View File

@ -185,6 +185,9 @@ func TestEnnoblement_list(t *testing.T) {
Village: model.VillageMeta{
ID: 123,
FullName: "village name (450|450) K44",
Continent: "K44",
X: 450,
Y: 450,
ProfileURL: "profile-123",
},
NewOwner: model.NullPlayerMeta{
@ -230,6 +233,9 @@ func TestEnnoblement_list(t *testing.T) {
ID: 311,
FullName: "village name (550|550) K55",
ProfileURL: "profile-311",
Continent: "K55",
X: 550,
Y: 550,
},
NewOwner: model.NullPlayerMeta{
Valid: true,
@ -351,6 +357,9 @@ func TestEnnoblement_list(t *testing.T) {
Village: model.VillageMeta{
ID: 311,
FullName: "village name (450|450) K44",
Continent: "K44",
X: 450,
Y: 450,
ProfileURL: "profile-311",
},
NewOwner: model.NullPlayerMeta{

View File

@ -48,6 +48,9 @@ func NewVillage(v domain.VillageWithRelations) Village {
type VillageMeta struct {
ID int64 `json:"id"`
FullName string `json:"fullName" example:"Village (450|450) K44"`
X int64 `json:"x"`
Y int64 `json:"y"`
Continent string `json:"continent"`
ProfileURL string `json:"profileUrl"`
} // @name VillageMeta
@ -55,6 +58,9 @@ func NewVillageMeta(v domain.VillageMeta) VillageMeta {
return VillageMeta{
ID: v.ID,
FullName: v.FullName(),
X: v.X,
Y: v.Y,
Continent: v.Continent,
ProfileURL: v.ProfileURL,
}
}

View File

@ -185,5 +185,8 @@ func assertVillageMeta(tb testing.TB, dv domain.VillageMeta, rv model.VillageMet
assert.Equal(tb, dv.ID, rv.ID)
assert.Equal(tb, dv.FullName(), rv.FullName)
assert.Equal(tb, dv.X, rv.X)
assert.Equal(tb, dv.Y, rv.Y)
assert.Equal(tb, dv.Continent, rv.Continent)
assert.Equal(tb, dv.ProfileURL, rv.ProfileURL)
}