handlers

package
v0.0.0-...-cbfa0ec Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyExists       = "ALREADY_EXISTS"
	ErrNotFound            = "NOT_FOUND"
	ErrInternalServerError = "INTERNAL_SERVER_ERROR"
	ErrServiceUnavailable  = "SERVICE_UNAVAILABLE"
	SigningKey             = []byte("FfLbN7pIEYe8@!EqrttOLiwa(H8)7Ddo")
	SuperAdminUserType     = "superadmin"
	SystemUserType         = "admin"
)

Functions

func MakePrettySlice

func MakePrettySlice(s string) []string

Types

type Handler

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

func NewHandler

func NewHandler(cfg config.Config, log logger.LoggerI, svcs client.ServiceManagerI) Handler

func (*Handler) CreateEntity

func (h *Handler) CreateEntity(c *fiber.Ctx) error

CreateEntity godoc @Security ApiKeyAuth @ID create_entity @Router /client-api/entity/{slug}/create [POST] @Param location header string false "Location" default("Asia/Tashkent") @Summary Create Entity @Description Create Entity @Accept json @Produce json @Tags Entity @Param slug path string true "Entity Slug" @Param entity body models.Entity true "Create Entity" @Success 201 {object} http.Response{data=models.Entity} "Created" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) CreateField

func (h *Handler) CreateField(c *fiber.Ctx) error

CreateField godoc @Security ApiKeyAuth @ID create_field @Router /client-api/dynamic/field [POST] @Summary Create Field @Description Create Field @Accept json @Produce json @Tags Field @Param field body dynamic_service.Field true "Create Field" @Success 201 {object} http.Response{data=dynamic_service.Field} "Created" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) CreateGroup

func (h *Handler) CreateGroup(c *fiber.Ctx) error

CreateGroup godoc @Security ApiKeyAuth @ID create_group @Router /client-api/dynamic/group [POST] @Summary Create Group @Description Create Group @Accept json @Produce json @Tags Group @Param group body models.Group true "Create Group" @Success 201 {object} http.Response{data=models.Group} "Created" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) DefaultValuesConfiguration

func (h *Handler) DefaultValuesConfiguration(c *fiber.Ctx) error

DefaultValuesConfiguration godoc @Security ApiKeyAuth @ID default_values_configuration @Router /client-api/configuration/default_values [GET] @Summary Default Values Configuration @Description Default Values Configuration @Accept json @Produce json @Tags Configuration @Success 200 {object} http.Response{data=[]models.Configuration} "Success" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) DeleteEntity

func (h *Handler) DeleteEntity(c *fiber.Ctx) error

DeleteEntity godoc @Security ApiKeyAuth @ID delete_entity @Router /client-api/entity/{slug}/delete/{id} [DELETE] @Param location header string false "Location" default("Asia/Tashkent") @Summary Delete Entity @Description Delete Entity @Accept json @Produce json @Tags Entity @Param slug path string true "Entity Slug" @Param id path string true "Entity ID" @Success 200 {object} http.Response{data=string} "Deleted" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) DeleteField

func (h *Handler) DeleteField(c *fiber.Ctx) error

DeleteField godoc @Security ApiKeyAuth @ID delete_field @Router /client-api/dynamic/field/{id} [DELETE] @Summary Delete Field @Description Delete Field @Accept json @Produce json @Tags Field @Param id path string true "Field ID" @Success 200 {object} http.Response{data=string} "OK" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) DeleteGroup

func (h *Handler) DeleteGroup(c *fiber.Ctx) error

DeleteGroup godoc @Security ApiKeyAuth @ID delete_group @Router /client-api/dynamic/group/{id} [DELETE] @Summary Delete Group @Description Delete Group @Accept json @Produce json @Tags Group @Param id path string true "Group ID" @Success 200 {object} string "OK" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) FieldTypeConfiguration

func (h *Handler) FieldTypeConfiguration(c *fiber.Ctx) error

FieldTypeConfiguration godoc @Security ApiKeyAuth @Security ApiKeyAuth @ID field_type_configuration @Router /client-api/configuration/field_types [GET] @Summary Field Type Configuration @Description Field Type Configuration @Accept json @Produce json @Tags Configuration @Success 200 {object} http.Response{data=[]models.Configuration} "Success" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) GetAllEntityGet

func (h *Handler) GetAllEntityGet(c *fiber.Ctx) error

GetAllEntityGet godoc @Security ApiKeyAuth @ID get_all_get @Router /client-api/entity/{slug}/get-all [GET] @Param location header string false "Location" default("Asia/Tashkent") @Summary Get All Entities @Description Get All Entities @Accept json @Produce json @Tags Entity @Param slug path string true "Entity Slug" @Param offset query int false "Offset" @Param limit query int false "Limit" @Param sort query string false "Sort" @Param order query string false "Order" @Param search query string false "Search" @Success 200 {object} http.Response{data=models.Entity} "Entities" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) GetAllEntityPost

func (h *Handler) GetAllEntityPost(c *fiber.Ctx) error

GetAll godoc @Security ApiKeyAuth @ID get_all_post @Router /client-api/entity/{slug}/get-all [POST] @Param location header string false "Location" default("Asia/Tashkent") @Summary Get All Entities @Description Get All Entities @Accept json @Produce json @Tags Entity @Param slug path string true "Entity Slug" @Param offset query int false "Offset" @Param limit query int false "Limit" @Param sort query string false "Sort" @Param order query string false "Order" @Param search query string false "Search" @Param filter body models.Entity false "Filter Entity" @Success 200 {object} http.Response{data=models.Entity} "Entities" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) GetAllField

func (h *Handler) GetAllField(c *fiber.Ctx) error

GetAllField godoc @Security ApiKeyAuth @ID get_all_field @Router /client-api/dynamic/field [GET] @Summary Get All Field @Description Get All Field @Accept json @Produce json @Tags Field @Param offset query int false "Offset" @Param limit query int false "Limit" @Param sort query string false "Sort" @Param order query string false "Order" @Param group_id query string false "Group ID" @Param search query string false "Search" @Param slug query string false "Slug" @Success 200 {object} http.Response{data=dynamic_service.GetAllFieldResponse} "OK" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) GetAllGroup

func (h *Handler) GetAllGroup(c *fiber.Ctx) error

GetAllGroup godoc @Security ApiKeyAuth @ID get_all_group @Router /client-api/dynamic/group [GET] @Summary Get All Group @Description Get All Group @Accept json @Produce json @Tags Group @Param offset query int false "Offset" @Param limit query int false "Limit" @Param sort query string false "Sort" @Param order query string false "Order" @Param group_type query int false "Group Type" @Param slug query string false "Slug" @Param search query string false "Search" @Param parent_id query string false "Parent ID" @Success 200 {object} http.Response{data=models.GetAllGroupResponse} "OK" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) GetAllServices

func (h *Handler) GetAllServices(c *fiber.Ctx) error

GetAllService godoc @Security ApiKeyAuth @ID get_all_service @Router /client-api/service/{slug}/get-all [GET] @Param location header string false "Location" default("Asia/Tashkent") @Summary Get All Services @Description Get All Services @Accept json @Produce json @Tags Entity @Param slug path string true "Entity Slug" @Param offset query int false "Offset" @Param limit query int false "Limit" @Param sort query string false "Sort" @Param order query string false "Order" @Param search query string false "Search" @Success 200 {object} http.Response{data=models.Entity} "Services" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) GetEntity

func (h *Handler) GetEntity(c *fiber.Ctx) error

GetEntity godoc @Security ApiKeyAuth @ID get_entity @Router /client-api/entity/{slug}/get/{id} [GET] @Param location header string false "Location" default("Asia/Tashkent") @Summary Get Entity @Description Get Entity @Accept json @Produce json @Tags Entity @Param slug path string true "Entity Slug" @Param id path string true "Entity ID" @Success 200 {object} http.Response{data=models.Entity} "OK" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) GetEntityService

func (h *Handler) GetEntityService(c *fiber.Ctx) error

GetEntityService godoc @Security ApiKeyAuth @ID get_entity_service @Router /client-api/service/{slug}/get/{id} [GET] @Param location header string false "Location" default("Asia/Tashkent") @Summary Get Entity @Description Get Entity @Accept json @Produce json @Tags Entity @Param slug path string true "Entity Slug" @Param id path string true "Entity ID" @Success 200 {object} http.Response{data=models.Entity} "OK" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) GetFieldById

func (h *Handler) GetFieldById(c *fiber.Ctx) error

GetFieldById godoc @Security ApiKeyAuth @ID get_field_by_id @Router /client-api/dynamic/field/{id} [GET] @Summary Get Field By ID @Description Get Field By ID @Accept json @Produce json @Tags Field @Param id path string true "Field ID" @Success 200 {object} http.Response{data=dynamic_service.Field} "OK" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) GetFullGroup

func (h *Handler) GetFullGroup(c *fiber.Ctx) error

GetFullGroup godoc @Security ApiKeyAuth @ID get_full_group @Router /client-api/dynamic/group/{slug}/full [GET] @Summary Get Full Group @Description Get Full Group @Accept json @Produce json @Tags Group @Param slug path string true "Group Slug Or ID" @Success 200 {object} http.Response{data=models.Group} "OK" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) GetGroup

func (h *Handler) GetGroup(c *fiber.Ctx) error

GetGroup godoc @Security ApiKeyAuth @ID get_group @Router /client-api/dynamic/group/{id} [GET] @Summary Get Group @Description Get Group @Accept json @Produce json @Tags Group @Param id path string true "Group ID" @Success 200 {object} http.Response{data=models.Group} "OK" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) GetJoinEntity

func (h *Handler) GetJoinEntity(c *fiber.Ctx) error

GetJoin godoc @Security ApiKeyAuth @ID get_join @Router /client-api/entity/{slug}/get-join [POST] @Param location header string false "Location" default("Asia/Tashkent") @Summary Get Join Entities @Description Get Join Entities @Accept json @Produce json @Tags Entity @Param slug path string true "Entity Slug" @Param offset query int false "Offset" @Param limit query int false "Limit" @Param sort query string false "Sort" @Param order query string false "Order" @Param search query string false "Search" @Param filter body models.JoinGroupRequest false "Filter Entity"

func (*Handler) GroupTypeConfiguration

func (h *Handler) GroupTypeConfiguration(c *fiber.Ctx) error

GroupTypeConfiguration godoc @Security ApiKeyAuth @ID group_type_configuration @Router /client-api/configuration/group_types [GET] @Summary Group Type Configuration @Description Group Type Configuration @Accept json @Produce json @Tags Configuration @Success 200 {object} http.Response{data=[]models.Configuration} "Success" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) HandlerLanguage

func (h *Handler) HandlerLanguage() fiber.Handler

func (*Handler) HasAccessMiddleware

func (h *Handler) HasAccessMiddleware(c *fiber.Ctx) error

func (*Handler) Limiter

func (h *Handler) Limiter(max int, expiration_second time.Duration) func(*fiber.Ctx) error

func (*Handler) PatchUpdateEntity

func (h *Handler) PatchUpdateEntity(c *fiber.Ctx) error

PatchUpdateEntity godoc @Security ApiKeyAuth @ID update_entity @Router /client-api/entity/{slug}/update/{id} [PATCH] @Summary Patch Update Entity @Description Patch Update Entity @Accept json @Produce json @Tags Entity @Param slug path string true "Entity Slug" @Param id path string true "Entity ID" @Param entity body models.Entity true "Update Entity" @Success 200 {object} http.Response{data=models.Entity} @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) RegexConfiguration

func (h *Handler) RegexConfiguration(c *fiber.Ctx) error

RegexConfiguration godoc @Security ApiKeyAuth @ID regex_configuration @Router /client-api/configuration/regex [GET] @Summary Regex Configuration @Description Regex Configuration @Accept json @Produce json @Tags Configuration @Param regex query string true "Regex" @Param value query string true "Value" @Success 200 {object} http.Response{data=[]models.Configuration} "Success" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) SignIn

func (h *Handler) SignIn(c *fiber.Ctx) error

Sign In godoc @ID sign_in @Router /client-api/auth/sign-in [POST] @Summary Sign In @Description Sign In @Accept json @Produce json @Tags Auth @Param location header string false "Location" default("Asia/Tashkent") @Param body body models.SignInRequest true "Sign In" @Success 200 {object} http.Response{data=models.SignInResponse} "Success" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) UpdateEntity

func (h *Handler) UpdateEntity(c *fiber.Ctx) error

UpdateEntity godoc @Security ApiKeyAuth @ID update_entity @Router /client-api/entity/{slug}/update/{id} [PUT] @Summary Update Entity @Description Update Entity @Accept json @Produce json @Tags Entity @Param slug path string true "Entity Slug" @Param id path string true "Entity ID" @Param entity body models.Entity true "Update Entity" @Success 200 {object} http.Response{data=models.Entity} @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) UpdateField

func (h *Handler) UpdateField(c *fiber.Ctx) error

UpdateField godoc @Security ApiKeyAuth @ID update_field @Router /client-api/dynamic/field/{id} [PUT] @Summary Update Field @Description Update Field @Accept json @Produce json @Tags Field @Param id path string true "Field ID" @Param field body dynamic_service.Field true "Update Field" @Success 200 {object} http.Response{data=dynamic_service.Field} "OK" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) UpdateGroup

func (h *Handler) UpdateGroup(c *fiber.Ctx) error

UpdateGroup godoc @Security ApiKeyAuth @ID update_group @Router /client-api/dynamic/group/{id} [PUT] @Summary Update Group @Description Update Group @Accept json @Produce json @Tags Group @Param id path string true "Group ID" @Param group body models.Group true "Update Group" @Success 200 {object} http.Response{data=string} "OK" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

func (*Handler) ValidationFunctionConfiguration

func (h *Handler) ValidationFunctionConfiguration(c *fiber.Ctx) error

ValidationFunctionConfiguration godoc @Security ApiKeyAuth @ID validation_function_configuration @Router /client-api/configuration/validation_functions [GET] @Summary Validation Function Configuration @Description Validation Function Configuration @Accept json @Produce json @Tags Configuration @Success 200 {object} http.Response{data=[]models.Configuration} "Success" @Response 400 {object} http.Response{data=string} "Bad Request" @Failure 500 {object} http.Response{data=string} "Server Error"

type Map

type Map map[string]interface{}

Jump to

Keyboard shortcuts

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