controllers

package
v0.0.0-...-fa930de Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BookController

type BookController struct{}

BookController is a struct that represents a controller for book-related operations

func (*BookController) CreateBook

func (ctrl *BookController) CreateBook(c *gin.Context)

CreateBook is a function that creates a new book record in the database

func (*BookController) DeleteBook

func (ctrl *BookController) DeleteBook(c *gin.Context)

DeleteBook is a function that deletes a book record from the database

func (*BookController) GetBookById

func (ctrl *BookController) GetBookById(c *gin.Context)

GetBookById is a function that retrieves a single book record from the database by ID

func (*BookController) GetBooksList

func (ctrl *BookController) GetBooksList(c *gin.Context)

GetBooksList is a function that retrieves a list of all book records from the database

func (*BookController) SearchBooks

func (ctrl *BookController) SearchBooks(c *gin.Context)

SearchBooks is a function that searches the database for books that match a given query

func (*BookController) UpdateBook

func (ctrl *BookController) UpdateBook(c *gin.Context)

UpdateBook is a function that updates a book record in the database

type FileController

type FileController struct{}

FileController is a struct that represents a controller for file-related operations“

func (*FileController) DeleteFile

func (f *FileController) DeleteFile(c *gin.Context)

DeleteFile is a function that deletes a file from the server and its metadata from the database

func (*FileController) GetFile

func (f *FileController) GetFile(c *gin.Context)

GetFile is a function that retrieves a file from the server

func (*FileController) UploadFile

func (f *FileController) UploadFile(c *gin.Context)

UploadFile is a function that handles the upload of a single file

func (*FileController) UploadFiles

func (f *FileController) UploadFiles(c *gin.Context)

UploadFiles is a function that handles the upload of multiple files

type LoginPayload

type LoginPayload struct {
	Email    string `json:"email" bingding:"required,email"`
	Password string `json:"password" binding:"required"`
}

LoginPayload login body LoginPayload is a struct that contains the fields for a user's login credentials

type LoginResponse

type LoginResponse struct {
	Token        string `json:"token"`
	RefreshToken string `json:"refreshToken"`
}

LoginResponse token response LoginResponse is a struct that contains the fields for a user's login response

type ShortenerController

type ShortenerController struct{}

ShortenerController is a struct that represents a controller for shortener-related operations“

func (*ShortenerController) CreateShortURL

func (ctrl *ShortenerController) CreateShortURL(c *gin.Context)

CreateShortURl creates a short URL from a long URL and stores it in the database c *gin.Context is a pointer to the Gin context

func (*ShortenerController) GetURLStatistics

func (ctrl *ShortenerController) GetURLStatistics(c *gin.Context)

GetURLStatistics returns the statistics for a specific short URL c *gin.Context is a pointer to the Gin context

func (*ShortenerController) RedirectShortURL

func (ctrl *ShortenerController) RedirectShortURL(c *gin.Context)

RedirectShortURL redirects the user to the long URL associated with the short URL c *gin.Context is a pointer to the Gin context

type UserController

type UserController struct{}

UserController is a struct that represents a controller for user-related operations

func (UserController) Login

func (ctrl UserController) Login(c *gin.Context)

@Summary Login User @Description Login @Tags User @ID LoginUser @Param EnterDetails body LoginPayload true "Login" @Accept json @Success 200 {object} string "Success" @Failure 400 {string} string "Error" @Router /public/login [POST]

func (UserController) Profile

func (ctrl UserController) Profile(c *gin.Context)

@Summary Get User By Token @ID GetUserByToken @Produce json @Tags User Param [param_name] [param_type] [data_type] required/mandatory [description] @Param Authorization header string true "Authorization header using the Bearer scheme" @Success 200 {object} string "Success" @Failure 400 {string} string "Error" @Router /protected/profile [GET]

func (UserController) Signup

func (ctrl UserController) Signup(c *gin.Context)

@Summary Signup User @Description Signin @ID SignupUser @Tags User @Param EnterDetails body UserDetails true "Signin" @Accept json @Success 200 {object} string "Success" @Failure 400 {string} string "Error" @Router /public/signup [POST]

type UserDetails

type UserDetails struct {
	Name     string `json:"name" binding:"required"`
	Email    string `json:"email" binding:"required"`
	Password string `json:"password" binding:"required"`
}

swagger input

Jump to

Keyboard shortcuts

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