domain

package
v0.0.0-...-2f27ceb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Monster

type Monster struct {
	ID           primitive.ObjectID   `json:"_id" bson:"_id,omitempty"`
	MonsterTypes []primitive.ObjectID `json:"monster_types" bson:"monster_types"`
	Name         string               `json:"name" bson:"name"`
	ImageUrl     string               `json:"image_url" bson:"image_url"`
	Description  string               `json:"description" bson:"description"`
	Size         float32              `json:"size" bson:"size"`
	Weight       float32              `json:"weight" bson:"weight"`
	Hp           int32                `json:"hp" bson:"hp"`
	Attack       int32                `json:"attack" bson:"attack"`
	Defense      int32                `json:"defense" bson:"defense"`
	Speed        int32                `json:"speed" bson:"speed"`
	CreatedAt    time.Time            `json:"created_at" bson:"created_at"`
	UpdatedAt    time.Time            `json:"updated_at" bson:"updated_at"`
}

type MonsterList

type MonsterList struct {
	TotalCount int        `json:"total_count"`
	TotalPages int        `json:"total_pages"`
	Page       int        `json:"page"`
	Size       int        `json:"size"`
	HasMore    bool       `json:"has_more"`
	Monsters   []*Monster `json:"monsters"`
}

type MonsterType

type MonsterType struct {
	ID        primitive.ObjectID `json:"_id" bson:"_id,omitempty"`
	Name      string             `json:"name" bson:"name" validate:"required,lte=4"`
	CreatedAt time.Time          `json:"created_at" bson:"created_at"`
	UpdatedAt time.Time          `json:"updated_at" bson:"updated_at"`
}

type MonsterTypeBody

type MonsterTypeBody struct {
	MonsterTypeID primitive.ObjectID `json:"monster_type_id"`
}

type MonsterTypeList

type MonsterTypeList struct {
	TotalCount   int            `json:"total_count"`
	TotalPages   int            `json:"total_pages"`
	Page         int            `json:"page"`
	Size         int            `json:"size"`
	HasMore      bool           `json:"has_more"`
	MonsterTypes []*MonsterType `json:"monster_types"`
}

type MonsterTypeUpdate

type MonsterTypeUpdate struct {
	ID   primitive.ObjectID `json:"_id,omitempty"`
	Name string             `json:"name"`
}

type MonsterUpdate

type MonsterUpdate struct {
	ID          primitive.ObjectID `json:"_id,omitempty"`
	Name        string             `json:"name"`
	Description string             `json:"description"`
	Size        float32            `json:"size"`
	Weight      float32            `json:"weight"`
	Hp          int32              `json:"hp"`
	Attack      int32              `json:"attack"`
	Defense     int32              `json:"defense"`
	Speed       int32              `json:"speed"`
}

type User

type User struct {
	ID        primitive.ObjectID   `json:"_id" bson:"_id,omitempty"`
	Monsters  []primitive.ObjectID `json:"monsters" bson:"monsters"`
	Username  string               `json:"username" bson:"username" validate:"required"`
	Password  string               `json:"password,omitempty" bson:"password" validate:"required,gte=6"`
	Role      *string              `json:"role" bson:"role" validate:"required"`
	CreatedAt time.Time            `json:"created_at" bson:"created_at"`
	UpdatedAt time.Time            `json:"updated_at" bson:"updated_at"`
}

func (*User) ComparePasswords

func (u *User) ComparePasswords(password string) error

func (*User) HashPassword

func (u *User) HashPassword() error

func (*User) PrepareCreate

func (u *User) PrepareCreate() error

func (*User) SanitizePassword

func (u *User) SanitizePassword()

type UserList

type UserList struct {
	TotalCount int     `json:"total_count"`
	TotalPages int     `json:"total_pages"`
	Page       int     `json:"page"`
	Size       int     `json:"size"`
	HasMore    bool    `json:"has_more"`
	Users      []*User `json:"users"`
}

type UserLogin

type UserLogin struct {
	Username string `json:"username" validate:"required"`
	Password string `json:"password" validate:"required,gte=6"`
}

type UserMonsterBody

type UserMonsterBody struct {
	MonsterID primitive.ObjectID `json:"monster_id"`
}

type UserUpdate

type UserUpdate struct {
	ID       primitive.ObjectID `json:"_id,omitempty"`
	Username string             `json:"username"`
	Role     *string            `json:"role"`
}

func (*UserUpdate) PrepareUpdate

func (u *UserUpdate) PrepareUpdate() error

type UserWithToken

type UserWithToken struct {
	User  *User  `json:"user"`
	Token string `json:"token"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL