v1

package
v0.0.0-...-4e22d16 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAbortResponse

func NewAbortResponse(c *gin.Context, message string)

func NewErrorResponse

func NewErrorResponse(c *gin.Context, statusCode int, err string)

func NewSuccessResponse

func NewSuccessResponse(c *gin.Context, statusCode int, message string, data interface{})

Types

type AuthorizationHandler

type AuthorizationHandler struct {
	// contains filtered or unexported fields
}

func (AuthorizationHandler) Delete

func (authH AuthorizationHandler) Delete(ctx *gin.Context)

@Summary delete authorization by id @Description delete authorization by id @Tags authorization @Accept json @Produce json @Param id path int true "authorization id" @Success 200 {object} map[string]interface{} "Delete authorization by id success" @Router /api/v1/authorizations/{id} [delete]

func (AuthorizationHandler) GetAll

func (authH AuthorizationHandler) GetAll(ctx *gin.Context)

@Summary Get all authorization @Description Get all authorization @Tags authorization @Accept json @Produce json @Param limit query string false "Limit" default(10) @Param page query string false "Page" default(1) @Param sort_by query string false "Sort By" @Param filters query string false "Filters" @Success 200 {object} map[string]interface{} "get all authorization success" @Router /api/v1/authorizations [get]

func (AuthorizationHandler) GetByID

func (authH AuthorizationHandler) GetByID(ctx *gin.Context)

@Summary Get authorization by id @Description Get authorization by id @Tags authorization @Accept json @Produce json @Param id path int true "authorization id" @Success 200 {object} map[string]interface{} "get authorization by id success" @Router /api/v1/authorizations/{id} [get]

func (AuthorizationHandler) Store

func (authH AuthorizationHandler) Store(ctx *gin.Context)

@Summary Create new authorization @Description Create new authorization @Tags authorization @Accept json @Produce json @Param authorization body requests.AuthorizationRequest true "Create new authorization" @Success 201 {object} map[string]interface{} "create new authorization success" @Router /api/v1/authorizations [post]

func (AuthorizationHandler) Update

func (authH AuthorizationHandler) Update(ctx *gin.Context)

@Summary Update authorization by id @Description Update authorization by id @Tags authorization @Accept json @Produce json @Param id path int true "Role ID" @Param authorization body requests.AuthorizationRequest true "Update new authorization" @Success 201 {object} map[string]interface{} "update authorization success" @Router /api/v1/authorizations/{id} [put]

type BaseResponse

type BaseResponse struct {
	Status  bool        `json:"status"`
	Message string      `json:"message,omitempty"`
	Data    interface{} `json:"data,omitempty"`
}

type ProductHandler

type ProductHandler struct {
	// contains filtered or unexported fields
}

func NewProductHandler

func NewProductHandler(useCase V1Domains.ProductUseCase) ProductHandler

func (ProductHandler) Delete

func (h ProductHandler) Delete(ctx *gin.Context)

@Summary delete product by id @Description delete product by id @Tags product @Accept json @Produce json @Param id path int true "product id" @Success 200 {object} map[string]interface{} "Delete product by id success" @Router /api/v1/products/{id} [delete]

func (ProductHandler) GetAll

func (h ProductHandler) GetAll(ctx *gin.Context)

@Summary Get all product @Description Get all product @Tags product @Accept json @Produce json @Param limit query string false "Limit" default(10) @Param page query string false "Page" default(1) @Param sort_by query string false "Sort By" @Param filters query string false "Filters" @Success 200 {object} map[string]interface{} "get all product success" @Router /api/v1/products [get]

func (ProductHandler) GetByID

func (h ProductHandler) GetByID(ctx *gin.Context)

@Summary Get product by id @Description Get product by id @Tags product @Accept json @Produce json @Param id path int true "product id" @Success 200 {object} map[string]interface{} "get product by id success" @Router /api/v1/products/{id} [get]

func (ProductHandler) Store

func (h ProductHandler) Store(ctx *gin.Context)

@Summary Create new product @Description Create new product @Tags product @Accept json @Produce json @Param product body requests.ProductRequest true "Create new product" @Success 201 {object} map[string]interface{} "create new product success" @Router /api/v1/products [post]

func (ProductHandler) Update

func (h ProductHandler) Update(ctx *gin.Context)

@Summary Update product by id @Description Update product by id @Tags product @Accept json @Produce json @Param id path int true "Role ID" @Param product body requests.ProductRequest true "Update new product" @Success 201 {object} map[string]interface{} "update product success" @Router /api/v1/products/{id} [put]

type RoleAuthorizationHandler

type RoleAuthorizationHandler struct {
	// contains filtered or unexported fields
}

func (RoleAuthorizationHandler) AssignAuthorizationToRole

func (roleAuthH RoleAuthorizationHandler) AssignAuthorizationToRole(ctx *gin.Context)

@Summary Assign authorization to role @Description Assign authorization to role @Tags role-authorization @Accept json @Produce json @Param roles_id path int true "Role ID" @Param authorizations_id path int true "Authorization ID" @Success 200 {object} map[string]interface{} "assign authorization to role success" @Router /api/v1/role-authorizations/{roles_id}/{authorizations_id} [post]

func (RoleAuthorizationHandler) GetAuthorizationsByRoleID

func (roleAuthH RoleAuthorizationHandler) GetAuthorizationsByRoleID(ctx *gin.Context)

@Summary Get authorizations by role id @Description Get authorizations by role id @Tags role-authorization @Accept json @Produce json @Param roles_id path int true "Role ID" @Success 200 {object} map[string]interface{} "get authorizations by role id success" @Router /api/v1/role-authorizations/{roles_id} [get]

func (RoleAuthorizationHandler) RemoveAuthorizationFromRole

func (roleAuthH RoleAuthorizationHandler) RemoveAuthorizationFromRole(ctx *gin.Context)

@Summary Remove authorization from role @Description Remove authorization from role @Tags role-authorization @Accept json @Produce json @Param roles_id path int true "Role ID" @Param authorizations_id path int true "Authorization ID" @Success 200 {object} map[string]interface{} "remove authorization from role success" @Router /api/v1/role-authorizations/{roles_id}/{authorizations_id} [delete]

type RoleHandler

type RoleHandler struct {
	// contains filtered or unexported fields
}

func NewRoleHandler

func NewRoleHandler(useCase V1Domains.RoleUseCase) RoleHandler

func (RoleHandler) Delete

func (h RoleHandler) Delete(ctx *gin.Context)

@Summary Delete role by id @Description Delete role by id @Tags role @Accept json @Produce json @Param id path int true "Role ID" @Success 200 {string} string "delete role success" @Router /api/v1/roles/{id} [delete]

func (RoleHandler) GetAll

func (h RoleHandler) GetAll(ctx *gin.Context)

@Summary Get all role @Description Get all role @Tags role @Accept json @Produce json @Param limit query string false "Limit" default(10) @Param page query string false "Page" default(1) @Param sort_by query string false "Sort By" @Param filters query string false "Filters" @Success 200 {object} map[string]interface{} "get all role success" @Router /api/v1/roles [get]

func (RoleHandler) GetByID

func (h RoleHandler) GetByID(ctx *gin.Context)

@Summary Get role by id @Description Get role by id @Tags role @Accept json @Produce json @Param id path int true "Role ID" @Success 200 {object} responses.RoleResponse{} @Router /api/v1/roles/{id} [get]

func (RoleHandler) Store

func (h RoleHandler) Store(ctx *gin.Context)

@Summary Create new role @Description Create new role @Tags role @Accept json @Produce json @Param role body requests.RoleRequest true "Create new role" @Success 201 {object} responses.RoleResponse{} @Router /api/v1/roles [post]

func (RoleHandler) Update

func (h RoleHandler) Update(ctx *gin.Context)

@Summary Update role by id @Description Update role by id @Tags role @Accept json @Produce json @Param id path int true "Role ID" @Param role body requests.RoleRequest true "Update role" @Success 200 {object} responses.RoleResponse{} @Router /api/v1/roles/{id} [put]

type UserHandler

type UserHandler struct {
	// contains filtered or unexported fields
}

func NewUserHandler

func NewUserHandler(usecase V1Domains.UserUsecase, redisCache caches.RedisCache, ristrettoCache caches.RistrettoCache) UserHandler

func (UserHandler) GetUserData

func (c UserHandler) GetUserData(ctx *gin.Context)

@Summary Get User Data @Description Get data of authenticated user @Tags users @Accept json @Produce json @Success 200 {object} map[string]interface{} "user data fetched successfully" @Router /api/v1/users/me [get]

func (UserHandler) Login

func (userH UserHandler) Login(ctx *gin.Context)

@Summary User login @Description Logs in a user @Tags auth @Accept json @Produce json @Param user body requests.UserLoginRequest true "Login User" @Success 200 {object} map[string]interface{} "login success" @Router /api/v1/auth/login [post]

func (UserHandler) Regis

func (userH UserHandler) Regis(ctx *gin.Context)

@Summary User registration @Description Register a new user @Tags auth @Accept json @Produce json @Param user body requests.UserRequest true "Register User" @Success 200 {object} map[string]interface{} "registration user success" @Router /api/v1/auth/regis [post]

func (UserHandler) SendOTP

func (userH UserHandler) SendOTP(ctx *gin.Context)

@Summary Send OTP @Description Send an OTP to user's email @Tags auth @Accept json @Produce json @Param email body requests.UserSendOTPRequest true "Send OTP" @Success 200 {object} map[string]interface{} "otp code has been send" @Router /api/v1/auth/send-otp [post]

func (UserHandler) VerifOTP

func (userH UserHandler) VerifOTP(ctx *gin.Context)

@Summary Verify OTP @Description Verify OTP for a user @Tags auth @Accept json @Produce json @Param otp body requests.UserVerifOTPRequest true "Verify OTP" @Success 200 {object} map[string]interface{} "otp verification success" @Router /api/v1/auth/verif-otp [post]

Jump to

Keyboard shortcuts

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