controllers

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

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

Go to latest
Published: Jan 9, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GironService

type GironService struct {
	AppPath    string
	ConfigPath string
	ConfStruct globals.Config
}

func (*GironService) AdminUI

func (g *GironService) AdminUI(c *gin.Context)

func (*GironService) ChangeAccountPassword

func (g *GironService) ChangeAccountPassword(c *gin.Context)

ChangeAccountPassowrd Change an account's password

@Summary		Change password
@Description	Change password
@Tags			user
@Accept			json
@Produce		json
@Param			name	path	string	true	"User name"
@Param			changePassword	body	model.PasswordChange	true	"Password data"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400	{object}	model.FailureMsg
@Router			/user/{name} [patch]

func (*GironService) CreateBuilding

func (g *GironService) CreateBuilding(c *gin.Context)

CreateBuilding Add a building

@Summary		Create a new building
@Description	Create a new building
@Tags			buildings
@Accept			json
@Produce		json
@Param			building	body	model.ProposedBuilding	true	"Building data"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400	{object}	model.FailureMsg
@Router			/building [post]

func (*GironService) CreateFloor

func (g *GironService) CreateFloor(c *gin.Context)

CreateFloor Add a floor to a building

@Summary		Create a new floor
@Description	Create a new floor
@Tags			floors
@Accept			json
@Produce		json
@Param			floor	body	model.ProposedFloor	true	"Floor data"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400	{object}	model.FailureMsg
@Router			/floor [post]

func (*GironService) CreateLocation

func (g *GironService) CreateLocation(c *gin.Context)

CreateLocation Add a location to a building

@Summary		Create a new location
@Description	Create a new location
@Tags			locations
@Accept			json
@Produce		json
@Param			location	body	model.ProposedLocation	true	"Location data"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400	{object}	model.FailureMsg
@Router			/location [post]

func (*GironService) CreatePanel

func (g *GironService) CreatePanel(c *gin.Context)

CreatePanel Add a panel event

@Summary		Create a new panel event
@Description	Create a new panel event
@Tags			panels
@Accept			json
@Produce		json
@Param			panel	body	model.Panel	true	"Panel data"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400	{object}	model.FailureMsg
@Router			/panel [post]

func (*GironService) CreateUser

func (g *GironService) CreateUser(c *gin.Context)

CreateUser Register a user for authentication and authorization

@Summary		Register user
@Description	Add a new user
@Tags			user
@Accept			json
@Produce		json
@Param			user	body	model.ProposedUser	true	"User Data"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400	{object}	model.FailureMsg
@Router			/user [post]

func (*GironService) DeleteBuildingById

func (g *GironService) DeleteBuildingById(c *gin.Context)

DeleteBuildingById Delete a building by its Id

@Summary		Delete a building by Id
@Description	Delete a building by Id
@Tags			buildings
@Accept			json
@Produce		json
@Param			id	path	string	true	"Building Id"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400	{object}	model.FailureMsg
@Router			/building/{id} [delete]

func (*GironService) DeleteFloorById

func (g *GironService) DeleteFloorById(c *gin.Context)

DeleteFloorById Delete a floor by its Id

@Summary		Delete a floor by Id
@Description	Delete a floor by Id
@Tags			floors
@Accept			json
@Produce		json
@Param			id	path	string	true	"Floor Id"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400	{object}	model.FailureMsg
@Router			/floor/{id} [delete]

func (*GironService) DeleteLocationById

func (g *GironService) DeleteLocationById(c *gin.Context)

DeleteLocationById Delete a location by its Id

@Summary		Delete a location by Id
@Description	Delete a location by Id
@Tags			locations
@Accept			json
@Produce		json
@Param			id	path	string	true	"Location Id"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400	{object}	model.FailureMsg
@Router			/location/{id} [delete]

func (*GironService) DeletePanelById

func (g *GironService) DeletePanelById(c *gin.Context)

DeletePanelById Delete a panel by its Id

@Summary		Delete a panel by Id
@Description	Delete a panel by Id
@Tags			panels
@Accept			json
@Produce		json
@Param			id	path	string	true	"Panel Id"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400	{object}	model.FailureMsg
@Router			/panel/{id} [delete]

func (*GironService) DeleteUser

func (g *GironService) DeleteUser(c *gin.Context)

DeleteUser Remove a user for authentication and authorization

@Summary		Delete user
@Description	Delete a user
@Tags			user
@Accept			json
@Produce		json
@Param			name	path	string	true	"User name"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400	{object}	model.FailureMsg
@Router			/user/{name} [delete]

func (*GironService) GetAllFloors

func (g *GironService) GetAllFloors(c *gin.Context)

GetAllFloors Retrieve list of all floor records

@Summary		Retrieve list of all floor records
@Description	Retrieve list of all floor records
@Tags			floors
@Produce		json
@Success		200	{object}	model.FloorList
@Failure		400	{object}	model.FailureMsg
@Router			/floors [get]

func (*GironService) GetAllLocations

func (g *GironService) GetAllLocations(c *gin.Context)

GetAllLocations Retrieve list of all location objects

@Summary		Retrieve list of all location objects
@Description	Retrieve list of all location objects
@Tags			locations
@Produce		json
@Success		200	{object}	model.LocationList
@Failure		400	{object}	model.FailureMsg
@Router			/locations [get]

func (*GironService) GetApprovedPanels

func (g *GironService) GetApprovedPanels(c *gin.Context)

GetApprovedPanels Retrieve list of all approved panels

@Summary		Retrieve list of all approved panels
@Description	Retrieve list of all approved panels
@Tags			panels
@Produce		json
@Success		200	{object}	model.PanelList
@Failure		400	{object}	model.FailureMsg
@Router			/panels [get]

func (*GironService) GetBuildingById

func (g *GironService) GetBuildingById(c *gin.Context)

GetBuildingById Retrieve building by Id

@Summary		Retrieve building by Id
@Description	Retrieve building by Id
@Tags			buildings
@Produce		json
@Param			id	path	string	true	"Building Id"
@Success		200	{object}	model.Building
@Failure		400	{object}	model.FailureMsg
@Router			/building/{id} [get]

func (*GironService) GetBuildings

func (g *GironService) GetBuildings(c *gin.Context)

GetBuildings Retrieve list of all buildings

@Summary		Retrieve list of all panels
@Description	Retrieve list of all panels
@Tags			buildings
@Produce		json
@Success		200	{object}	model.BuildingList
@Failure		400	{object}	model.FailureMsg
@Router			/buildings [get]

func (*GironService) GetFloorById

func (g *GironService) GetFloorById(c *gin.Context)

GetFloorById Retrieve a floor based on Id

@Summary		Retrieve floor based on Id
@Description	Retrieve floor based on Id
@Tags			floors
@Produce		json
@Param			id	path	string	true	"Floor Id"
@Success		200	{object}	model.BuildingFloor
@Failure		400	{object}	model.FailureMsg
@Router			/floor/{id} [get]

func (*GironService) GetFloorsByBuildingId

func (g *GironService) GetFloorsByBuildingId(c *gin.Context)

GetFloorsByBuildingId Retrieve list of all floors based on building Id

@Summary		Retrieve list of all floors based on building Id
@Description	Retrieve list of all floors based on building Id
@Tags			floors
@Produce		json
@Param			id	path	string	true	"Building Id"
@Success		200	{object}	model.FloorList
@Failure		400	{object}	model.FailureMsg
@Router			/floors/buildingId/{id} [get]

func (*GironService) GetHealth

func (g *GironService) GetHealth(c *gin.Context)

GetHealth Retrieve the health of the service

@Summary		Retrieve overall health of the service
@Description	Retrieve overall health of the service
@Tags			serviceHealth
@Produce		json
@Success		200	{object}	model.HealthCheck
@Failure		500	{object}	model.HealthCheck
@Router			/health [get]

func (*GironService) GetLocationById

func (g *GironService) GetLocationById(c *gin.Context)

GetLocationById Retrieve location by Id

@Summary		Retrieve location by Id
@Description	Retrieve location by Id
@Tags			locations
@Produce		json
@Param			id	path	string	true	"Location Id"
@Success		200	{object}	model.Location
@Failure		400	{object}	model.FailureMsg
@Router			/location/{id} [get]

func (*GironService) GetLocationsByBuildingId

func (g *GironService) GetLocationsByBuildingId(c *gin.Context)

GetLocationsByBuildingId Retrieve list of locations by building Id

@Summary		Retrieve list of locations by building Id
@Description	Retrieve list of locations by building Id
@Tags			locations
@Produce		json
@Param			id	path	string	true	"Building Id"
@Success		200	{object}	model.LocationList
@Failure		400	{object}	model.FailureMsg
@Router			/location/byBuildingId/{id} [get]

func (*GironService) GetLocationsByFloorId

func (g *GironService) GetLocationsByFloorId(c *gin.Context)

GetLocationsByFloorId Retrieve list of locations by floor Id

@Summary		Retrieve list of locations by floor Id
@Description	Retrieve list of locations by floor Id
@Tags			locations
@Produce		json
@Param			id	path	string	true	"Floor Id"
@Success		200	{object}	model.LocationList
@Failure		400	{object}	model.FailureMsg
@Router			/location/byFloorId/{id} [get]

func (*GironService) GetPanelById

func (g *GironService) GetPanelById(c *gin.Context)

GetPanelById Retrieve panel by Id

@Summary		Retrieve panel by Id
@Description	Retrieve panel by Id
@Tags			panels
@Produce		json
@Param			id	path	string	true	"Panel Id"
@Success		200	{object}	model.Panel
@Failure		400	{object}	model.FailureMsg
@Router			/panel/{id} [get]

func (*GironService) GetPanelLocationByPanelId

func (g *GironService) GetPanelLocationByPanelId(c *gin.Context)

GetPanelLocationById Retrieve panel location by the panel Id

@Summary		Retrieve panel location by the panel Id
@Description	Retrieve panel location by the panel Id
@Tags			panels
@Produce		json
@Param			id	path	string	true	"Panel Id"
@Success		200	{object}	model.Location
@Failure		400	{object}	model.FailureMsg
@Router			/panel/{id}/location [get]

func (*GironService) GetPanelScheduleByPanelId

func (g *GironService) GetPanelScheduleByPanelId(c *gin.Context)

GetPanelScheduleById Retrieve panel schedule by the panel Id

@Summary		Retrieve panel schedule by the panel Id
@Description	Retrieve panel schedule by the panel Id
@Tags			panels
@Produce		json
@Param			id	path	string	true	"Panel Id"
@Success		200	{object}	model.Schedule
@Failure		400	{object}	model.FailureMsg
@Router			/panel/{id}/schedule [get]

func (*GironService) GetPanels

func (g *GironService) GetPanels(c *gin.Context)

GetPanels Retrieve list of all panels

@Summary		Retrieve list of all panels
@Description	Retrieve list of all panels
@Tags			panels
@Produce		json
@Security		BasicAuth
@Success		200	{object}	model.PanelList
@Failure		400	{object}	model.FailureMsg
@Router			/panels/all [get]

func (*GironService) GetPanelsByLocationId

func (g *GironService) GetPanelsByLocationId(c *gin.Context)

GetPanelsByLocationId Retrieve list of all approved panels by location Id

@Summary		Retrieve list of all approved panels by location Id
@Description	Retrieve list of all approved panels by location Id
@Tags			panels
@Produce		json
@Success		200	{object}	model.PanelList
@Failure		400	{object}	model.FailureMsg
@Router			/panels/ByLocationId/{id} [get]

func (*GironService) GetUserById

func (g *GironService) GetUserById(c *gin.Context)

GetUserById Retrieve a user by their Id

@Summary		Retrieve a user by their Id
@Description	Retrieve a user by their Id
@Tags			user
@Produce		json
@Param			id	path int true "User ID"
@Success		200	{object}	SafeUser
@Failure		400	{object}	model.FailureMsg
@Router			/user/id/{id} [get]

func (*GironService) GetUserByUserName

func (g *GironService) GetUserByUserName(c *gin.Context)

GetUserByName Retrieve a user by their UserName

@Summary		Retrieve a user by their UserName
@Description	Retrieve a user by their UserName
@Tags			user
@Produce		json
@Param			name	path	string	true	"User name"
@Success		200	{object}	SafeUser
@Failure		400	{object}	model.FailureMsg
@Router			/user/name/{name} [get]

func (*GironService) GetUserId

func (g *GironService) GetUserId(c *gin.Context) (model.User, bool)

func (*GironService) GetUserStatus

func (g *GironService) GetUserStatus(c *gin.Context)

GetUserStatus Retrieve the active status of a user. Can be either 'enabled' or 'locked'

@Summary		Retrieve a user's active status. Can be either 'enabled' or 'locked'
@Description	Retrieve a user's active status
@Tags			user
@Accept			json
@Produce		json
@Param			name	path	string	true	"User name"
@Security		BasicAuth
@Success		200	{object}	model.UserStatusMsg
@Failure		400	{object}	model.FailureMsg
@Router			/user/{name}/status [get]

func (*GironService) GetUsers

func (g *GironService) GetUsers(c *gin.Context)

GetUsers Retrieve list of all users

@Summary		Retrieve list of all users
@Description	Retrieve list of all users
@Tags			user
@Produce		json
@Success		200	{object}	model.UsersList
@Failure		400	{object}	model.FailureMsg
@Router			/users [get]

func (*GironService) LoginUI

func (g *GironService) LoginUI(c *gin.Context)

func (*GironService) LoginUIPost

func (g *GironService) LoginUIPost(c *gin.Context)

func (*GironService) SetApprovalStatusPanelById

func (g *GironService) SetApprovalStatusPanelById(c *gin.Context)

SetApprovalStatusPanelById Set the approval status of a panel

@Summary		Set panel location
@Description	Set panel location
@Tags			panels
@Produce		json
@Param			id	path	string	true	"Panel Id"
@Param			json body	model.PanelApproval true	"Approval data"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400	{object}	model.FailureMsg
@Router			/panel/{id}/approve [post]

func (*GironService) SetPanelAgeRestrictionById

func (g *GironService) SetPanelAgeRestrictionById(c *gin.Context)

SetPanelAgeRestrictionById Set the age restriction status of a panel

 @Summary		Set panel age restriction
	@Description	Set panel age restriction
	@Tags			panels
	@Produce		json
	@Param			id	path	string	true	"Panel Id"
	@Param			json body	model.PanelAgeRestrictionState true	"Age restriction state"
	@Security		BasicAuth
	@Success		200	{object}	model.SuccessMsg
	@Failure		400	{object}	model.FailureMsg
	@Router			/panel/{id}/restricted [post]

func (*GironService) SetPanelLocation

func (g *GironService) SetPanelLocation(c *gin.Context)

SetPanelLocation Set panel location

@Summary		Set panel location
@Description	Set panel location
@Tags			panels
@Produce		json
@Param			id	path	string	true	"Building Id"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400	{object}	model.FailureMsg
@Router			/panel/{id}/location [post]

func (*GironService) SetPanelScheduledTimeById

func (g *GironService) SetPanelScheduledTimeById(c *gin.Context)

SetPanelScheduledTimeById Set the panel's scheduled time

@Summary		Set the scheduled time for a panel
@Description	Set the scheduled time for a panel
@Tags			panels
@Produce		json
@Param			id	path	string	true	"Panel Id"
@Param			json	body	model.PanelScheduledTime	true	"Scheduled Time"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400 {object}	model.FailureMsg
@Router			/panel/{id}/schedule [post]

func (*GironService) SetUserStatus

func (g *GironService) SetUserStatus(c *gin.Context)

SetUserStatus Set the active status of a user. Can be either 'enabled' or 'locked'

@Summary		Set a user's active status. Can be either 'enabled' or 'locked'
@Description	Set a user's active status
@Tags			user
@Accept			json
@Produce		json
@Param			user	body	model.User.UserName	true	"User Data"
@Param			name	path	string	true "User name"
@Security		BasicAuth
@Success		200	{object}	model.UserStatusMsg
@Failure		400	{object}	model.FailureMsg
@Router			/user/{name}/status [patch]

func (*GironService) UpdateBuildingById

func (g *GironService) UpdateBuildingById(c *gin.Context)

UpdateBuildingById Update building by Id

@Summary		Update building information
@Description	Update building information
@Tags			buildings
@Produce		json
@Param			id	path	string	true	"Building Id"
@Param			building	body	model.BuildingUpdate	true	"Building data"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400	{object}	model.FailureMsg
@Router			/building/{id} [patch]

func (*GironService) UpdateFloorById

func (g *GironService) UpdateFloorById(c *gin.Context)

UpdateFloorById Update floor by Id

@Summary		Update floor information
@Description	Update floor information
@Tags			floors
@Produce		json
@Param			id	path	string	true	"Floor Id"
@Param			floor	body	model.FloorUpdate	true	"Floor data"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400	{object}	model.FailureMsg
@Router			/floor/{id} [patch]

func (*GironService) UpdateLocationById

func (g *GironService) UpdateLocationById(c *gin.Context)

UpdateLocationById Update location by Id

@Summary		Update location information
@Description	Update location information
@Tags			locations
@Produce		json
@Param			id	path	string	true	"Location Id"
@Param			floor	body	model.LocationUpdate	true	"Location data"
@Security		BasicAuth
@Success		200	{object}	model.SuccessMsg
@Failure		400	{object}	model.FailureMsg
@Router			/location/{id} [patch]

type SafeUser

type SafeUser struct {
	Id           int    `json:"Id"`
	UserName     string `json:"userName"`
	CreationDate string `json:"creationDate"`
}

Jump to

Keyboard shortcuts

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