controllers

package
v0.0.0-...-3807899 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateHouse

func CreateHouse(c *gin.Context)

@Summary Create House @Description Create new house with relevant data @Tags houses @Accept json @Produce json @Param id path int true "House ID" Format(int64) @Success 200 {string} string "Successfully added new house." @Failure 404 {string} string "Internal server error." @Router /api/houses/{id} [post]

func GetAllDevices

func GetAllDevices(c *gin.Context)

@Summary Get all Devices @Description Fetches a list of all devices from the database. @Tags devices @Accept json @Produce json @Success 200 {array} models.Device @Router /api/devices [get]

func GetAllRooms

func GetAllRooms(c *gin.Context)

@Summary Get all Rooms @Description Fetches a list of all rooms from the database. @Tags rooms @Accept json @Produce json @Success 200 {array} models.Room @Router /api/rooms [get]

func GetAllRoomsByID

func GetAllRoomsByID(c *gin.Context)

@Summary Get a Room by ID @Description Retrieve a room's information by its unique ID. @Tags rooms @Accept json @Produce json @Param id path int true "Room ID" Format(int64) @Success 200 {object} models.Room @Failure 404 {string} string "Room with that ID doesn't exist." @Router /api/rooms/{id} [get]

func GetAllUsers

func GetAllUsers(c *gin.Context)

@Summary Get all users from the database @Description Fetch all users from the database (administrator permission needed) @Tags users @Accept json @Produce json @Success 200 {array} models.User @Router /api/users [get]

func GetDeviceById

func GetDeviceById(c *gin.Context)

@Summary Get a Device by ID @Description Retrieve a device's information by its unique ID. @Tags devices @Accept json @Produce json @Param id path int true "Device ID" Format(int64) @Success 200 {object} models.Device @Failure 404 {string} string "Device with that ID doesn't exist." @Router /api/devices/{id} [get]

func GetHouseById

func GetHouseById(c *gin.Context)

@Summary Get House by ID @Description Retrieve a house's information by its unique ID @Tags houses @Accept json @Produce json @Param id path int true "House ID" Format(int64) @Success 200 {object} models.House @Failure 404 {string} string "House with that ID doesn't exist." @Router /api/houses/{id} [get]

func GetNumberOfActiveDevices

func GetNumberOfActiveDevices(c *gin.Context)

@Summary Get Number of Active Devices @Description Retrieves the total number of active devices. @Tags analytics @Accept json @Produce json @Success 200 {integer} int64 @Router /api/analytics/activedevices [get]

func GetNumberOfAllDevices

func GetNumberOfAllDevices(c *gin.Context)

@Summary Get Number of All Devices @Description Retrieves the total number of devices in the database. @Tags analytics @Accept json @Produce json @Success 200 {integer} int64 @Router /api/analytics/devices [get]

func GetNumberOfAllHouses

func GetNumberOfAllHouses(c *gin.Context)

@Summary Get Number of All Houses @Description Retrieves the total number of houses. @Tags analytics @Accept json @Produce json @Success 200 {integer} int64 @Router /api/analytics/houses [get]

func GetNumberOfAllRooms

func GetNumberOfAllRooms(c *gin.Context)

@Summary Get Number of All Rooms @Description Retrieves the total number of rooms in the database. @Tags analytics @Accept json @Produce json @Success 200 {integer} int64 @Router /api/analytics/rooms [get]

func GetUserByID

func GetUserByID(c *gin.Context)

@Summary Get a User by ID @Description Retrieve a user's information by their unique ID. @Tags users @Accept json @Produce json @Param id path int true "User ID" Format(int64) @Success 200 {object} models.User @Failure 404 {string} string "User with that ID doesn't exist" @Router /api/users/{id} [get]

func Login

func Login(c *gin.Context)

@Summary User Login @Description Authenticates a user based on provided email and password. @Tags users @Accept json @Produce json @Param email body string true "User's email address" Format(email) @Param password body string true "User's password" @Success 200 {object} models.User @Failure 400 {string} string "Bad Request" @Failure 401 {string} string "Invalid Password" @Failure 404 {string} string "User with that credentials doesn't exist." @Router /api/users/login [post]

func Register

func Register(c *gin.Context)

@Summary User Registration @Description Creates a new user account with the provided information. @Tags users @Accept json @Produce json @Param name body string true "User's first name" @Param surname body string true "User's last name" @Param email body string true "User's email address" Format(email) @Param password body string true "User's password" @Param city body string true "User's city" @Success 200 {string} string "Account successfully registered." @Failure 400 {string} string "Invalid request data" @Failure 400 {string} string "All fields are required" @Failure 409 {string} string "User already exists." @Failure 500 {string} string "Internal server error." @Router /api/users/register [post]

Types

This section is empty.

Jump to

Keyboard shortcuts

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