feat:add api comment agent,promo,galeri,product

This commit is contained in:
Anang Yusman 2026-01-26 14:57:05 +08:00
parent 5a5ca9b713
commit a2cdb34bc3
22 changed files with 1591 additions and 103 deletions

View File

@ -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,
})
}

View File

@ -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)
})
}

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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)
})
}

View File

@ -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"`
}

View File

@ -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
}

View File

@ -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

View File

@ -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)
})
}

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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)
})
}

View File

@ -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
}

View File

@ -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": {

View File

@ -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": {

View File

@ -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)

View File

@ -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": {

View File

@ -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": [

View File

@ -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