From a2cdb34bc3d2cff7a0488841d1576b8516de5855 Mon Sep 17 00:00:00 2001 From: Anang Yusman Date: Mon, 26 Jan 2026 14:57:05 +0800 Subject: [PATCH] feat:add api comment agent,promo,galeri,product --- .../controller/galleries.controller.go | 44 ++++ app/module/galleries/galleries.module.go | 1 + .../galleries/request/galleries.request.go | 5 + .../galleries/service/galleries.service.go | 48 ++++ .../controller/products.controller.go | 60 ++++- app/module/products/products.module.go | 1 + .../products/request/products.request.go | 51 +++- .../products/service/products.service.go | 62 ++++- .../controller/promotions.controller.go | 44 ++++ app/module/promotions/promotions.module.go | 1 + .../promotions/request/promotions.request.go | 4 + .../promotions/service/promotions.service.go | 48 ++++ .../controller/sales_agents.controller.go | 44 ++++ .../request/sales_agents.request.go | 4 + .../sales_agents/sales_agents.module.go | 1 + .../service/sales_agents.service.go | 48 ++++ docs/docs.go | 236 +++++++++++++++--- docs/swagger.json | 236 +++++++++++++++--- docs/swagger.yaml | 153 ++++++++++-- docs/swagger/docs.go | 232 ++++++++++++++++- docs/swagger/swagger.json | 226 ++++++++++++++++- docs/swagger/swagger.yaml | 145 +++++++++++ 22 files changed, 1591 insertions(+), 103 deletions(-) diff --git a/app/module/galleries/controller/galleries.controller.go b/app/module/galleries/controller/galleries.controller.go index 668ee78..f1e6ba4 100644 --- a/app/module/galleries/controller/galleries.controller.go +++ b/app/module/galleries/controller/galleries.controller.go @@ -23,6 +23,7 @@ type GalleriesController interface { Update(c *fiber.Ctx) error Delete(c *fiber.Ctx) error Approve(c *fiber.Ctx) error + Comment(c *fiber.Ctx) error Reject(c *fiber.Ctx) error } @@ -281,3 +282,46 @@ func (_i *galleriesController) Reject(c *fiber.Ctx) error { Data: galleryData, }) } + +// Comment Banner +// @Summary Comment Banner +// @Description API for comment Banner (only admin) +// @Tags Banners +// @Security BearerAuth +// @Param id path int true "Banner ID" +// @Param body body request.CommentRequest true "Comment payload" +// @Success 200 {object} response.Response +// @Router /galleries/{id}/comment [put] +func (_i *galleriesController) Comment(c *fiber.Ctx) error { + id, err := strconv.ParseUint(c.Params("id"), 10, 0) + if err != nil { + return err + } + + authToken := c.Get("Authorization") + if authToken == "" { + return utilRes.Resp(c, utilRes.Response{ + Success: false, + Messages: utilRes.Messages{"Unauthorized"}, + }) + } + + var req request.CommentRequest + if err := c.BodyParser(&req); err != nil { + return utilRes.Resp(c, utilRes.Response{ + Success: false, + Messages: utilRes.Messages{"Invalid request"}, + }) + } + + bannerData, err := _i.galleriesService.Comment(uint(id), authToken, &req.Message) + if err != nil { + return err + } + + return utilRes.Resp(c, utilRes.Response{ + Success: true, + Messages: utilRes.Messages{"Komentar berhasil disimpan"}, + Data: bannerData, + }) +} diff --git a/app/module/galleries/galleries.module.go b/app/module/galleries/galleries.module.go index ee4a196..33c711d 100644 --- a/app/module/galleries/galleries.module.go +++ b/app/module/galleries/galleries.module.go @@ -51,6 +51,7 @@ func (_i *GalleriesRouter) RegisterGalleriesRoutes() { router.Put("/:id", galleriesController.Update) router.Put("/:id/approve", galleriesController.Approve) router.Put("/:id/reject", galleriesController.Reject) + router.Put("/:id/comment", galleriesController.Comment) router.Delete("/:id", galleriesController.Delete) }) } diff --git a/app/module/galleries/request/galleries.request.go b/app/module/galleries/request/galleries.request.go index 270a4e7..c897b62 100644 --- a/app/module/galleries/request/galleries.request.go +++ b/app/module/galleries/request/galleries.request.go @@ -10,10 +10,15 @@ type GalleriesQueryRequest struct { Pagination *paginator.Pagination `json:"pagination"` } + type GalleriesQueryRequestContext struct { Title string `json:"title"` } +type CommentRequest struct { + Message string `json:"message"` +} + func (req GalleriesQueryRequestContext) ToParamRequest() GalleriesQueryRequest { var request GalleriesQueryRequest diff --git a/app/module/galleries/service/galleries.service.go b/app/module/galleries/service/galleries.service.go index 2248cc2..a96b3cf 100644 --- a/app/module/galleries/service/galleries.service.go +++ b/app/module/galleries/service/galleries.service.go @@ -30,6 +30,7 @@ type GalleriesService interface { Update(id uint, req request.GalleriesUpdateRequest) (gallery *response.GalleriesResponse, err error) Delete(id uint) (err error) Approve(id uint, authToken string) (gallery *response.GalleriesResponse, err error) + Comment(id uint, authToken string, message *string) (banner *response.GalleriesResponse, err error) Reject(id uint, authToken string, message *string) (gallery *response.GalleriesResponse, err error) } @@ -218,3 +219,50 @@ func (_i *galleriesService) Reject(id uint, authToken string, message *string) ( gallery = mapper.GalleriesResponseMapper(galleryEntity, host) return } + +func (_i *galleriesService) Comment( + id uint, + authToken string, + message *string, +) (galleries *response.GalleriesResponse, err error) { + + user := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) + if user == nil { + err = errors.New("unauthorized") + return + } + + if user.UserRoleId != 1 { + err = errors.New("only admin can comment") + return + } + + // SIMPAN COMMENT KE HISTORY (INTI FITURNYA) + userID := user.ID + err = _i.ApprovalHistoriesService.CreateHistory( + "galleries", + id, + nil, // status_id NULL + "comment", + &userID, + message, + ) + if err != nil { + return + } + + // Ambil terbaru + galleriesEntity, err := _i.Repo.FindOne(id) + if err != nil { + return + } + + if galleriesEntity == nil { + err = errors.New("galleries not found") + return + } + + host := _i.Cfg.App.Domain + galleries = mapper.GalleriesResponseMapper(galleriesEntity, host) + return +} diff --git a/app/module/products/controller/products.controller.go b/app/module/products/controller/products.controller.go index 1bded2c..6c17dd6 100644 --- a/app/module/products/controller/products.controller.go +++ b/app/module/products/controller/products.controller.go @@ -24,6 +24,7 @@ type ProductsController interface { Delete(c *fiber.Ctx) error Approve(c *fiber.Ctx) error Reject(c *fiber.Ctx) error + Comment(c *fiber.Ctx) error Viewer(c *fiber.Ctx) error } @@ -142,12 +143,18 @@ func (_i *productsController) Save(c *fiber.Ctx) error { } // Handle colors (JSON array string) - if colorsStr := c.FormValue("colors"); colorsStr != "" { - var colors []string - if err := json.Unmarshal([]byte(colorsStr), &colors); err == nil { - req.Colors = colors - } + var colors []request.ProductColorRequest + + if colorsStr := c.FormValue("colors"); colorsStr != "" { + if err := json.Unmarshal([]byte(colorsStr), &colors); err != nil { + return utilRes.Resp(c, utilRes.Response{ + Success: false, + Messages: utilRes.Messages{"Invalid colors format"}, + }) } + req.Colors = colors + } + // Validate required fields if req.Title == "" { @@ -368,6 +375,49 @@ func (_i *productsController) Reject(c *fiber.Ctx) error { }) } +// Comment Banner +// @Summary Comment Banner +// @Description API for comment Banner (only admin) +// @Tags Banners +// @Security BearerAuth +// @Param id path int true "Banner ID" +// @Param body body request.CommentRequest true "Comment payload" +// @Success 200 {object} response.Response +// @Router /products/{id}/comment [put] +func (_i *productsController) Comment(c *fiber.Ctx) error { + id, err := strconv.ParseUint(c.Params("id"), 10, 0) + if err != nil { + return err + } + + authToken := c.Get("Authorization") + if authToken == "" { + return utilRes.Resp(c, utilRes.Response{ + Success: false, + Messages: utilRes.Messages{"Unauthorized"}, + }) + } + + var req request.CommentRequest + if err := c.BodyParser(&req); err != nil { + return utilRes.Resp(c, utilRes.Response{ + Success: false, + Messages: utilRes.Messages{"Invalid request"}, + }) + } + + bannerData, err := _i.productsService.Comment(uint(id), authToken, &req.Message) + if err != nil { + return err + } + + return utilRes.Resp(c, utilRes.Response{ + Success: true, + Messages: utilRes.Messages{"Komentar berhasil disimpan"}, + Data: bannerData, + }) +} + // Viewer Product // @Summary Viewer Product // @Description API for viewing Product file diff --git a/app/module/products/products.module.go b/app/module/products/products.module.go index 1ea8b45..08aa247 100644 --- a/app/module/products/products.module.go +++ b/app/module/products/products.module.go @@ -52,6 +52,7 @@ func (_i *ProductsRouter) RegisterProductsRoutes() { router.Put("/:id", productsController.Update) router.Put("/:id/approve", productsController.Approve) router.Put("/:id/reject", productsController.Reject) + router.Put("/:id/comment", productsController.Comment) router.Delete("/:id", productsController.Delete) }) } diff --git a/app/module/products/request/products.request.go b/app/module/products/request/products.request.go index 1298900..4fd452d 100644 --- a/app/module/products/request/products.request.go +++ b/app/module/products/request/products.request.go @@ -19,6 +19,10 @@ type ProductsQueryRequestContext struct { Status string `json:"status"` } +type CommentRequest struct { + Message string `json:"message"` +} + func (req ProductsQueryRequestContext) ToParamRequest() ProductsQueryRequest { var request ProductsQueryRequest @@ -35,18 +39,46 @@ func (req ProductsQueryRequestContext) ToParamRequest() ProductsQueryRequest { return request } +// type ProductsCreateRequest struct { +// Title string `json:"title" validate:"required"` +// Variant *string `json:"variant"` +// Price *string `json:"price"` +// ThumbnailPath *string `json:"thumbnail_path"` +// Colors []string `json:"colors"` +// Status *string `json:"status"` +// } + type ProductsCreateRequest struct { - Title string `json:"title" validate:"required"` - Variant *string `json:"variant"` - Price *string `json:"price"` - ThumbnailPath *string `json:"thumbnail_path"` - Colors []string `json:"colors"` - Status *string `json:"status"` + Title string `json:"title" validate:"required"` + Variant *string `json:"variant"` + Price *string `json:"price"` + ThumbnailPath *string `json:"thumbnail_path"` + Colors []ProductColorRequest `json:"colors"` + Status *string `json:"status"` } + +// func (req ProductsCreateRequest) ToEntity() *entity.Products { +// colorsJSON, _ := json.Marshal(req.Colors) +// colorsStr := string(colorsJSON) +// if colorsStr == "null" { +// colorsStr = "" +// } + +// return &entity.Products{ +// Title: req.Title, +// Variant: req.Variant, +// Price: req.Price, +// ThumbnailPath: req.ThumbnailPath, +// Colors: &colorsStr, +// Status: req.Status, +// } +// } + func (req ProductsCreateRequest) ToEntity() *entity.Products { colorsJSON, _ := json.Marshal(req.Colors) colorsStr := string(colorsJSON) + if colorsStr == "null" { colorsStr = "" } @@ -61,6 +93,7 @@ func (req ProductsCreateRequest) ToEntity() *entity.Products { } } + type ProductsUpdateRequest struct { Title *string `json:"title"` Variant *string `json:"variant"` @@ -95,3 +128,9 @@ func getStringValue(s *string) string { } return *s } + +type ProductColorRequest struct { + Name string `json:"name"` + ImagePath *string `json:"image_path"` +} + diff --git a/app/module/products/service/products.service.go b/app/module/products/service/products.service.go index a5a0d86..d97d267 100644 --- a/app/module/products/service/products.service.go +++ b/app/module/products/service/products.service.go @@ -28,11 +28,11 @@ import ( ) type productsService struct { - Repo repository.ProductsRepository - Log zerolog.Logger - Cfg *config.Config - MinioStorage *minioStorage.MinioStorage - UsersRepo usersRepository.UsersRepository + Repo repository.ProductsRepository + Log zerolog.Logger + Cfg *config.Config + MinioStorage *minioStorage.MinioStorage + UsersRepo usersRepository.UsersRepository ApprovalHistoriesService approvalHistoriesService.ApprovalHistoriesService } @@ -44,6 +44,7 @@ type ProductsService interface { Delete(id uint) (err error) Approve(id uint, authToken string) (product *response.ProductsResponse, err error) Reject(id uint, authToken string, message *string) (product *response.ProductsResponse, err error) + Comment(id uint, authToken string, message *string) (product *response.ProductsResponse, err error) UploadFileToMinio(c *fiber.Ctx, fileKey string) (filePath *string, err error) Viewer(c *fiber.Ctx) (err error) } @@ -307,7 +308,7 @@ func (_i *productsService) Approve(id uint, authToken string) (product *response statusApprove := 2 err = _i.ApprovalHistoriesService.CreateHistory( - "banners", + "products", id, &statusApprove, // ✅ pointer "approve", @@ -359,7 +360,7 @@ func (_i *productsService) Reject(id uint, authToken string, message *string) (p statusReject := 3 err = _i.ApprovalHistoriesService.CreateHistory( - "banners", + "productss", id, &statusReject, // ✅ pointer "reject", @@ -385,3 +386,50 @@ func (_i *productsService) Reject(id uint, authToken string, message *string) (p product = mapper.ProductsResponseMapper(productEntity, host) return } + +func (_i *productsService) Comment( + id uint, + authToken string, + message *string, +) (banner *response.ProductsResponse, err error) { + + user := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) + if user == nil { + err = errors.New("unauthorized") + return + } + + if user.UserRoleId != 1 { + err = errors.New("only admin can comment") + return + } + + // SIMPAN COMMENT KE HISTORY (INTI FITURNYA) + userID := user.ID + err = _i.ApprovalHistoriesService.CreateHistory( + "banners", + id, + nil, // status_id NULL + "comment", + &userID, + message, + ) + if err != nil { + return + } + + // Ambil banner terbaru + bannerEntity, err := _i.Repo.FindOne(id) + if err != nil { + return + } + + if bannerEntity == nil { + err = errors.New("banner not found") + return + } + + host := _i.Cfg.App.Domain + banner = mapper.ProductsResponseMapper(bannerEntity, host) + return +} diff --git a/app/module/promotions/controller/promotions.controller.go b/app/module/promotions/controller/promotions.controller.go index cc9e670..9d94055 100644 --- a/app/module/promotions/controller/promotions.controller.go +++ b/app/module/promotions/controller/promotions.controller.go @@ -24,6 +24,7 @@ type PromotionsController interface { Delete(c *fiber.Ctx) error Approve(c *fiber.Ctx) error Reject(c *fiber.Ctx) error + Comment(c *fiber.Ctx) error Viewer(c *fiber.Ctx) error } @@ -311,6 +312,49 @@ func (_i *promotionsController) Reject(c *fiber.Ctx) error { }) } +// Comment Banner +// @Summary Comment Banner +// @Description API for comment Banner (only admin) +// @Tags Banners +// @Security BearerAuth +// @Param id path int true "Banner ID" +// @Param body body request.CommentRequest true "Comment payload" +// @Success 200 {object} response.Response +// @Router /promotions/{id}/comment [put] +func (_i *promotionsController) Comment(c *fiber.Ctx) error { + id, err := strconv.ParseUint(c.Params("id"), 10, 0) + if err != nil { + return err + } + + authToken := c.Get("Authorization") + if authToken == "" { + return utilRes.Resp(c, utilRes.Response{ + Success: false, + Messages: utilRes.Messages{"Unauthorized"}, + }) + } + + var req request.CommentRequest + if err := c.BodyParser(&req); err != nil { + return utilRes.Resp(c, utilRes.Response{ + Success: false, + Messages: utilRes.Messages{"Invalid request"}, + }) + } + + bannerData, err := _i.promotionsService.Comment(uint(id), authToken, &req.Message) + if err != nil { + return err + } + + return utilRes.Resp(c, utilRes.Response{ + Success: true, + Messages: utilRes.Messages{"Komentar berhasil disimpan"}, + Data: bannerData, + }) +} + // Viewer Promotion // @Summary Viewer Promotion // @Description API for viewing Promotion file diff --git a/app/module/promotions/promotions.module.go b/app/module/promotions/promotions.module.go index d2f3a5c..c1f1753 100644 --- a/app/module/promotions/promotions.module.go +++ b/app/module/promotions/promotions.module.go @@ -52,6 +52,7 @@ func (_i *PromotionsRouter) RegisterPromotionsRoutes() { router.Put("/:id", promotionsController.Update) router.Put("/:id/approve", promotionsController.Approve) router.Put("/:id/reject", promotionsController.Reject) + router.Put("/:id/comment", promotionsController.Comment) router.Delete("/:id", promotionsController.Delete) }) } diff --git a/app/module/promotions/request/promotions.request.go b/app/module/promotions/request/promotions.request.go index 063f898..478bb95 100644 --- a/app/module/promotions/request/promotions.request.go +++ b/app/module/promotions/request/promotions.request.go @@ -14,6 +14,10 @@ type PromotionsQueryRequestContext struct { Title string `json:"title"` } +type CommentRequest struct { + Message string `json:"message"` +} + func (req PromotionsQueryRequestContext) ToParamRequest() PromotionsQueryRequest { var request PromotionsQueryRequest diff --git a/app/module/promotions/service/promotions.service.go b/app/module/promotions/service/promotions.service.go index 7d2a787..5a67c98 100644 --- a/app/module/promotions/service/promotions.service.go +++ b/app/module/promotions/service/promotions.service.go @@ -44,6 +44,7 @@ type PromotionsService interface { Delete(id uint) (err error) Approve(id uint, authToken string) (promotion *response.PromotionsResponse, err error) Reject(id uint, authToken string, message *string) (promotion *response.PromotionsResponse, err error) + Comment(id uint, authToken string, message *string) (product *response.PromotionsResponse, err error) UploadFileToMinio(c *fiber.Ctx, fileKey string) (filePath *string, err error) Viewer(c *fiber.Ctx) (err error) } @@ -380,3 +381,50 @@ func (_i *promotionsService) Reject(id uint, authToken string, message *string) promotion = mapper.PromotionsResponseMapper(promotionEntity, host) return } + +func (_i *promotionsService) Comment( + id uint, + authToken string, + message *string, +) (banner *response.PromotionsResponse, err error) { + + user := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) + if user == nil { + err = errors.New("unauthorized") + return + } + + if user.UserRoleId != 1 { + err = errors.New("only admin can comment") + return + } + + // SIMPAN COMMENT KE HISTORY (INTI FITURNYA) + userID := user.ID + err = _i.ApprovalHistoriesService.CreateHistory( + "banners", + id, + nil, // status_id NULL + "comment", + &userID, + message, + ) + if err != nil { + return + } + + // Ambil banner terbaru + bannerEntity, err := _i.Repo.FindOne(id) + if err != nil { + return + } + + if bannerEntity == nil { + err = errors.New("banner not found") + return + } + + host := _i.Cfg.App.Domain + banner = mapper.PromotionsResponseMapper(bannerEntity, host) + return +} diff --git a/app/module/sales_agents/controller/sales_agents.controller.go b/app/module/sales_agents/controller/sales_agents.controller.go index 4d67707..fc12671 100644 --- a/app/module/sales_agents/controller/sales_agents.controller.go +++ b/app/module/sales_agents/controller/sales_agents.controller.go @@ -24,6 +24,7 @@ type SalesAgentsController interface { Delete(c *fiber.Ctx) error Approve(c *fiber.Ctx) error Reject(c *fiber.Ctx) error + Comment(c *fiber.Ctx) error Viewer(c *fiber.Ctx) error } @@ -369,6 +370,49 @@ func (_i *salesAgentsController) Reject(c *fiber.Ctx) error { }) } +// Comment Banner +// @Summary Comment Banner +// @Description API for comment Banner (only admin) +// @Tags Banners +// @Security BearerAuth +// @Param id path int true "Banner ID" +// @Param body body request.CommentRequest true "Comment payload" +// @Success 200 {object} response.Response +// @Router /sales-agents/{id}/comment [put] +func (_i *salesAgentsController) Comment(c *fiber.Ctx) error { + id, err := strconv.ParseUint(c.Params("id"), 10, 0) + if err != nil { + return err + } + + authToken := c.Get("Authorization") + if authToken == "" { + return utilRes.Resp(c, utilRes.Response{ + Success: false, + Messages: utilRes.Messages{"Unauthorized"}, + }) + } + + var req request.CommentRequest + if err := c.BodyParser(&req); err != nil { + return utilRes.Resp(c, utilRes.Response{ + Success: false, + Messages: utilRes.Messages{"Invalid request"}, + }) + } + + bannerData, err := _i.salesAgentsService.Comment(uint(id), authToken, &req.Message) + if err != nil { + return err + } + + return utilRes.Resp(c, utilRes.Response{ + Success: true, + Messages: utilRes.Messages{"Komentar berhasil disimpan"}, + Data: bannerData, + }) +} + // Viewer SalesAgent // @Summary Viewer SalesAgent // @Description API for viewing SalesAgent profile picture file diff --git a/app/module/sales_agents/request/sales_agents.request.go b/app/module/sales_agents/request/sales_agents.request.go index 8381e86..4770fd4 100644 --- a/app/module/sales_agents/request/sales_agents.request.go +++ b/app/module/sales_agents/request/sales_agents.request.go @@ -19,6 +19,10 @@ type SalesAgentsQueryRequestContext struct { AgentType string `json:"agent_type"` } +type CommentRequest struct { + Message string `json:"message"` +} + func (req SalesAgentsQueryRequestContext) ToParamRequest() SalesAgentsQueryRequest { var request SalesAgentsQueryRequest diff --git a/app/module/sales_agents/sales_agents.module.go b/app/module/sales_agents/sales_agents.module.go index 35efc36..16e771a 100644 --- a/app/module/sales_agents/sales_agents.module.go +++ b/app/module/sales_agents/sales_agents.module.go @@ -52,6 +52,7 @@ func (_i *SalesAgentsRouter) RegisterSalesAgentsRoutes() { router.Put("/:id", salesAgentsController.Update) router.Put("/:id/approve", salesAgentsController.Approve) router.Put("/:id/reject", salesAgentsController.Reject) + router.Put("/:id/comment", salesAgentsController.Comment) router.Delete("/:id", salesAgentsController.Delete) }) } diff --git a/app/module/sales_agents/service/sales_agents.service.go b/app/module/sales_agents/service/sales_agents.service.go index 6c732c1..8bc91ce 100644 --- a/app/module/sales_agents/service/sales_agents.service.go +++ b/app/module/sales_agents/service/sales_agents.service.go @@ -44,6 +44,7 @@ type SalesAgentsService interface { Delete(id uint) (err error) Approve(id uint, authToken string) (agent *response.SalesAgentsResponse, err error) Reject(id uint, authToken string, message *string) (agent *response.SalesAgentsResponse, err error) + Comment(id uint, authToken string, message *string) (product *response.SalesAgentsResponse, err error) UploadFileToMinio(c *fiber.Ctx, fileKey string) (filePath *string, err error) Viewer(c *fiber.Ctx) (err error) } @@ -385,3 +386,50 @@ func (_i *salesAgentsService) Reject(id uint, authToken string, message *string) agent = mapper.SalesAgentsResponseMapper(agentEntity, host) return } + +func (_i *salesAgentsService) Comment( + id uint, + authToken string, + message *string, +) (banner *response.SalesAgentsResponse, err error) { + + user := utilSvc.GetUserInfo(_i.Log, _i.UsersRepo, authToken) + if user == nil { + err = errors.New("unauthorized") + return + } + + if user.UserRoleId != 1 { + err = errors.New("only admin can comment") + return + } + + // SIMPAN COMMENT KE HISTORY (INTI FITURNYA) + userID := user.ID + err = _i.ApprovalHistoriesService.CreateHistory( + "banners", + id, + nil, // status_id NULL + "comment", + &userID, + message, + ) + if err != nil { + return + } + + // Ambil banner terbaru + bannerEntity, err := _i.Repo.FindOne(id) + if err != nil { + return + } + + if bannerEntity == nil { + err = errors.New("banner not found") + return + } + + host := _i.Cfg.App.Domain + banner = mapper.SalesAgentsResponseMapper(bannerEntity, host) + return +} diff --git a/docs/docs.go b/docs/docs.go index e0059cc..174d3fd 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -3937,22 +3937,15 @@ const docTemplate = `{ "put": { "security": [ { - "Bearer": [] + "BearerAuth": [] } ], - "description": "API for comment Banner (only for admin with roleId = 1)", + "description": "API for comment Banner (only admin)", "tags": [ "Banners" ], "summary": "Comment Banner", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header", - "required": true - }, { "type": "integer", "description": "Banner ID", @@ -3961,11 +3954,12 @@ const docTemplate = `{ "required": true }, { - "description": "Comment message", - "name": "message", + "description": "Comment payload", + "name": "body", "in": "body", + "required": true, "schema": { - "type": "string" + "$ref": "#/definitions/jaecoo-be_app_module_banners_request.CommentRequest" } } ], @@ -3975,24 +3969,6 @@ const docTemplate = `{ "schema": { "$ref": "#/definitions/response.Response" } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } } } } @@ -6666,6 +6642,46 @@ const docTemplate = `{ } } }, + "/galleries/{id}/comment": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "API for comment Banner (only admin)", + "tags": [ + "Banners" + ], + "summary": "Comment Banner", + "parameters": [ + { + "type": "integer", + "description": "Banner ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Comment payload", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/jaecoo-be_app_module_galleries_request.CommentRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, "/galleries/{id}/reject": { "put": { "security": [ @@ -8028,6 +8044,46 @@ const docTemplate = `{ } } }, + "/products/{id}/comment": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "API for comment Banner (only admin)", + "tags": [ + "Banners" + ], + "summary": "Comment Banner", + "parameters": [ + { + "type": "integer", + "description": "Banner ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Comment payload", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/jaecoo-be_app_module_products_request.CommentRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, "/products/{id}/reject": { "put": { "security": [ @@ -8537,6 +8593,46 @@ const docTemplate = `{ } } }, + "/promotions/{id}/comment": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "API for comment Banner (only admin)", + "tags": [ + "Banners" + ], + "summary": "Comment Banner", + "parameters": [ + { + "type": "integer", + "description": "Banner ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Comment payload", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/jaecoo-be_app_module_promotions_request.CommentRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, "/promotions/{id}/reject": { "put": { "security": [ @@ -9346,6 +9442,46 @@ const docTemplate = `{ } } }, + "/sales-agents/{id}/comment": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "API for comment Banner (only admin)", + "tags": [ + "Banners" + ], + "summary": "Comment Banner", + "parameters": [ + { + "type": "integer", + "description": "Banner ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Comment payload", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/jaecoo-be_app_module_sales_agents_request.CommentRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, "/sales-agents/{id}/reject": { "put": { "security": [ @@ -11751,6 +11887,46 @@ const docTemplate = `{ } }, "definitions": { + "jaecoo-be_app_module_banners_request.CommentRequest": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + }, + "jaecoo-be_app_module_galleries_request.CommentRequest": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + }, + "jaecoo-be_app_module_products_request.CommentRequest": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + }, + "jaecoo-be_app_module_promotions_request.CommentRequest": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + }, + "jaecoo-be_app_module_sales_agents_request.CommentRequest": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + }, "paginator.Pagination": { "type": "object", "properties": { diff --git a/docs/swagger.json b/docs/swagger.json index 2cb00a9..e25d956 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -3926,22 +3926,15 @@ "put": { "security": [ { - "Bearer": [] + "BearerAuth": [] } ], - "description": "API for comment Banner (only for admin with roleId = 1)", + "description": "API for comment Banner (only admin)", "tags": [ "Banners" ], "summary": "Comment Banner", "parameters": [ - { - "type": "string", - "description": "Insert the X-Client-Key", - "name": "X-Client-Key", - "in": "header", - "required": true - }, { "type": "integer", "description": "Banner ID", @@ -3950,11 +3943,12 @@ "required": true }, { - "description": "Comment message", - "name": "message", + "description": "Comment payload", + "name": "body", "in": "body", + "required": true, "schema": { - "type": "string" + "$ref": "#/definitions/jaecoo-be_app_module_banners_request.CommentRequest" } } ], @@ -3964,24 +3958,6 @@ "schema": { "$ref": "#/definitions/response.Response" } - }, - "400": { - "description": "Bad Request", - "schema": { - "$ref": "#/definitions/response.BadRequestError" - } - }, - "401": { - "description": "Unauthorized", - "schema": { - "$ref": "#/definitions/response.UnauthorizedError" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/response.InternalServerError" - } } } } @@ -6655,6 +6631,46 @@ } } }, + "/galleries/{id}/comment": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "API for comment Banner (only admin)", + "tags": [ + "Banners" + ], + "summary": "Comment Banner", + "parameters": [ + { + "type": "integer", + "description": "Banner ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Comment payload", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/jaecoo-be_app_module_galleries_request.CommentRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, "/galleries/{id}/reject": { "put": { "security": [ @@ -8017,6 +8033,46 @@ } } }, + "/products/{id}/comment": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "API for comment Banner (only admin)", + "tags": [ + "Banners" + ], + "summary": "Comment Banner", + "parameters": [ + { + "type": "integer", + "description": "Banner ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Comment payload", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/jaecoo-be_app_module_products_request.CommentRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, "/products/{id}/reject": { "put": { "security": [ @@ -8526,6 +8582,46 @@ } } }, + "/promotions/{id}/comment": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "API for comment Banner (only admin)", + "tags": [ + "Banners" + ], + "summary": "Comment Banner", + "parameters": [ + { + "type": "integer", + "description": "Banner ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Comment payload", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/jaecoo-be_app_module_promotions_request.CommentRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, "/promotions/{id}/reject": { "put": { "security": [ @@ -9335,6 +9431,46 @@ } } }, + "/sales-agents/{id}/comment": { + "put": { + "security": [ + { + "BearerAuth": [] + } + ], + "description": "API for comment Banner (only admin)", + "tags": [ + "Banners" + ], + "summary": "Comment Banner", + "parameters": [ + { + "type": "integer", + "description": "Banner ID", + "name": "id", + "in": "path", + "required": true + }, + { + "description": "Comment payload", + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/jaecoo-be_app_module_sales_agents_request.CommentRequest" + } + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + } + } + } + }, "/sales-agents/{id}/reject": { "put": { "security": [ @@ -11740,6 +11876,46 @@ } }, "definitions": { + "jaecoo-be_app_module_banners_request.CommentRequest": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + }, + "jaecoo-be_app_module_galleries_request.CommentRequest": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + }, + "jaecoo-be_app_module_products_request.CommentRequest": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + }, + "jaecoo-be_app_module_promotions_request.CommentRequest": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + }, + "jaecoo-be_app_module_sales_agents_request.CommentRequest": { + "type": "object", + "properties": { + "message": { + "type": "string" + } + } + }, "paginator.Pagination": { "type": "object", "properties": { diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 8bcd6d0..9ed7fda 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1,4 +1,29 @@ definitions: + jaecoo-be_app_module_banners_request.CommentRequest: + properties: + message: + type: string + type: object + jaecoo-be_app_module_galleries_request.CommentRequest: + properties: + message: + type: string + type: object + jaecoo-be_app_module_products_request.CommentRequest: + properties: + message: + type: string + type: object + jaecoo-be_app_module_promotions_request.CommentRequest: + properties: + message: + type: string + type: object + jaecoo-be_app_module_sales_agents_request.CommentRequest: + properties: + message: + type: string + type: object paginator.Pagination: properties: count: @@ -3356,42 +3381,26 @@ paths: - Banners /banners/{id}/comment: put: - description: API for comment Banner (only for admin with roleId = 1) + description: API for comment Banner (only admin) parameters: - - description: Insert the X-Client-Key - in: header - name: X-Client-Key - required: true - type: string - description: Banner ID in: path name: id required: true type: integer - - description: Comment message + - description: Comment payload in: body - name: message + name: body + required: true schema: - type: string + $ref: '#/definitions/jaecoo-be_app_module_banners_request.CommentRequest' responses: "200": description: OK schema: $ref: '#/definitions/response.Response' - "400": - description: Bad Request - schema: - $ref: '#/definitions/response.BadRequestError' - "401": - description: Unauthorized - schema: - $ref: '#/definitions/response.UnauthorizedError' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/response.InternalServerError' security: - - Bearer: [] + - BearerAuth: [] summary: Comment Banner tags: - Banners @@ -5131,6 +5140,31 @@ paths: summary: Approve Gallery tags: - Galleries + /galleries/{id}/comment: + put: + description: API for comment Banner (only admin) + parameters: + - description: Banner ID + in: path + name: id + required: true + type: integer + - description: Comment payload + in: body + name: body + required: true + schema: + $ref: '#/definitions/jaecoo-be_app_module_galleries_request.CommentRequest' + responses: + "200": + description: OK + schema: + $ref: '#/definitions/response.Response' + security: + - BearerAuth: [] + summary: Comment Banner + tags: + - Banners /galleries/{id}/reject: put: description: API for rejecting Gallery (only for admin with roleId = 1) @@ -5968,6 +6002,31 @@ paths: summary: Approve Product tags: - Products + /products/{id}/comment: + put: + description: API for comment Banner (only admin) + parameters: + - description: Banner ID + in: path + name: id + required: true + type: integer + - description: Comment payload + in: body + name: body + required: true + schema: + $ref: '#/definitions/jaecoo-be_app_module_products_request.CommentRequest' + responses: + "200": + description: OK + schema: + $ref: '#/definitions/response.Response' + security: + - BearerAuth: [] + summary: Comment Banner + tags: + - Banners /products/{id}/reject: put: description: API for rejecting Product (only for admin with roleId = 1) @@ -6294,6 +6353,31 @@ paths: summary: Approve Promotion tags: - Promotions + /promotions/{id}/comment: + put: + description: API for comment Banner (only admin) + parameters: + - description: Banner ID + in: path + name: id + required: true + type: integer + - description: Comment payload + in: body + name: body + required: true + schema: + $ref: '#/definitions/jaecoo-be_app_module_promotions_request.CommentRequest' + responses: + "200": + description: OK + schema: + $ref: '#/definitions/response.Response' + security: + - BearerAuth: [] + summary: Comment Banner + tags: + - Banners /promotions/{id}/reject: put: description: API for rejecting Promotion (only for admin with roleId = 1) @@ -6812,6 +6896,31 @@ paths: summary: Approve SalesAgent tags: - SalesAgents + /sales-agents/{id}/comment: + put: + description: API for comment Banner (only admin) + parameters: + - description: Banner ID + in: path + name: id + required: true + type: integer + - description: Comment payload + in: body + name: body + required: true + schema: + $ref: '#/definitions/jaecoo-be_app_module_sales_agents_request.CommentRequest' + responses: + "200": + description: OK + schema: + $ref: '#/definitions/response.Response' + security: + - BearerAuth: [] + summary: Comment Banner + tags: + - Banners /sales-agents/{id}/reject: put: description: API for rejecting SalesAgent (only for admin with roleId = 1) diff --git a/docs/swagger/docs.go b/docs/swagger/docs.go index 516794e..c8ffe42 100644 --- a/docs/swagger/docs.go +++ b/docs/swagger/docs.go @@ -6376,6 +6376,62 @@ const docTemplate = `{ } } } + }, + "/galleries/{id}/comment": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for comment Galleries (only for admin with roleId = 1)", + "tags": [ + "Galleries" + ], + "summary": "Comment Galleries", + "parameters": [ + { + "type": "string", + "description": "Insert the X-Client-Key", + "name": "X-Client-Key", + "in": "header", + "required": true + }, + { + "type": "integer", + "description": "Galleries ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + } }, "/gallery-files": { "get": { @@ -7333,7 +7389,13 @@ const docTemplate = `{ "description": "Product colors (JSON array)", "name": "colors", "in": "formData" - } + }, + { + "type": "file", + "description": "Color images (multiple files)", + "name": "color_images[]", + "in": "formData" + }, ], "responses": { "200": { @@ -7675,6 +7737,62 @@ const docTemplate = `{ } } }, + "/products/{id}/comment": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for comment Product (only for admin with roleId = 1)", + "tags": [ + "Products" + ], + "summary": "Comment Product", + "parameters": [ + { + "type": "string", + "description": "Insert the X-Client-Key", + "name": "X-Client-Key", + "in": "header", + "required": true + }, + { + "type": "integer", + "description": "Product ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + } + }, "/promotions": { "get": { "security": [ @@ -8119,6 +8237,62 @@ const docTemplate = `{ } } } + }, + "/promotions/{id}/comment": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for comment Promotions (only for admin with roleId = 1)", + "tags": [ + "Promotions" + ], + "summary": "Comment Promotions", + "parameters": [ + { + "type": "string", + "description": "Insert the X-Client-Key", + "name": "X-Client-Key", + "in": "header", + "required": true + }, + { + "type": "integer", + "description": "Promotions ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + } }, "/provinces": { "get": { @@ -8864,6 +9038,62 @@ const docTemplate = `{ } } } + }, + "/sales-agents/{id}/comment": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for comment SalesAgents (only for admin with roleId = 1)", + "tags": [ + "SalesAgents" + ], + "summary": "Comment SalesAgents", + "parameters": [ + { + "type": "string", + "description": "Insert the X-Client-Key", + "name": "X-Client-Key", + "in": "header", + "required": true + }, + { + "type": "integer", + "description": "SalesAgents ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + } }, "/user-levels": { "get": { diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index 5dd6ad3..c996505 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -6150,6 +6150,60 @@ } } }, + "/galleries/{id}/comment": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for comment Galleries (only for admin with roleId = 1)", + "tags": ["Galleries"], + "summary": "Comment Galleries", + "parameters": [ + { + "type": "string", + "description": "Insert the X-Client-Key", + "name": "X-Client-Key", + "in": "header", + "required": true + }, + { + "type": "integer", + "description": "Galleries ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + } + }, "/gallery-files": { "get": { "security": [ @@ -7075,9 +7129,15 @@ }, { "type": "string", - "description": "Product colors (JSON array)", "name": "colors", - "in": "formData" + "in": "formData", + "description": "JSON array of colors. Example: [{\"name\":\"Silver\"},{\"name\":\"#E2E2E2\"}]" + }, + { + "type": "file", + "name": "color_images[]", + "in": "formData", + "description": "Color images (multiple files)" } ], "responses": { @@ -7410,6 +7470,60 @@ } } }, + "/products/{id}/comment": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for comment Product (only for admin with roleId = 1)", + "tags": ["Products"], + "summary": "Comment Product", + "parameters": [ + { + "type": "string", + "description": "Insert the X-Client-Key", + "name": "X-Client-Key", + "in": "header", + "required": true + }, + { + "type": "integer", + "description": "Products ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + } + }, "/promotions": { "get": { "security": [ @@ -7841,6 +7955,60 @@ } } }, + "/promotions/{id}/comment": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for comment Promotions (only for admin with roleId = 1)", + "tags": ["Promotions"], + "summary": "Comment Promotions", + "parameters": [ + { + "type": "string", + "description": "Insert the X-Client-Key", + "name": "X-Client-Key", + "in": "header", + "required": true + }, + { + "type": "integer", + "description": "Promotions ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + } + }, "/provinces": { "get": { "security": [ @@ -8562,6 +8730,60 @@ } } }, + "/sales-agents/{id}/comment": { + "put": { + "security": [ + { + "Bearer": [] + } + ], + "description": "API for comment SalesAgents (only for admin with roleId = 1)", + "tags": ["SalesAgents"], + "summary": "Comment SalesAgents", + "parameters": [ + { + "type": "string", + "description": "Insert the X-Client-Key", + "name": "X-Client-Key", + "in": "header", + "required": true + }, + { + "type": "integer", + "description": "SalesAgents ID", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/response.Response" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/response.BadRequestError" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/response.UnauthorizedError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/response.InternalServerError" + } + } + } + } + }, "/user-levels": { "get": { "security": [ diff --git a/docs/swagger/swagger.yaml b/docs/swagger/swagger.yaml index 512d137..369d94f 100644 --- a/docs/swagger/swagger.yaml +++ b/docs/swagger/swagger.yaml @@ -4951,6 +4951,42 @@ paths: summary: Approve Gallery tags: - Galleries + /galleries/{id}/comment: + put: + description: API for comment Galleries (only for admin with roleId = 1) + parameters: + - description: Insert the X-Client-Key + in: header + name: X-Client-Key + required: true + type: string + - description: Galleries ID + in: path + name: id + required: true + type: integer + responses: + "200": + description: OK + schema: + $ref: "#/definitions/response.Response" + "400": + description: Bad Request + schema: + $ref: "#/definitions/response.BadRequestError" + "401": + description: Unauthorized + schema: + $ref: "#/definitions/response.UnauthorizedError" + "500": + description: Internal Server Error + schema: + $ref: "#/definitions/response.InternalServerError" + security: + - Bearer: [] + summary: Comment Galleries + tags: + - Galleries /gallery-files: get: description: API for getting all GalleryFiles @@ -5559,6 +5595,7 @@ paths: in: formData name: colors type: string + responses: "200": description: OK @@ -5747,6 +5784,42 @@ paths: summary: Approve Product tags: - Products + /products/{id}/comment: + put: + description: API for comment Product (only for admin with roleId = 1) + parameters: + - description: Insert the X-Client-Key + in: header + name: X-Client-Key + required: true + type: string + - description: Product ID + in: path + name: id + required: true + type: integer + responses: + "200": + description: OK + schema: + $ref: "#/definitions/response.Response" + "400": + description: Bad Request + schema: + $ref: "#/definitions/response.BadRequestError" + "401": + description: Unauthorized + schema: + $ref: "#/definitions/response.UnauthorizedError" + "500": + description: Internal Server Error + schema: + $ref: "#/definitions/response.InternalServerError" + security: + - Bearer: [] + summary: Comment Product + tags: + - Products /products/viewer/{filename}: get: description: API for viewing Product file @@ -6032,6 +6105,42 @@ paths: summary: Approve Promotion tags: - Promotions + /promotions/{id}/comment: + put: + description: API for comment Promotions (only for admin with roleId = 1) + parameters: + - description: Insert the X-Client-Key + in: header + name: X-Client-Key + required: true + type: string + - description: Promotions ID + in: path + name: id + required: true + type: integer + responses: + "200": + description: OK + schema: + $ref: "#/definitions/response.Response" + "400": + description: Bad Request + schema: + $ref: "#/definitions/response.BadRequestError" + "401": + description: Unauthorized + schema: + $ref: "#/definitions/response.UnauthorizedError" + "500": + description: Internal Server Error + schema: + $ref: "#/definitions/response.InternalServerError" + security: + - Bearer: [] + summary: Comment Promotions + tags: + - Promotions /promotions/viewer/{filename}: get: description: API for viewing Promotion file @@ -6545,6 +6654,42 @@ paths: summary: Viewer SalesAgent tags: - SalesAgents + /sales-agents/{id}/comment: + put: + description: API for comment SalesAgents (only for admin with roleId = 1) + parameters: + - description: Insert the X-Client-Key + in: header + name: X-Client-Key + required: true + type: string + - description: SalesAgents ID + in: path + name: id + required: true + type: integer + responses: + "200": + description: OK + schema: + $ref: "#/definitions/response.Response" + "400": + description: Bad Request + schema: + $ref: "#/definitions/response.BadRequestError" + "401": + description: Unauthorized + schema: + $ref: "#/definitions/response.UnauthorizedError" + "500": + description: Internal Server Error + schema: + $ref: "#/definitions/response.InternalServerError" + security: + - Bearer: [] + summary: Comment SalesAgents + tags: + - SalesAgents /user-levels: get: description: API for getting all UserLevels