dcbot/internal/domain/tw.go

111 lines
1.9 KiB
Go
Raw Normal View History

package domain
import (
"fmt"
"time"
)
type TribeMeta struct {
ID int64
Name string
Tag string
ProfileURL string
}
type NullTribeMeta struct {
Tribe TribeMeta
Valid bool
}
type PlayerMeta struct {
ID int64
Name string
ProfileURL string
Tribe NullTribeMeta
}
type NullPlayerMeta struct {
Player PlayerMeta
Valid bool
}
type VillageMeta struct {
ID int64
FullName string
ProfileURL string
Player NullPlayerMeta
}
type Ennoblement struct {
ID int64
Village VillageMeta
NewOwner NullPlayerMeta
CreatedAt time.Time
}
type ServerDoesNotExistError struct {
VersionCode string
Key string
}
func (e ServerDoesNotExistError) Error() string {
return fmt.Sprintf("server (versionCode=%s,key=%s) doesn't exist", e.VersionCode, e.Key)
}
func (e ServerDoesNotExistError) UserError() string {
return e.Error()
}
func (e ServerDoesNotExistError) Code() ErrorCode {
return ErrorCodeValidationError
}
type ServerIsClosedError struct {
VersionCode string
Key string
}
func (e ServerIsClosedError) Error() string {
return fmt.Sprintf("server (versionCode=%s,key=%s) is closed", e.VersionCode, e.Key)
}
func (e ServerIsClosedError) UserError() string {
return e.Error()
}
func (e ServerIsClosedError) Code() ErrorCode {
return ErrorCodeValidationError
}
type TribeDoesNotExistError struct {
Tag string
}
func (e TribeDoesNotExistError) Error() string {
return fmt.Sprintf("tribe (tag=%s) doesn't exist", e.Tag)
}
func (e TribeDoesNotExistError) UserError() string {
return e.Error()
}
func (e TribeDoesNotExistError) Code() ErrorCode {
return ErrorCodeValidationError
}
type TribeNotFoundError struct {
Tag string
}
func (e TribeNotFoundError) Error() string {
return fmt.Sprintf("tribe (tag=%s) not found", e.Tag)
}
func (e TribeNotFoundError) UserError() string {
return e.Error()
}
func (e TribeNotFoundError) Code() ErrorCode {
return ErrorCodeEntityNotFound
}