All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: twhelp/core#162
92 lines
1.6 KiB
Go
92 lines
1.6 KiB
Go
package domain
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
type Village struct {
|
|
ID int64
|
|
Name string
|
|
Points int64
|
|
X int64
|
|
Y int64
|
|
Continent string
|
|
Bonus int64
|
|
PlayerID int64
|
|
ProfileURL string
|
|
ServerKey string
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
func (v Village) FullName() string {
|
|
return fmt.Sprintf("%s (%d|%d) %s", v.Name, v.X, v.Y, v.Continent)
|
|
}
|
|
|
|
type VillageWithRelations struct {
|
|
Village
|
|
|
|
Player NullPlayerMetaWithRelations
|
|
}
|
|
|
|
type VillageMeta struct {
|
|
ID int64
|
|
Name string
|
|
X int64
|
|
Y int64
|
|
Continent string
|
|
ProfileURL string
|
|
}
|
|
|
|
type VillageMetaWithRelations struct {
|
|
VillageMeta
|
|
|
|
Player NullPlayerMetaWithRelations
|
|
}
|
|
|
|
func (v VillageMeta) FullName() string {
|
|
return fmt.Sprintf("%s (%d|%d) %s", v.Name, v.X, v.Y, v.Continent)
|
|
}
|
|
|
|
type CreateVillageParams struct {
|
|
ID int64
|
|
Name string
|
|
Points int64
|
|
X int64
|
|
Y int64
|
|
Continent string
|
|
Bonus int64
|
|
PlayerID int64
|
|
ProfileURL string
|
|
ServerKey string
|
|
}
|
|
|
|
type ListVillagesParams struct {
|
|
IDs []int64
|
|
ServerKeys []string
|
|
Pagination Pagination
|
|
}
|
|
|
|
type RefreshVillagesResult struct {
|
|
NumVillages int64
|
|
NumPlayerVillages int64
|
|
NumBarbarianVillages int64
|
|
NumBonusVillages int64
|
|
}
|
|
|
|
type VillageNotFoundError struct {
|
|
ID int64
|
|
}
|
|
|
|
func (e VillageNotFoundError) Error() string {
|
|
return fmt.Sprintf("village (id=%d) not found", e.ID)
|
|
}
|
|
|
|
func (e VillageNotFoundError) UserError() string {
|
|
return e.Error()
|
|
}
|
|
|
|
func (e VillageNotFoundError) Code() ErrorCode {
|
|
return ErrorCodeEntityNotFound
|
|
}
|