Documentation ¶
Index ¶
- func ErrorMiddleware(logger *zap.Logger) fiber.Handler
- func RespondWithError(ctx *fiber.Ctx, err error) error
- type AddTargetNotesRequest
- type AddTargetRequest
- type AddTargetsRequest
- type BaseResponse
- type Cat
- type CreateCatRequest
- type CreateCatResponse
- type CreateMissionRequest
- type CreateMissionResponse
- type Error
- type GetCatResponse
- type GetCatsResponse
- type GetMissionResponse
- type GetMissionTargetsResponse
- type GetMissionsRequest
- type GetMissionsResponse
- type GetTargetResponse
- type Handler
- func (h Handler) AddMissionTargets(ctx *fiber.Ctx) error
- func (h Handler) AddTargetNote(ctx *fiber.Ctx) error
- func (h Handler) CompleteMissionByID(ctx *fiber.Ctx) error
- func (h Handler) CompleteTargetByID(ctx *fiber.Ctx) error
- func (h Handler) CreateCat(ctx *fiber.Ctx) error
- func (h Handler) CreateMission(ctx *fiber.Ctx) error
- func (h Handler) DeleteCatByID(ctx *fiber.Ctx) error
- func (h Handler) DeleteMissionByID(ctx *fiber.Ctx) error
- func (h Handler) DeleteTargetByID(ctx *fiber.Ctx) error
- func (h Handler) GetCatByID(ctx *fiber.Ctx) error
- func (h Handler) GetCats(ctx *fiber.Ctx) error
- func (h Handler) GetMissionByID(ctx *fiber.Ctx) error
- func (h Handler) GetMissionTargets(ctx *fiber.Ctx) error
- func (h Handler) GetMissions(ctx *fiber.Ctx) error
- func (h Handler) GetTargetByID(ctx *fiber.Ctx) error
- func (h Handler) UpdateCatByID(ctx *fiber.Ctx) error
- func (h Handler) UpdateMissionByID(ctx *fiber.Ctx) error
- type Mission
- type MissionFull
- type Note
- type Server
- type Service
- type Target
- type TargetFull
- type UpdateCatRequest
- type UpdateMissionRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorMiddleware ¶
func RespondWithError ¶
Types ¶
type AddTargetNotesRequest ¶
type AddTargetNotesRequest struct {
Notes []string `json:"notes"`
}
func (AddTargetNotesRequest) Validate ¶
func (r AddTargetNotesRequest) Validate() error
type AddTargetRequest ¶
func (AddTargetRequest) Validate ¶
func (r AddTargetRequest) Validate() error
type AddTargetsRequest ¶
type AddTargetsRequest struct {
Targets []AddTargetRequest `json:"targets"`
}
func (AddTargetsRequest) Params ¶
func (r AddTargetsRequest) Params() []dto.CreateTargetParams
func (AddTargetsRequest) Validate ¶
func (r AddTargetsRequest) Validate() error
type BaseResponse ¶
type BaseResponse struct {
Ok bool `json:"ok"`
}
type Cat ¶
type Cat struct { ID int `json:"id"` Name string `json:"name"` ExperienceYears int16 `json:"experience_years"` Breed string `json:"breed"` Salary int `json:"salary"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func CatFromModel ¶
type CreateCatRequest ¶
type CreateCatRequest struct { Name string `json:"name"` Breed string `json:"breed"` Experience int `json:"experience"` Salary int `json:"salary"` }
func (CreateCatRequest) Validate ¶
func (r CreateCatRequest) Validate() error
type CreateCatResponse ¶
type CreateCatResponse struct { BaseResponse ID int `json:"id"` }
type CreateMissionRequest ¶
type CreateMissionRequest struct {
Targets []AddTargetRequest `json:"targets"`
}
func (CreateMissionRequest) Params ¶
func (r CreateMissionRequest) Params() dto.CreateMissionParams
func (CreateMissionRequest) Validate ¶
func (r CreateMissionRequest) Validate() error
type CreateMissionResponse ¶
type CreateMissionResponse struct { BaseResponse ID int `json:"id"` }
type GetCatResponse ¶
type GetCatResponse struct { BaseResponse Cat Cat `json:"cat"` }
type GetCatsResponse ¶
type GetCatsResponse struct { BaseResponse Cats []Cat `json:"cats"` }
type GetMissionResponse ¶
type GetMissionResponse struct { BaseResponse Mission MissionFull `json:"mission"` }
type GetMissionTargetsResponse ¶
type GetMissionTargetsResponse struct { BaseResponse Targets []TargetFull `json:"targets"` }
type GetMissionsRequest ¶
type GetMissionsRequest struct {
CatID *int `query:"cat_id"`
}
type GetMissionsResponse ¶
type GetMissionsResponse struct { BaseResponse Missions []Mission `json:"missions"` }
type GetTargetResponse ¶
type GetTargetResponse struct { BaseResponse Target TargetFull `json:"target"` }
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func (Handler) AddMissionTargets ¶
func (Handler) AddTargetNote ¶
func (Handler) CompleteMissionByID ¶
func (Handler) CompleteTargetByID ¶
func (Handler) CreateMission ¶
func (Handler) DeleteCatByID ¶
func (Handler) DeleteMissionByID ¶
func (Handler) DeleteTargetByID ¶
func (Handler) GetCatByID ¶
func (Handler) GetMissionByID ¶
func (Handler) GetMissionTargets ¶
func (Handler) GetMissions ¶
func (Handler) GetTargetByID ¶
func (Handler) UpdateCatByID ¶
func (Handler) UpdateMissionByID ¶
type Mission ¶
type Mission struct { ID int `json:"id"` AssignedCatID *int `json:"assigned_cat_id"` IsCompleted bool `json:"is_completed"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
func MissionFromModel ¶
type MissionFull ¶
func MissionFullFromModel ¶
func MissionFullFromModel(missionFull *models.MissionFull) MissionFull
type Note ¶
type Note struct { ID int `json:"-"` TargetID int `json:"-"` Content string `json:"content"` CreatedAt time.Time `json:"created_at"` }
func NoteFromModel ¶
type Service ¶
type Service interface { AddCat(ctx context.Context, params dto.CreateCatParams) (catID int, err error) GetCats(ctx context.Context) ([]*models.Cat, error) GetCatByID(ctx context.Context, catID int) (*models.Cat, error) UpdateCatByID(ctx context.Context, params dto.UpdateCatParams) error DeleteCatByID(ctx context.Context, catID int) error GetMissions(ctx context.Context, params dto.GetMissionsParams) ([]*models.Mission, error) CreateMission(ctx context.Context, params dto.CreateMissionParams) (missionID int, err error) AddMissionTargets(ctx context.Context, missionID int, newTargets []dto.CreateTargetParams) (err error) GetMissionByID(ctx context.Context, missionID int) (out *models.MissionFull, err error) UpdateMissionByID(ctx context.Context, params dto.UpdateMissionParams) (err error) DeleteMissionByID(ctx context.Context, missionID int) (err error) GetTargetsByMissionID(ctx context.Context, missionID int) (out []*models.TargetFull, err error) GetTargetByID(ctx context.Context, missionID int, targetID int) (out *models.TargetFull, err error) CompleteTargetByID(ctx context.Context, missionID int, targetID int) (err error) DeleteTargetByID(ctx context.Context, missionID int, targetID int) (err error) AddTargetNote(ctx context.Context, missionID int, targetID int, contents []string) (err error) }
type Target ¶
type Target struct { ID int `json:"id"` MissionID int `json:"mission_id"` IsCompleted bool `json:"is_completed"` Name string `json:"name"` Country string `json:"country"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
Targets
func TargetFromModel ¶
type TargetFull ¶
func TargetFullFromModel ¶
func TargetFullFromModel(targetFull *models.TargetFull) TargetFull
type UpdateCatRequest ¶
type UpdateCatRequest struct { CatID int `json:"-"` Name *string `json:"name"` ExperienceYears *int `json:"experience"` Salary *int `json:"salary"` }
func (UpdateCatRequest) Validate ¶
func (r UpdateCatRequest) Validate() error
type UpdateMissionRequest ¶
type UpdateMissionRequest struct {
AssignedCatID *int `json:"assigned_cat_id"`
}
func (UpdateMissionRequest) Validate ¶
func (r UpdateMissionRequest) Validate() error
Click to show internal directories.
Click to hide internal directories.