handlers

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Page denotes the starting Page for pagination results
	Page = 0
)

Functions

This section is empty.

Types

type App

type App struct {
	Router *mux.Router
	DB     databases.CollectionHelper
	Config config.Config
	// contains filtered or unexported fields
}

App stores the router and db connection, so it can be reused

func (*App) Initialize

func (a *App) Initialize() error

Initialize is invoked by main to connect with the database and create a router

func (*App) New

func (a *App) New() *mux.Router

New creates a new mux router and all the routes

type Call

type Call struct {
	DB databases.CallDatabase
}

Call exported for testing purposes

func (Call) CallByIDHandler

func (c Call) CallByIDHandler(w http.ResponseWriter, r *http.Request)

CallByIDHandler returns a call by ID

func (Call) CallHandler

func (c Call) CallHandler(w http.ResponseWriter, r *http.Request)

CallHandler returns all calls

func (Call) CallsByCommunityIDHandler

func (c Call) CallsByCommunityIDHandler(w http.ResponseWriter, r *http.Request)

CallsByCommunityIDHandler returns all calls that contain the given communityID

type Civilian

type Civilian struct {
	DB databases.CivilianDatabase
}

Civilian exported for testing purposes

func (Civilian) CivilianByIDHandler

func (c Civilian) CivilianByIDHandler(w http.ResponseWriter, r *http.Request)

CivilianByIDHandler returns a civilian by ID

func (Civilian) CivilianHandler

func (c Civilian) CivilianHandler(w http.ResponseWriter, r *http.Request)

CivilianHandler returns all civilians

func (Civilian) CiviliansByNameSearchHandler added in v1.8.0

func (c Civilian) CiviliansByNameSearchHandler(w http.ResponseWriter, r *http.Request)

CiviliansByNameSearchHandler returns paginated list of civilians that match the give name

func (Civilian) CiviliansByUserIDHandler

func (c Civilian) CiviliansByUserIDHandler(w http.ResponseWriter, r *http.Request)

CiviliansByUserIDHandler returns all civilians that contain the given userID

type Community

type Community struct {
	DB databases.CommunityDatabase
}

Community struct mostly used for mocking tests

func (Community) CommunitiesByOwnerIDHandler

func (c Community) CommunitiesByOwnerIDHandler(w http.ResponseWriter, r *http.Request)

CommunitiesByOwnerIDHandler returns all communities that contain the specified ownerID

func (Community) CommunityByCommunityAndOwnerIDHandler

func (c Community) CommunityByCommunityAndOwnerIDHandler(w http.ResponseWriter, r *http.Request)

CommunityByCommunityAndOwnerIDHandler returns a community that contains the specified ownerID

func (Community) CommunityHandler

func (c Community) CommunityHandler(w http.ResponseWriter, r *http.Request)

CommunityHandler returns a community given a communityID

type Ems

type Ems struct {
	DB databases.EmsDatabase
}

Ems exported for testing purposes

func (Ems) EmsByIDHandler

func (e Ems) EmsByIDHandler(w http.ResponseWriter, r *http.Request)

EmsByIDHandler returns a ems by ID

func (Ems) EmsByUserIDHandler

func (e Ems) EmsByUserIDHandler(w http.ResponseWriter, r *http.Request)

EmsByUserIDHandler returns all ems that contain the given userID

func (Ems) EmsHandler

func (e Ems) EmsHandler(w http.ResponseWriter, r *http.Request)

EmsHandler returns all ems

type EmsVehicle

type EmsVehicle struct {
	DB databases.EmsVehicleDatabase
}

EmsVehicle exported for testing purposes

func (EmsVehicle) EmsVehicleByIDHandler

func (v EmsVehicle) EmsVehicleByIDHandler(w http.ResponseWriter, r *http.Request)

EmsVehicleByIDHandler returns a emsVehicle by ID

func (EmsVehicle) EmsVehicleHandler

func (v EmsVehicle) EmsVehicleHandler(w http.ResponseWriter, r *http.Request)

EmsVehicleHandler returns all emsVehicles

func (EmsVehicle) EmsVehiclesByUserIDHandler

func (v EmsVehicle) EmsVehiclesByUserIDHandler(w http.ResponseWriter, r *http.Request)

EmsVehiclesByUserIDHandler returns all emsVehicles that contain the given userID

type Firearm

type Firearm struct {
	DB databases.FirearmDatabase
}

Firearm exported for testing purposes

func (Firearm) FirearmByIDHandler

func (v Firearm) FirearmByIDHandler(w http.ResponseWriter, r *http.Request)

FirearmByIDHandler returns a firearm by ID

func (Firearm) FirearmHandler

func (v Firearm) FirearmHandler(w http.ResponseWriter, r *http.Request)

FirearmHandler returns all firearms

func (Firearm) FirearmsByRegisteredOwnerIDHandler added in v1.8.0

func (v Firearm) FirearmsByRegisteredOwnerIDHandler(w http.ResponseWriter, r *http.Request)

FirearmsByRegisteredOwnerIDHandler returns all firearms that contain the given registeredOwnerID

func (Firearm) FirearmsByUserIDHandler

func (v Firearm) FirearmsByUserIDHandler(w http.ResponseWriter, r *http.Request)

FirearmsByUserIDHandler returns all firearms that contain the given userID

type FirearmList added in v1.8.0

type FirearmList struct {
	Items      []*models.Firearm `json:"items"`
	NextPageID int               `json:"next_page_id,omitempty" example:"10"`
}

FirearmList paginated response with a list of items and next page id

type License added in v1.8.0

type License struct {
	DB databases.LicenseDatabase
}

License exported for testing purposes

func (License) LicenseByIDHandler added in v1.8.0

func (v License) LicenseByIDHandler(w http.ResponseWriter, r *http.Request)

LicenseByIDHandler returns a license by ID

func (License) LicenseHandler added in v1.8.0

func (v License) LicenseHandler(w http.ResponseWriter, r *http.Request)

LicenseHandler returns all licenses

func (License) LicensesByOwnerIDHandler added in v1.8.0

func (v License) LicensesByOwnerIDHandler(w http.ResponseWriter, r *http.Request)

LicensesByOwnerIDHandler returns all licenses that contain the given OwnerID

func (License) LicensesByUserIDHandler added in v1.8.0

func (v License) LicensesByUserIDHandler(w http.ResponseWriter, r *http.Request)

LicensesByUserIDHandler returns all licenses that contain the given userID

type LicenseList added in v1.8.0

type LicenseList struct {
	Items      []*models.License `json:"items"`
	NextPageID int               `json:"next_page_id,omitempty" example:"10"`
}

LicenseList paginated response with a list of items and next page id

type User

type User struct {
	DB databases.UserDatabase
}

func (User) UserHandler

func (u User) UserHandler(w http.ResponseWriter, r *http.Request)

UserHandler returns a user given a userID

func (User) UsersFindAllHandler

func (u User) UsersFindAllHandler(w http.ResponseWriter, r *http.Request)

UsersFindAllHandler runs a mongo find{} query to find all

type Vehicle

type Vehicle struct {
	DB databases.VehicleDatabase
}

Vehicle exported for testing purposes

func (Vehicle) VehicleByIDHandler

func (v Vehicle) VehicleByIDHandler(w http.ResponseWriter, r *http.Request)

VehicleByIDHandler returns a vehicle by ID

func (Vehicle) VehicleHandler

func (v Vehicle) VehicleHandler(w http.ResponseWriter, r *http.Request)

VehicleHandler returns all vehicles

func (Vehicle) VehiclesByPlateSearchHandler added in v1.8.0

func (v Vehicle) VehiclesByPlateSearchHandler(w http.ResponseWriter, r *http.Request)

VehiclesByPlateSearchHandler returns paginated list of vehicles that match the give plate

func (Vehicle) VehiclesByRegisteredOwnerIDHandler added in v1.8.0

func (v Vehicle) VehiclesByRegisteredOwnerIDHandler(w http.ResponseWriter, r *http.Request)

VehiclesByRegisteredOwnerIDHandler returns all vehicles that contain the given registeredOwnerID

func (Vehicle) VehiclesByUserIDHandler

func (v Vehicle) VehiclesByUserIDHandler(w http.ResponseWriter, r *http.Request)

VehiclesByUserIDHandler returns all vehicles that contain the given userID

type Warrant added in v1.8.0

type Warrant struct {
	DB databases.WarrantDatabase
}

Warrant exported for testing purposes

func (Warrant) WarrantByIDHandler added in v1.8.0

func (v Warrant) WarrantByIDHandler(w http.ResponseWriter, r *http.Request)

WarrantByIDHandler returns a warrant by ID

func (Warrant) WarrantHandler added in v1.8.0

func (v Warrant) WarrantHandler(w http.ResponseWriter, r *http.Request)

WarrantHandler returns all warrants

func (Warrant) WarrantsByUserIDHandler added in v1.8.0

func (v Warrant) WarrantsByUserIDHandler(w http.ResponseWriter, r *http.Request)

WarrantsByUserIDHandler returns all warrants that contain the given userID

type WarrantList added in v1.8.0

type WarrantList struct {
	Items      []*models.Warrant `json:"items"`
	NextPageID int               `json:"next_page_id,omitempty" example:"10"`
}

WarrantList paginated response with a list of items and next page id

Jump to

Keyboard shortcuts

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