missions

package
v0.0.0-...-8bfef16 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHandler

func CreateHandler(logger *slog.Logger, missionCreator MissionCreator) http.HandlerFunc

func DeleteHandler

func DeleteHandler(logger *slog.Logger, missionDeleter MissionDeleter) http.HandlerFunc

func GetAllHandler

func GetAllHandler(logger *slog.Logger, missionLister MissionLister) http.HandlerFunc

func GetOneHandler

func GetOneHandler(logger *slog.Logger, missionGetter MissionGetter) http.HandlerFunc

func UpdateHandler

func UpdateHandler(logger *slog.Logger, missionUpdater MissionUpdater) http.HandlerFunc

Types

type CreateRequest

type CreateRequest struct {
	CatID    *int64          `json:"cat_id,omitempty"`
	Targets  []common.Target `json:"targets" validate:"required,dive"`
	Complete bool            `json:"complete"`
}

type CreateResponse

type CreateResponse struct {
	ID int64 `json:"id,omitempty"`
}

type MissionCreator

type MissionCreator interface {
	CreateMission(catID sql.NullInt64, targets []common.Target, complete bool) (int64, error)
}

type MissionDeleter

type MissionDeleter interface {
	DeleteUnassignedMission(missionIDs []int64) error
	MissionExists(missionID int64) (bool, error)
}

type MissionGetter

type MissionGetter interface {
	GetMission(id int64) (*common.Mission, error)
}

type MissionLister

type MissionLister interface {
	GetAllMissions() ([]common.Mission, error)
}

type MissionResponse

type MissionResponse struct {
	ID       int64           `json:"id"`
	CatID    *int64          `json:"cat_id,omitempty"`
	Complete bool            `json:"complete"`
	Targets  []common.Target `json:"targets"`
}

type MissionUpdater

type MissionUpdater interface {
	UpdateMissionCompleteStatus(id int64, complete bool) error
	AssignCatToMission(missionID, catID int64) error
	MissionExists(id int64) (bool, error)
}

type UpdateMissionRequest

type UpdateMissionRequest struct {
	Complete *bool  `json:"complete,omitempty"`
	CatID    *int64 `json:"cat_id,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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