Documentation ¶
Index ¶
- func Use(r fiber.Router)
- type AttributeHandler
- func (h *AttributeHandler) Create(c *fiber.Ctx) error
- func (h *AttributeHandler) Delete(c *fiber.Ctx) error
- func (h *AttributeHandler) Fetch(c *fiber.Ctx) error
- func (h *AttributeHandler) GetByID(c *fiber.Ctx) error
- func (h *AttributeHandler) Search(c *fiber.Ctx) error
- func (h *AttributeHandler) Update(c *fiber.Ctx) error
- func (h *AttributeHandler) UseHandler(r fiber.Router)
- type CategoryHandler
- func (h *CategoryHandler) Create(c *fiber.Ctx) error
- func (h *CategoryHandler) Delete(c *fiber.Ctx) error
- func (h *CategoryHandler) Fetch(c *fiber.Ctx) error
- func (h *CategoryHandler) GetByID(c *fiber.Ctx) error
- func (h *CategoryHandler) GetProducts(c *fiber.Ctx) error
- func (h *CategoryHandler) Search(c *fiber.Ctx) error
- func (h *CategoryHandler) Update(c *fiber.Ctx) error
- func (h *CategoryHandler) UseHandler(r fiber.Router)
- type ProductHandler
- func (h *ProductHandler) AddAttribute(c *fiber.Ctx) error
- func (h *ProductHandler) AddImage(c *fiber.Ctx) error
- func (h *ProductHandler) Create(c *fiber.Ctx) error
- func (h *ProductHandler) CreateVariant(c *fiber.Ctx) error
- func (h *ProductHandler) Delete(c *fiber.Ctx) error
- func (h *ProductHandler) DeleteVariant(c *fiber.Ctx) error
- func (h *ProductHandler) Fetch(c *fiber.Ctx) error
- func (h *ProductHandler) FetchVariants(c *fiber.Ctx) error
- func (h *ProductHandler) GetAttributes(c *fiber.Ctx) error
- func (h *ProductHandler) GetByID(c *fiber.Ctx) error
- func (h *ProductHandler) GetImages(c *fiber.Ctx) error
- func (h *ProductHandler) GetVariantByID(c *fiber.Ctx) error
- func (h *ProductHandler) RemoveAttribute(c *fiber.Ctx) error
- func (h *ProductHandler) RemoveImage(c *fiber.Ctx) error
- func (h *ProductHandler) Search(c *fiber.Ctx) error
- func (h *ProductHandler) SearchVariants(c *fiber.Ctx) error
- func (h *ProductHandler) Update(c *fiber.Ctx) error
- func (h *ProductHandler) UpdateVariant(c *fiber.Ctx) error
- func (h *ProductHandler) UseHandler(r fiber.Router)
- type UserHandler
- func (h *UserHandler) ChangePassword(c *fiber.Ctx) error
- func (h *UserHandler) ChangeUsername(c *fiber.Ctx) error
- func (h *UserHandler) Delete(c *fiber.Ctx) error
- func (h *UserHandler) Me(c *fiber.Ctx) error
- func (h *UserHandler) Signin(c *fiber.Ctx) error
- func (h *UserHandler) Signup(c *fiber.Ctx) error
- func (h *UserHandler) UseHandler(r fiber.Router)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AttributeHandler ¶
type AttributeHandler struct {
// contains filtered or unexported fields
}
func NewAttributeHandler ¶
func NewAttributeHandler(service interfaces.IAttributeService) *AttributeHandler
func (*AttributeHandler) Create ¶
func (h *AttributeHandler) Create(c *fiber.Ctx) error
Attribute godoc @Summary Create attribute @Description Create new attribute @Tags attributes @Accept json @Produce json @Success 204 @Failure 400 {object} string @Failure 500 {object} string @Param dto body dtos.CreateAttributeDto true "dto" @Param Authorization header string true "Bearer" @Router /attributes [post]
func (*AttributeHandler) Delete ¶
func (h *AttributeHandler) Delete(c *fiber.Ctx) error
Attribute godoc @Summary Delete attribute @Description Delete attribute by id @Tags attributes @Accept json @Produce json @Success 204 @Failure 400 {object} string @Failure 500 {object} string @Param id path int true "id" @Param Authorization header string true "Bearer" @Router /attributes/{id} [delete]
func (*AttributeHandler) Fetch ¶
func (h *AttributeHandler) Fetch(c *fiber.Ctx) error
Attribute godoc @Summary Get attributes @Description Get all attributes @Tags attributes @Accept json @Produce json @Success 200 {array} dtos.AttributePaginatedDto @Failure 400 {object} string @Failure 500 {object} string @Param page query int false "page number" @Param size query int false "rows per page" @Param sortBy query string false "name or id" @Param orderBy query string false "ASC or DESC" @Router /attributes [get]
func (*AttributeHandler) GetByID ¶
func (h *AttributeHandler) GetByID(c *fiber.Ctx) error
Attribute godoc @Summary Get attribute by id @Description Get attribute by id @Tags attributes @Accept json @Produce json @Success 200 {object} dtos.AttributeDto @Failure 400 {object} string @Failure 404 {object} string @Failure 500 {object} string @Param id path int true "id" @Router /attributes/{id} [get]
func (*AttributeHandler) Search ¶
func (h *AttributeHandler) Search(c *fiber.Ctx) error
Attribute godoc @Summary Search attribute @Description Search attributes by attribute name @Tags attributes @Accept json @Produce json @Success 200 {array} dtos.AttributePaginatedDto @Failure 400 {object} string @Failure 500 {object} string @Param q query string true "query string to search in name" @Param page query int false "page number" @Param size query int false "rows per page" @Param sortBy query string false "name or id" @Param orderBy query string false "ASC or DESC" @Router /attributes/search [get]
func (*AttributeHandler) Update ¶
func (h *AttributeHandler) Update(c *fiber.Ctx) error
Attribute godoc @Summary Update attribute @Description Update attribute by id @Tags attributes @Accept json @Produce json @Success 204 @Failure 400 {object} string @Failure 500 {object} string @Param id path int true "id" @Param dto body dtos.UpdateAttributeDto true "dto" @Param Authorization header string true "Bearer" @Router /attributes/{id} [put]
func (*AttributeHandler) UseHandler ¶
func (h *AttributeHandler) UseHandler(r fiber.Router)
type CategoryHandler ¶
type CategoryHandler struct {
// contains filtered or unexported fields
}
func NewCategoryHandler ¶
func NewCategoryHandler(service interfaces.ICategoryService) *CategoryHandler
func (*CategoryHandler) Create ¶
func (h *CategoryHandler) Create(c *fiber.Ctx) error
Category godoc @Summary Create category @Description Create new category @Tags categories @Accept json @Produce json @Success 204 @Failure 400 {object} string @Failure 500 {object} string @Param dto body dtos.CreateCategoryDto true "dto" @Param Authorization header string true "Bearer" @Router /categories [post]
func (*CategoryHandler) Delete ¶
func (h *CategoryHandler) Delete(c *fiber.Ctx) error
Category godoc @Summary Delete category @Description Delete category by id @Tags categories @Accept json @Produce json @Success 204 @Failure 400 {object} string @Failure 500 {object} string @Param id path int true "id" @Param Authorization header string true "Bearer" @Router /categories/{id} [delete]
func (*CategoryHandler) Fetch ¶
func (h *CategoryHandler) Fetch(c *fiber.Ctx) error
Category godoc @Summary Get categories @Description Get all categories @Tags categories @Accept json @Produce json @Success 200 {array} dtos.CategoryPaginatedDto @Failure 400 {object} string @Failure 500 {object} string @Param page query int false "page number" @Param size query int false "rows per page" @Param sortBy query string false "name or id" @Param orderBy query string false "ASC or DESC" @Router /categories [get]
func (*CategoryHandler) GetByID ¶
func (h *CategoryHandler) GetByID(c *fiber.Ctx) error
Category godoc @Summary Get category by id @Description Get category by id @Tags categories @Accept json @Produce json @Success 200 {object} dtos.CategoryDto @Failure 400 {object} string @Failure 404 {object} string @Failure 500 {object} string @Param id path int true "id" @Router /categories/{id} [get]
func (*CategoryHandler) GetProducts ¶
func (h *CategoryHandler) GetProducts(c *fiber.Ctx) error
Category godoc @Summary Get products @Description Get all products belongs to category @Tags categories @Accept json @Produce json @Success 200 {array} dtos.ProductDto @Failure 400 {object} string @Failure 500 {object} string @Param page query int false "page number" @Param size query int false "rows per page" @Param sortBy query string false "name or id" @Param orderBy query string false "ASC or DESC" @Param id path int true "id" @Router /categories/{id}/products [get]
func (*CategoryHandler) Search ¶
func (h *CategoryHandler) Search(c *fiber.Ctx) error
Category godoc @Summary Search category @Description Search categories by category name @Tags categories @Accept json @Produce json @Success 200 {array} dtos.CategoryPaginatedDto @Failure 400 {object} string @Failure 500 {object} string @Param q query string true "query string to search in name" @Param page query int false "page number" @Param size query int false "rows per page" @Param sortBy query string false "name or id" @Param orderBy query string false "ASC or DESC" @Router /categories/search [get]
func (*CategoryHandler) Update ¶
func (h *CategoryHandler) Update(c *fiber.Ctx) error
Category godoc @Summary Update category @Description Update category by id @Tags categories @Accept json @Produce json @Success 204 @Failure 400 {object} string @Failure 500 {object} string @Param id path int true "id" @Param dto body dtos.UpdateCategoryDto true "dto" @Param Authorization header string true "Bearer" @Router /categories/{id} [put]
func (*CategoryHandler) UseHandler ¶
func (h *CategoryHandler) UseHandler(r fiber.Router)
type ProductHandler ¶
type ProductHandler struct {
// contains filtered or unexported fields
}
func NewProductHandler ¶
func NewProductHandler(service interfaces.IProductService) *ProductHandler
func (*ProductHandler) AddAttribute ¶
func (h *ProductHandler) AddAttribute(c *fiber.Ctx) error
Product godoc @Summary Add attribute to product variant @Description Add new attribute to product variant @Tags products @Accept json @Produce json @Success 201 {object} string @Failure 400 {object} string @Failure 500 {object} string @Param dto body dtos.CreateProductVariantAttributeDto true "dto" @Param id path int true "id" @Param variantID path int true "variantID" @Param Authorization header string true "Bearer" @Router /products/{id}/variants/{variantID}/attributes [post]
func (*ProductHandler) AddImage ¶
func (h *ProductHandler) AddImage(c *fiber.Ctx) error
Product godoc @Summary Add image to product @Description Add new image to product @Tags products @Accept json @Produce json @Success 201 {object} string @Failure 400 {object} string @Failure 500 {object} string @Param image formData file true "product image" @Param id path int true "id" @Param Authorization header string true "Bearer" @Router /products/{id}/images [post]
func (*ProductHandler) Create ¶
func (h *ProductHandler) Create(c *fiber.Ctx) error
Product godoc @Summary Create product @Description Create new product @Tags products @Accept json @Produce json @Success 201 {object} string @Failure 400 {object} string @Failure 500 {object} string @Param dto body dtos.CreateProductDto true "dto" @Param Authorization header string true "Bearer" @Router /products [post]
func (*ProductHandler) CreateVariant ¶
func (h *ProductHandler) CreateVariant(c *fiber.Ctx) error
Product godoc @Summary Create product variant @Description Create new product variant @Tags products @Accept json @Produce json @Success 201 {object} string @Failure 400 {object} string @Failure 500 {object} string @Param dto body dtos.CreateProductVariantDto true "dto" @Param id path int true "id" @Param Authorization header string true "Bearer" @Router /products/{id}/variants [post]
func (*ProductHandler) Delete ¶
func (h *ProductHandler) Delete(c *fiber.Ctx) error
Product godoc @Summary Delete product @Description Delete product by id @Tags products @Accept json @Produce json @Success 204 @Failure 400 {object} string @Failure 500 {object} string @Param id path int true "id" @Param Authorization header string true "Bearer" @Router /products/{id} [delete]
func (*ProductHandler) DeleteVariant ¶
func (h *ProductHandler) DeleteVariant(c *fiber.Ctx) error
Product godoc @Summary Delete product variant @Description Delete product variant by id @Tags products @Accept json @Produce json @Success 204 @Failure 400 {object} string @Failure 500 {object} string @Param id path int true "id" @Param variantID path int true "variantID" @Param Authorization header string true "Bearer" @Router /products/{id}/variants/{variantID} [delete]
func (*ProductHandler) Fetch ¶
func (h *ProductHandler) Fetch(c *fiber.Ctx) error
Product godoc @Summary Get products @Description Get all products @Tags products @Accept json @Produce json @Success 200 {array} dtos.ProductPaginatedDto @Failure 400 {object} string @Failure 500 {object} string @Param page query int false "page number" @Param size query int false "rows per page" @Param sortBy query string false "name or id" @Param orderBy query string false "ASC or DESC" @Router /products [get]
func (*ProductHandler) FetchVariants ¶
func (h *ProductHandler) FetchVariants(c *fiber.Ctx) error
Product godoc @Summary Get product variants @Description Get product variants @Tags products @Accept json @Produce json @Success 200 {array} dtos.ProductVariantPaginatedDto @Failure 400 {object} string @Failure 500 {object} string @Param page query int false "page number" @Param size query int false "rows per page" @Param sortBy query string false "name or id" @Param orderBy query string false "ASC or DESC" @Param id path int true "id" @Router /products/{id}/variants [get]
func (*ProductHandler) GetAttributes ¶
func (h *ProductHandler) GetAttributes(c *fiber.Ctx) error
Product godoc @Summary Get attributes belongs product variant @Description Get attributes belongs product variant @Tags products @Accept json @Produce json @Success 200 {array} dtos.AttributeDto @Failure 400 {object} string @Failure 500 {object} string @Param id path int true "id" @Param variantID path int true "variantID" @Router /products/{id}/variants/{variantID}/attributes [get]
func (*ProductHandler) GetByID ¶
func (h *ProductHandler) GetByID(c *fiber.Ctx) error
Product godoc @Summary Get product by id @Description Get product by id @Tags products @Accept json @Produce json @Success 200 {object} dtos.ProductDto @Failure 400 {object} string @Failure 404 {object} string @Failure 500 {object} string @Param id path int true "id" @Router /products/{id} [get]
func (*ProductHandler) GetImages ¶
func (h *ProductHandler) GetImages(c *fiber.Ctx) error
Product godoc @Summary Get images belongs product @Description Get images belongs product @Tags products @Accept json @Produce json @Success 200 {array} dtos.ImageDto @Failure 400 {object} string @Failure 500 {object} string @Param id path int true "id" @Router /products/{id}/images [get]
func (*ProductHandler) GetVariantByID ¶
func (h *ProductHandler) GetVariantByID(c *fiber.Ctx) error
Product godoc @Summary Get product variant by id @Description Get product variant by id @Tags products @Accept json @Produce json @Success 200 {object} dtos.ProductVariantDto @Failure 400 {object} string @Failure 404 {object} string @Failure 500 {object} string @Param id path int true "id" @Param variantID path int true "variantID" @Router /products/{id}/variants/{variantID} [get]
func (*ProductHandler) RemoveAttribute ¶
func (h *ProductHandler) RemoveAttribute(c *fiber.Ctx) error
Product godoc @Summary Remove attribute from product variant @Description Remove an attribute from product variant @Tags products @Accept json @Produce json @Success 204 @Failure 400 {object} string @Failure 500 {object} string @Param id path int true "id" @Param variantID path int true "variantID" @Param attributeID path int true "attributeID" @Param Authorization header string true "Bearer" @Router /products/{id}/variants/{variantID}/attributes/{attributeID} [delete]
func (*ProductHandler) RemoveImage ¶
func (h *ProductHandler) RemoveImage(c *fiber.Ctx) error
Product godoc @Summary Remove image from product @Description Remove an image from product @Tags products @Accept json @Produce json @Success 204 @Failure 400 {object} string @Failure 500 {object} string @Param id path int true "id" @Param imageID path int true "imageID" @Param Authorization header string true "Bearer" @Router /products/{id}/images/{imageID} [delete]
func (*ProductHandler) Search ¶
func (h *ProductHandler) Search(c *fiber.Ctx) error
Product godoc @Summary Search product @Description Search products by product name @Tags products @Accept json @Produce json @Success 200 {array} dtos.ProductPaginatedDto @Failure 400 {object} string @Failure 500 {object} string @Param q query string true "query string to search in name" @Param page query int false "page number" @Param size query int false "rows per page" @Param sortBy query string false "name or id" @Param orderBy query string false "ASC or DESC" @Router /products/search [get]
func (*ProductHandler) SearchVariants ¶
func (h *ProductHandler) SearchVariants(c *fiber.Ctx) error
Product godoc @Summary Search product variants @Description Search product variants @Tags products @Accept json @Produce json @Success 200 {array} dtos.ProductVariantPaginatedDto @Failure 400 {object} string @Failure 500 {object} string @Param attrs query string false "ex: [{'type':'color', 'names': ['red', 'yellow']}, {'type':'size', 'names': ['36']}]" @Param q query string true "query string to search in name" @Param page query int false "page number" @Param size query int false "rows per page" @Param sortBy query string false "id, name, price" @Param orderBy query string false "ASC or DESC" @Param id path int true "id" @Router /products/{id}/variants/search [get]
func (*ProductHandler) Update ¶
func (h *ProductHandler) Update(c *fiber.Ctx) error
Product godoc @Summary Update product @Description Update product by id @Tags products @Accept json @Produce json @Success 204 @Failure 400 {object} string @Failure 500 {object} string @Param id path int true "id" @Param dto body dtos.UpdateProductDto true "dto" @Param Authorization header string true "Bearer" @Router /products/{id} [put]
func (*ProductHandler) UpdateVariant ¶
func (h *ProductHandler) UpdateVariant(c *fiber.Ctx) error
Product godoc @Summary Update product variant @Description Update product variant by id @Tags products @Accept json @Produce json @Success 204 @Failure 400 {object} string @Failure 500 {object} string @Param id path int true "id" @Param variantID path int true "variantID" @Param dto body dtos.UpdateProductVariantDto true "dto" @Param Authorization header string true "Bearer" @Router /products/{id}/variants/{variantID} [put]
func (*ProductHandler) UseHandler ¶
func (h *ProductHandler) UseHandler(r fiber.Router)
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
func NewUserHandler ¶
func NewUserHandler(service interfaces.IUserService) *UserHandler
func (*UserHandler) ChangePassword ¶
func (h *UserHandler) ChangePassword(c *fiber.Ctx) error
User godoc @Summary Change password @Description Change password @Tags users @Accept json @Produce json @Success 204 @Failure 400 {object} string @Failure 403 {object} string @Failure 404 {object} string @Failure 500 {object} string @Param dto body dtos.ChangePasswordDto true "dto" @Param Authorization header string true "Bearer" @Router /users/me/change-password [post]
func (*UserHandler) ChangeUsername ¶
func (h *UserHandler) ChangeUsername(c *fiber.Ctx) error
User godoc @Summary Change username @Description Change username @Tags users @Accept json @Produce json @Success 204 @Failure 400 {object} string @Failure 403 {object} string @Failure 404 {object} string @Failure 500 {object} string @Param dto body dtos.ChangeUsernameDto true "dto" @Param Authorization header string true "Bearer" @Router /users/me/change-username [post]
func (*UserHandler) Delete ¶
func (h *UserHandler) Delete(c *fiber.Ctx) error
User godoc @Summary Delete current user @Description Delete current user @Tags users @Accept json @Produce json @Success 204 @Failure 403 {object} string @Failure 404 {object} string @Failure 500 {object} string @Param Authorization header string true "Bearer" @Router /users/me [delete]
func (*UserHandler) Me ¶
func (h *UserHandler) Me(c *fiber.Ctx) error
User godoc @Summary Get current users details @Description Get current users details @Tags users @Accept json @Produce json @Success 200 {object} dtos.UserDto @Failure 400 {object} string @Failure 403 {object} string @Failure 404 {object} string @Failure 500 {object} string @Param Authorization header string true "Bearer" @Router /users/me [get]
func (*UserHandler) Signin ¶
func (h *UserHandler) Signin(c *fiber.Ctx) error
User godoc @Summary Signin @Description Signin with username and password @Tags users @Accept json @Produce json @Success 200 {object} string @Failure 400 {object} string @Failure 500 {object} string @Param dto body dtos.SigninDto true "dto" @Router /users/signin [post]
func (*UserHandler) Signup ¶
func (h *UserHandler) Signup(c *fiber.Ctx) error
User godoc @Summary Signup @Description Create new account @Tags users @Accept json @Produce json @Success 204 @Failure 400 {object} string @Failure 500 {object} string @Param dto body dtos.SignupDto true "dto" @Router /users/signup [post]
func (*UserHandler) UseHandler ¶
func (h *UserHandler) UseHandler(r fiber.Router)