update:api banner comment

This commit is contained in:
Anang Yusman 2026-01-26 00:50:49 +08:00
parent 40d762f838
commit 5a5ca9b713
20 changed files with 18326 additions and 16120 deletions

View File

@ -9,7 +9,7 @@ type ApprovalHistories struct {
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
ModuleType string `json:"module_type" gorm:"type:varchar"` // e.g., "banners", "galleries", "products", "sales_agents", "promotions"
ModuleId uint `json:"module_id" gorm:"type:int4"` // ID of the record in the respective module table
StatusId int `json:"status_id" gorm:"type:int4"` // 1: pending, 2: approved, 3: rejected
StatusId *int `json:"status_id" gorm:"type:int4"` // StatusId nullable, karena action "comment" tidak mengubah status // 1: pending, 2: approved, 3: rejected
Action string `json:"action" gorm:"type:varchar"` // "approve" or "reject"
ApprovedBy *uint `json:"approved_by" gorm:"type:int4"` // User ID who performed the action
Message *string `json:"message" gorm:"type:text"` // Optional message/reason

View File

@ -17,7 +17,7 @@ type ApprovalHistoriesQueryRequest struct {
type ApprovalHistoriesCreateRequest struct {
ModuleType string `json:"module_type" validate:"required"`
ModuleId uint `json:"module_id" validate:"required"`
StatusId int `json:"status_id" validate:"required"`
StatusId *int `json:"status_id" validate:"required"`
Action string `json:"action" validate:"required"`
ApprovedBy *uint `json:"approved_by"`
Message *string `json:"message"`

View File

@ -6,7 +6,7 @@ type ApprovalHistoriesResponse struct {
ID uint `json:"id"`
ModuleType string `json:"module_type"`
ModuleId uint `json:"module_id"`
StatusId int `json:"status_id"`
StatusId *int `json:"status_id"`
Action string `json:"action"`
ApprovedBy *uint `json:"approved_by"`
Message *string `json:"message"`

View File

@ -19,7 +19,7 @@ type approvalHistoriesService struct {
type ApprovalHistoriesService interface {
GetAll(req request.ApprovalHistoriesQueryRequest) (histories []*response.ApprovalHistoriesResponse, paging paginator.Pagination, err error)
GetByModule(moduleType string, moduleId uint) (histories []*response.ApprovalHistoriesResponse, err error)
CreateHistory(moduleType string, moduleId uint, statusId int, action string, approvedBy *uint, message *string) (err error)
CreateHistory(moduleType string, moduleId uint, statusId *int, action string, approvedBy *uint, message *string) (err error)
}
func NewApprovalHistoriesService(repo repository.ApprovalHistoriesRepository, log zerolog.Logger) ApprovalHistoriesService {
@ -55,7 +55,7 @@ func (_i *approvalHistoriesService) GetByModule(moduleType string, moduleId uint
return
}
func (_i *approvalHistoriesService) CreateHistory(moduleType string, moduleId uint, statusId int, action string, approvedBy *uint, message *string) (err error) {
func (_i *approvalHistoriesService) CreateHistory(moduleType string, moduleId uint, statusId *int, action string, approvedBy *uint, message *string) (err error) {
history := &entity.ApprovalHistories{
ModuleType: moduleType,
ModuleId: moduleId,

View File

@ -52,6 +52,7 @@ func (_i *BannersRouter) RegisterBannersRoutes() {
router.Put("/:id", bannersController.Update)
router.Put("/:id/approve", bannersController.Approve)
router.Put("/:id/reject", bannersController.Reject)
router.Put("/:id/comment", bannersController.Comment)
router.Delete("/:id", bannersController.Delete)
})
}

View File

@ -15,6 +15,7 @@ type bannersController struct {
bannersService service.BannersService
}
type BannersController interface {
All(c *fiber.Ctx) error
Show(c *fiber.Ctx) error
@ -23,6 +24,7 @@ type BannersController 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
}
@ -361,6 +363,49 @@ func (_i *bannersController) 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 /banners/{id}/comment [put]
func (_i *bannersController) 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.bannersService.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 Banner
// @Summary Viewer Banner
// @Description API for viewing Banner file

View File

@ -6,6 +6,8 @@ type Controller struct {
Banners BannersController
}
func NewController(BannersService service.BannersService) *Controller {
return &Controller{
Banners: NewBannersController(BannersService),

View File

@ -24,6 +24,7 @@ type BannersRepository interface {
FindByThumbnailPath(thumbnailPath string) (banner *entity.Banners, err error)
Approve(id uint) (err error)
Reject(id uint) (err error)
}
func NewBannersRepository(db *database.Database, log zerolog.Logger) BannersRepository {
@ -111,3 +112,4 @@ func (_i *bannersRepository) Reject(id uint) (err error) {
err = _i.DB.DB.Model(&entity.Banners{}).Where("id = ?", id).Update("status_id", statusId).Error
return
}

View File

@ -72,6 +72,11 @@ func (req BannersUpdateRequest) ToEntity() *entity.Banners {
}
}
type CommentRequest struct {
Message string `json:"message"`
}
func getStringValue(s *string) string {
if s == nil {
return ""

View File

@ -44,6 +44,7 @@ type BannersService interface {
Delete(id uint) (err error)
Approve(id uint, authToken string) (banner *response.BannersResponse, err error)
Reject(id uint, authToken string, message *string) (banner *response.BannersResponse, err error)
Comment(id uint, authToken string, message *string) (banner *response.BannersResponse, err error)
UploadFileToMinio(c *fiber.Ctx, fileKey string) (filePath *string, err error)
Viewer(c *fiber.Ctx) (err error)
}
@ -228,7 +229,16 @@ func (_i *bannersService) Approve(id uint, authToken string) (banner *response.B
// Save approval history
userID := user.ID
err = _i.ApprovalHistoriesService.CreateHistory("banners", id, 2, "approve", &userID, nil)
statusApprove := 2
err = _i.ApprovalHistoriesService.CreateHistory(
"banners",
id,
&statusApprove, // ✅ pointer
"approve",
&userID,
nil,
)
if err != nil {
_i.Log.Error().Err(err).Msg("Failed to save approval history")
// Don't return error, just log it
@ -272,7 +282,16 @@ func (_i *bannersService) Reject(id uint, authToken string, message *string) (ba
// Save rejection history
userID := user.ID
err = _i.ApprovalHistoriesService.CreateHistory("banners", id, 3, "reject", &userID, message)
statusReject := 3
err = _i.ApprovalHistoriesService.CreateHistory(
"banners",
id,
&statusReject, // ✅ pointer
"reject",
&userID,
message,
)
if err != nil {
_i.Log.Error().Err(err).Msg("Failed to save rejection history")
// Don't return error, just log it
@ -294,6 +313,54 @@ func (_i *bannersService) Reject(id uint, authToken string, message *string) (ba
return
}
func (_i *bannersService) Comment(
id uint,
authToken string,
message *string,
) (banner *response.BannersResponse, 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.BannersResponseMapper(bannerEntity, host)
return
}
func (_i *bannersService) Viewer(c *fiber.Ctx) (err error) {
filename := c.Params("filename")

View File

@ -137,7 +137,16 @@ func (_i *galleriesService) Approve(id uint, authToken string) (gallery *respons
// Save approval history
userID := user.ID
err = _i.ApprovalHistoriesService.CreateHistory("galleries", id, 2, "approve", &userID, nil)
statusApprove := 2
err = _i.ApprovalHistoriesService.CreateHistory(
"banners",
id,
&statusApprove, // ✅ pointer
"approve",
&userID,
nil,
)
if err != nil {
_i.Log.Error().Err(err).Msg("Failed to save approval history")
}
@ -180,7 +189,16 @@ func (_i *galleriesService) Reject(id uint, authToken string, message *string) (
// Save rejection history
userID := user.ID
err = _i.ApprovalHistoriesService.CreateHistory("galleries", id, 3, "reject", &userID, message)
statusReject := 3
err = _i.ApprovalHistoriesService.CreateHistory(
"banners",
id,
&statusReject, // ✅ pointer
"reject",
&userID,
message,
)
if err != nil {
_i.Log.Error().Err(err).Msg("Failed to save rejection history")
}

View File

@ -304,7 +304,16 @@ func (_i *productsService) Approve(id uint, authToken string) (product *response
// Save approval history
userID := user.ID
err = _i.ApprovalHistoriesService.CreateHistory("products", id, 2, "approve", &userID, nil)
statusApprove := 2
err = _i.ApprovalHistoriesService.CreateHistory(
"banners",
id,
&statusApprove, // ✅ pointer
"approve",
&userID,
nil,
)
if err != nil {
_i.Log.Error().Err(err).Msg("Failed to save approval history")
}
@ -347,7 +356,16 @@ func (_i *productsService) Reject(id uint, authToken string, message *string) (p
// Save rejection history
userID := user.ID
err = _i.ApprovalHistoriesService.CreateHistory("products", id, 3, "reject", &userID, message)
statusReject := 3
err = _i.ApprovalHistoriesService.CreateHistory(
"banners",
id,
&statusReject, // ✅ pointer
"reject",
&userID,
message,
)
if err != nil {
_i.Log.Error().Err(err).Msg("Failed to save rejection history")
}

View File

@ -299,7 +299,16 @@ func (_i *promotionsService) Approve(id uint, authToken string) (promotion *resp
// Save approval history
userID := user.ID
err = _i.ApprovalHistoriesService.CreateHistory("promotions", id, 2, "approve", &userID, nil)
statusApprove := 2
err = _i.ApprovalHistoriesService.CreateHistory(
"banners",
id,
&statusApprove, // ✅ pointer
"approve",
&userID,
nil,
)
if err != nil {
_i.Log.Error().Err(err).Msg("Failed to save approval history")
}
@ -342,7 +351,16 @@ func (_i *promotionsService) Reject(id uint, authToken string, message *string)
// Save rejection history
userID := user.ID
err = _i.ApprovalHistoriesService.CreateHistory("promotions", id, 3, "reject", &userID, message)
statusReject := 3
err = _i.ApprovalHistoriesService.CreateHistory(
"banners",
id,
&statusReject, // ✅ pointer
"reject",
&userID,
message,
)
if err != nil {
_i.Log.Error().Err(err).Msg("Failed to save rejection history")
}

View File

@ -304,7 +304,16 @@ func (_i *salesAgentsService) Approve(id uint, authToken string) (agent *respons
// Save approval history
userID := user.ID
err = _i.ApprovalHistoriesService.CreateHistory("sales_agents", id, 2, "approve", &userID, nil)
statusApprove := 2
err = _i.ApprovalHistoriesService.CreateHistory(
"banners",
id,
&statusApprove, // ✅ pointer
"approve",
&userID,
nil,
)
if err != nil {
_i.Log.Error().Err(err).Msg("Failed to save approval history")
}
@ -347,7 +356,16 @@ func (_i *salesAgentsService) Reject(id uint, authToken string, message *string)
// Save rejection history
userID := user.ID
err = _i.ApprovalHistoriesService.CreateHistory("sales_agents", id, 3, "reject", &userID, message)
statusReject := 3
err = _i.ApprovalHistoriesService.CreateHistory(
"banners",
id,
&statusReject, // ✅ pointer
"reject",
&userID,
message,
)
if err != nil {
_i.Log.Error().Err(err).Msg("Failed to save rejection history")
}

View File

@ -388,6 +388,223 @@ const docTemplate = `{
}
}
},
"/approval-histories": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "API for getting all ApprovalHistories",
"tags": [
"ApprovalHistories"
],
"summary": "Get all ApprovalHistories",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "string",
"name": "action",
"in": "query"
},
{
"type": "integer",
"name": "approved_by",
"in": "query"
},
{
"type": "integer",
"name": "count",
"in": "query"
},
{
"type": "integer",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"name": "module_id",
"in": "query"
},
{
"type": "string",
"name": "module_type",
"in": "query"
},
{
"type": "integer",
"name": "nextPage",
"in": "query"
},
{
"type": "integer",
"name": "page",
"in": "query"
},
{
"type": "integer",
"name": "previousPage",
"in": "query"
},
{
"type": "string",
"name": "sort",
"in": "query"
},
{
"type": "string",
"name": "sortBy",
"in": "query"
},
{
"type": "integer",
"name": "status_id",
"in": "query"
},
{
"type": "integer",
"name": "totalPage",
"in": "query"
},
{
"type": "integer",
"name": "count",
"in": "query"
},
{
"type": "integer",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"name": "nextPage",
"in": "query"
},
{
"type": "integer",
"name": "page",
"in": "query"
},
{
"type": "integer",
"name": "previousPage",
"in": "query"
},
{
"type": "string",
"name": "sort",
"in": "query"
},
{
"type": "string",
"name": "sortBy",
"in": "query"
},
{
"type": "integer",
"name": "totalPage",
"in": "query"
}
],
"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"
}
}
}
}
},
"/approval-histories/{module_type}/{module_id}": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "API for getting approval history by module type and module id",
"tags": [
"ApprovalHistories"
],
"summary": "Get approval history by module",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Module Type (banners, galleries, products, sales_agents, promotions)",
"name": "module_type",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "Module ID",
"name": "module_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"
}
}
}
}
},
"/article-approvals": {
"get": {
"security": [
@ -3660,6 +3877,190 @@ const docTemplate = `{
}
}
},
"/banners/{id}/approve": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for approving Banner (only for admin with roleId = 1)",
"tags": [
"Banners"
],
"summary": "Approve Banner",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "Banner 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"
}
}
}
}
},
"/banners/{id}/comment": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for comment Banner (only for admin with roleId = 1)",
"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",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Comment message",
"name": "message",
"in": "body",
"schema": {
"type": "string"
}
}
],
"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"
}
}
}
}
},
"/banners/{id}/reject": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for rejecting Banner (only for admin with roleId = 1)",
"tags": [
"Banners"
],
"summary": "Reject Banner",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "Banner ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Rejection message",
"name": "message",
"in": "body",
"schema": {
"type": "string"
}
}
],
"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"
}
}
}
}
},
"/cities": {
"get": {
"security": [
@ -6209,6 +6610,126 @@ const docTemplate = `{
}
}
},
"/galleries/{id}/approve": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for approving Gallery (only for admin with roleId = 1)",
"tags": [
"Galleries"
],
"summary": "Approve Gallery",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "Gallery 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"
}
}
}
}
},
"/galleries/{id}/reject": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for rejecting Gallery (only for admin with roleId = 1)",
"tags": [
"Galleries"
],
"summary": "Reject Gallery",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "Gallery ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Rejection message",
"name": "message",
"in": "body",
"schema": {
"type": "string"
}
}
],
"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": [
@ -7451,6 +7972,126 @@ const docTemplate = `{
}
}
},
"/products/{id}/approve": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for approving Product (only for admin with roleId = 1)",
"tags": [
"Products"
],
"summary": "Approve 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"
}
}
}
}
},
"/products/{id}/reject": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for rejecting Product (only for admin with roleId = 1)",
"tags": [
"Products"
],
"summary": "Reject 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
},
{
"description": "Rejection message",
"name": "message",
"in": "body",
"schema": {
"type": "string"
}
}
],
"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": [
@ -7840,6 +8481,126 @@ const docTemplate = `{
}
}
},
"/promotions/{id}/approve": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for approving Promotion (only for admin with roleId = 1)",
"tags": [
"Promotions"
],
"summary": "Approve Promotion",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "Promotion 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/{id}/reject": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for rejecting Promotion (only for admin with roleId = 1)",
"tags": [
"Promotions"
],
"summary": "Reject Promotion",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "Promotion ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Rejection message",
"name": "message",
"in": "body",
"schema": {
"type": "string"
}
}
],
"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": [
@ -8529,6 +9290,126 @@ const docTemplate = `{
}
}
},
"/sales-agents/{id}/approve": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for approving SalesAgent (only for admin with roleId = 1)",
"tags": [
"SalesAgents"
],
"summary": "Approve SalesAgent",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "SalesAgent 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"
}
}
}
}
},
"/sales-agents/{id}/reject": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for rejecting SalesAgent (only for admin with roleId = 1)",
"tags": [
"SalesAgents"
],
"summary": "Reject SalesAgent",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "SalesAgent ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Rejection message",
"name": "message",
"in": "body",
"schema": {
"type": "string"
}
}
],
"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

@ -377,6 +377,223 @@
}
}
},
"/approval-histories": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "API for getting all ApprovalHistories",
"tags": [
"ApprovalHistories"
],
"summary": "Get all ApprovalHistories",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "string",
"name": "action",
"in": "query"
},
{
"type": "integer",
"name": "approved_by",
"in": "query"
},
{
"type": "integer",
"name": "count",
"in": "query"
},
{
"type": "integer",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"name": "module_id",
"in": "query"
},
{
"type": "string",
"name": "module_type",
"in": "query"
},
{
"type": "integer",
"name": "nextPage",
"in": "query"
},
{
"type": "integer",
"name": "page",
"in": "query"
},
{
"type": "integer",
"name": "previousPage",
"in": "query"
},
{
"type": "string",
"name": "sort",
"in": "query"
},
{
"type": "string",
"name": "sortBy",
"in": "query"
},
{
"type": "integer",
"name": "status_id",
"in": "query"
},
{
"type": "integer",
"name": "totalPage",
"in": "query"
},
{
"type": "integer",
"name": "count",
"in": "query"
},
{
"type": "integer",
"name": "limit",
"in": "query"
},
{
"type": "integer",
"name": "nextPage",
"in": "query"
},
{
"type": "integer",
"name": "page",
"in": "query"
},
{
"type": "integer",
"name": "previousPage",
"in": "query"
},
{
"type": "string",
"name": "sort",
"in": "query"
},
{
"type": "string",
"name": "sortBy",
"in": "query"
},
{
"type": "integer",
"name": "totalPage",
"in": "query"
}
],
"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"
}
}
}
}
},
"/approval-histories/{module_type}/{module_id}": {
"get": {
"security": [
{
"Bearer": []
}
],
"description": "API for getting approval history by module type and module id",
"tags": [
"ApprovalHistories"
],
"summary": "Get approval history by module",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "string",
"description": "Module Type (banners, galleries, products, sales_agents, promotions)",
"name": "module_type",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "Module ID",
"name": "module_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"
}
}
}
}
},
"/article-approvals": {
"get": {
"security": [
@ -3649,6 +3866,190 @@
}
}
},
"/banners/{id}/approve": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for approving Banner (only for admin with roleId = 1)",
"tags": [
"Banners"
],
"summary": "Approve Banner",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "Banner 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"
}
}
}
}
},
"/banners/{id}/comment": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for comment Banner (only for admin with roleId = 1)",
"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",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Comment message",
"name": "message",
"in": "body",
"schema": {
"type": "string"
}
}
],
"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"
}
}
}
}
},
"/banners/{id}/reject": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for rejecting Banner (only for admin with roleId = 1)",
"tags": [
"Banners"
],
"summary": "Reject Banner",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "Banner ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Rejection message",
"name": "message",
"in": "body",
"schema": {
"type": "string"
}
}
],
"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"
}
}
}
}
},
"/cities": {
"get": {
"security": [
@ -6198,6 +6599,126 @@
}
}
},
"/galleries/{id}/approve": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for approving Gallery (only for admin with roleId = 1)",
"tags": [
"Galleries"
],
"summary": "Approve Gallery",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "Gallery 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"
}
}
}
}
},
"/galleries/{id}/reject": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for rejecting Gallery (only for admin with roleId = 1)",
"tags": [
"Galleries"
],
"summary": "Reject Gallery",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "Gallery ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Rejection message",
"name": "message",
"in": "body",
"schema": {
"type": "string"
}
}
],
"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": [
@ -7440,6 +7961,126 @@
}
}
},
"/products/{id}/approve": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for approving Product (only for admin with roleId = 1)",
"tags": [
"Products"
],
"summary": "Approve 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"
}
}
}
}
},
"/products/{id}/reject": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for rejecting Product (only for admin with roleId = 1)",
"tags": [
"Products"
],
"summary": "Reject 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
},
{
"description": "Rejection message",
"name": "message",
"in": "body",
"schema": {
"type": "string"
}
}
],
"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": [
@ -7829,6 +8470,126 @@
}
}
},
"/promotions/{id}/approve": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for approving Promotion (only for admin with roleId = 1)",
"tags": [
"Promotions"
],
"summary": "Approve Promotion",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "Promotion 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/{id}/reject": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for rejecting Promotion (only for admin with roleId = 1)",
"tags": [
"Promotions"
],
"summary": "Reject Promotion",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "Promotion ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Rejection message",
"name": "message",
"in": "body",
"schema": {
"type": "string"
}
}
],
"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": [
@ -8518,6 +9279,126 @@
}
}
},
"/sales-agents/{id}/approve": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for approving SalesAgent (only for admin with roleId = 1)",
"tags": [
"SalesAgents"
],
"summary": "Approve SalesAgent",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "SalesAgent 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"
}
}
}
}
},
"/sales-agents/{id}/reject": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for rejecting SalesAgent (only for admin with roleId = 1)",
"tags": [
"SalesAgents"
],
"summary": "Reject SalesAgent",
"parameters": [
{
"type": "string",
"description": "Insert the X-Client-Key",
"name": "X-Client-Key",
"in": "header",
"required": true
},
{
"type": "integer",
"description": "SalesAgent ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Rejection message",
"name": "message",
"in": "body",
"schema": {
"type": "string"
}
}
],
"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

@ -1135,6 +1135,141 @@ paths:
summary: Get activity stats ActivityLogs
tags:
- ActivityLogs
/approval-histories:
get:
description: API for getting all ApprovalHistories
parameters:
- description: Insert the X-Client-Key
in: header
name: X-Client-Key
required: true
type: string
- in: query
name: action
type: string
- in: query
name: approved_by
type: integer
- in: query
name: count
type: integer
- in: query
name: limit
type: integer
- in: query
name: module_id
type: integer
- in: query
name: module_type
type: string
- in: query
name: nextPage
type: integer
- in: query
name: page
type: integer
- in: query
name: previousPage
type: integer
- in: query
name: sort
type: string
- in: query
name: sortBy
type: string
- in: query
name: status_id
type: integer
- in: query
name: totalPage
type: integer
- in: query
name: count
type: integer
- in: query
name: limit
type: integer
- in: query
name: nextPage
type: integer
- in: query
name: page
type: integer
- in: query
name: previousPage
type: integer
- in: query
name: sort
type: string
- in: query
name: sortBy
type: string
- in: query
name: totalPage
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: Get all ApprovalHistories
tags:
- ApprovalHistories
/approval-histories/{module_type}/{module_id}:
get:
description: API for getting approval history by module type and module id
parameters:
- description: Insert the X-Client-Key
in: header
name: X-Client-Key
required: true
type: string
- description: Module Type (banners, galleries, products, sales_agents, promotions)
in: path
name: module_type
required: true
type: string
- description: Module ID
in: path
name: module_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: Get approval history by module
tags:
- ApprovalHistories
/article-approvals:
get:
description: API for getting all ArticleApprovals
@ -3183,6 +3318,124 @@ paths:
summary: Update Banner
tags:
- Banners
/banners/{id}/approve:
put:
description: API for approving Banner (only for admin with roleId = 1)
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
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: Approve Banner
tags:
- Banners
/banners/{id}/comment:
put:
description: API for comment Banner (only for admin with roleId = 1)
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
in: body
name: message
schema:
type: string
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 Banner
tags:
- Banners
/banners/{id}/reject:
put:
description: API for rejecting Banner (only for admin with roleId = 1)
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: Rejection message
in: body
name: message
schema:
type: string
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: Reject Banner
tags:
- Banners
/banners/viewer/{filename}:
get:
description: API for viewing Banner file
@ -4842,6 +5095,83 @@ paths:
summary: Update Gallery
tags:
- Galleries
/galleries/{id}/approve:
put:
description: API for approving Gallery (only for admin with roleId = 1)
parameters:
- description: Insert the X-Client-Key
in: header
name: X-Client-Key
required: true
type: string
- description: Gallery 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: Approve Gallery
tags:
- Galleries
/galleries/{id}/reject:
put:
description: API for rejecting Gallery (only for admin with roleId = 1)
parameters:
- description: Insert the X-Client-Key
in: header
name: X-Client-Key
required: true
type: string
- description: Gallery ID
in: path
name: id
required: true
type: integer
- description: Rejection message
in: body
name: message
schema:
type: string
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: Reject Gallery
tags:
- Galleries
/gallery-files:
get:
description: API for getting all GalleryFiles
@ -5602,6 +5932,83 @@ paths:
summary: Update Product
tags:
- Products
/products/{id}/approve:
put:
description: API for approving 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: Approve Product
tags:
- Products
/products/{id}/reject:
put:
description: API for rejecting 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
- description: Rejection message
in: body
name: message
schema:
type: string
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: Reject Product
tags:
- Products
/products/viewer/{filename}:
get:
description: API for viewing Product file
@ -5851,6 +6258,83 @@ paths:
summary: Update Promotion
tags:
- Promotions
/promotions/{id}/approve:
put:
description: API for approving Promotion (only for admin with roleId = 1)
parameters:
- description: Insert the X-Client-Key
in: header
name: X-Client-Key
required: true
type: string
- description: Promotion 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: Approve Promotion
tags:
- Promotions
/promotions/{id}/reject:
put:
description: API for rejecting Promotion (only for admin with roleId = 1)
parameters:
- description: Insert the X-Client-Key
in: header
name: X-Client-Key
required: true
type: string
- description: Promotion ID
in: path
name: id
required: true
type: integer
- description: Rejection message
in: body
name: message
schema:
type: string
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: Reject Promotion
tags:
- Promotions
/promotions/viewer/{filename}:
get:
description: API for viewing Promotion file
@ -6292,6 +6776,83 @@ paths:
summary: Update SalesAgent
tags:
- SalesAgents
/sales-agents/{id}/approve:
put:
description: API for approving SalesAgent (only for admin with roleId = 1)
parameters:
- description: Insert the X-Client-Key
in: header
name: X-Client-Key
required: true
type: string
- description: SalesAgent 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: Approve SalesAgent
tags:
- SalesAgents
/sales-agents/{id}/reject:
put:
description: API for rejecting SalesAgent (only for admin with roleId = 1)
parameters:
- description: Insert the X-Client-Key
in: header
name: X-Client-Key
required: true
type: string
- description: SalesAgent ID
in: path
name: id
required: true
type: integer
- description: Rejection message
in: body
name: message
schema:
type: string
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: Reject SalesAgent
tags:
- SalesAgents
/sales-agents/viewer/{filename}:
get:
description: API for viewing SalesAgent profile picture file

View File

@ -3715,6 +3715,62 @@ const docTemplate = `{
}
}
}
},
"/banners/{id}/comment": {
"put": {
"security": [
{
"Bearer": []
}
],
"description": "API for comment Banner (only for admin with roleId = 1)",
"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",
"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"
}
}
}
}
},
"/cities": {
"get": {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff