feat: update master menu and master module

This commit is contained in:
hanif salafi 2024-04-30 01:09:11 +07:00
parent 5829753c47
commit 83cfd4ada2
19 changed files with 1191 additions and 589 deletions

View File

@ -9,9 +9,9 @@ type MasterMenus struct {
ModuleId int `json:"module_id" gorm:"type:int4"` ModuleId int `json:"module_id" gorm:"type:int4"`
ParentMenuId int `json:"parent_menu_id" gorm:"type:int4"` ParentMenuId int `json:"parent_menu_id" gorm:"type:int4"`
Icon string `json:"icon" gorm:"type:varchar"` Icon string `json:"icon" gorm:"type:varchar"`
Position int `json:"position" gorm:"type:int4"` Position *int `json:"position" gorm:"type:int4"`
StatusId int `json:"status_id" gorm:"type:int4"` StatusId int `json:"status_id" gorm:"type:int4"`
IsActive bool `json:"is_active" gorm:"type:bool"` IsActive *bool `json:"is_active" gorm:"type:bool;default:true"`
CreatedAt time.Time `json:"created_at" gorm:"default:now()"` CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"`
} }

View File

@ -8,7 +8,7 @@ type MasterModules struct {
Description string `json:"description" gorm:"type:varchar"` Description string `json:"description" gorm:"type:varchar"`
PathUrl string `json:"path_url" gorm:"type:varchar"` PathUrl string `json:"path_url" gorm:"type:varchar"`
StatusId int `json:"status_id" gorm:"type:int4"` StatusId int `json:"status_id" gorm:"type:int4"`
IsActive bool `json:"is_active" gorm:"type:bool"` IsActive *bool `json:"is_active" gorm:"type:bool;default:true"`
CreatedAt time.Time `json:"created_at" gorm:"default:now()"` CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"` UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"`
} }

View File

@ -32,7 +32,7 @@ func NewArticleCategoryDetailsController(articleCategoryDetailsService service.A
// All get all ArticleCategoryDetails // All get all ArticleCategoryDetails
// @Summary Get all ArticleCategoryDetails // @Summary Get all ArticleCategoryDetails
// @Description API for getting all ArticleCategoryDetails // @Description API for getting all ArticleCategoryDetails
// @Tags Task // @Tags Untags
// @Security Bearer // @Security Bearer
// @Success 200 {object} response.Response // @Success 200 {object} response.Response
// @Failure 401 {object} response.Response // @Failure 401 {object} response.Response
@ -64,7 +64,7 @@ func (_i *articleCategoryDetailsController) All(c *fiber.Ctx) error {
// Show get one ArticleCategoryDetails // Show get one ArticleCategoryDetails
// @Summary Get one ArticleCategoryDetails // @Summary Get one ArticleCategoryDetails
// @Description API for getting one ArticleCategoryDetails // @Description API for getting one ArticleCategoryDetails
// @Tags Task // @Tags Untags
// @Security Bearer // @Security Bearer
// @Param id path int true "ArticleCategoryDetails ID" // @Param id path int true "ArticleCategoryDetails ID"
// @Success 200 {object} response.Response // @Success 200 {object} response.Response
@ -93,7 +93,7 @@ func (_i *articleCategoryDetailsController) Show(c *fiber.Ctx) error {
// Save create ArticleCategoryDetails // Save create ArticleCategoryDetails
// @Summary Create ArticleCategoryDetails // @Summary Create ArticleCategoryDetails
// @Description API for create ArticleCategoryDetails // @Description API for create ArticleCategoryDetails
// @Tags Task // @Tags Untags
// @Security Bearer // @Security Bearer
// @Body request.ArticleCategoryDetailsCreateRequest // @Body request.ArticleCategoryDetailsCreateRequest
// @Success 200 {object} response.Response // @Success 200 {object} response.Response
@ -121,7 +121,7 @@ func (_i *articleCategoryDetailsController) Save(c *fiber.Ctx) error {
// Update update ArticleCategoryDetails // Update update ArticleCategoryDetails
// @Summary update ArticleCategoryDetails // @Summary update ArticleCategoryDetails
// @Description API for update ArticleCategoryDetails // @Description API for update ArticleCategoryDetails
// @Tags Task // @Tags Untags
// @Security Bearer // @Security Bearer
// @Body request.ArticleCategoryDetailsUpdateRequest // @Body request.ArticleCategoryDetailsUpdateRequest
// @Param id path int true "ArticleCategoryDetails ID" // @Param id path int true "ArticleCategoryDetails ID"
@ -155,7 +155,7 @@ func (_i *articleCategoryDetailsController) Update(c *fiber.Ctx) error {
// Delete delete ArticleCategoryDetails // Delete delete ArticleCategoryDetails
// @Summary delete ArticleCategoryDetails // @Summary delete ArticleCategoryDetails
// @Description API for delete ArticleCategoryDetails // @Description API for delete ArticleCategoryDetails
// @Tags Task // @Tags Untags
// @Security Bearer // @Security Bearer
// @Param id path int true "ArticleCategoryDetails ID" // @Param id path int true "ArticleCategoryDetails ID"
// @Success 200 {object} response.Response // @Success 200 {object} response.Response

View File

@ -29,16 +29,17 @@ func NewMasterMenusController(masterMenusService service.MasterMenusService) Mas
} }
} }
// All get all MasterMenus // All MasterMenus
// @Summary Get all MasterMenus // @Summary Get all MasterMenus
// @Description API for getting all MasterMenus // @Description API for getting all MasterMenus
// @Tags Task // @Tags MasterMenus
// @Security Bearer // @Security Bearer
// @Param req query request.MasterMenusQueryRequest false "query parameters"
// @Param req query paginator.Pagination false "pagination parameters"
// @Success 200 {object} response.Response // @Success 200 {object} response.Response
// @Failure 401 {object} response.Response // @Failure 400 {object} response.BadRequestError
// @Failure 404 {object} response.Response // @Failure 401 {object} response.UnauthorizedError
// @Failure 422 {object} response.Response // @Failure 500 {object} response.InternalServerError
// @Failure 500 {object} response.Response
// @Router /master-menus [get] // @Router /master-menus [get]
func (_i *masterMenusController) All(c *fiber.Ctx) error { func (_i *masterMenusController) All(c *fiber.Ctx) error {
paginate, err := paginator.Paginate(c) paginate, err := paginator.Paginate(c)
@ -46,7 +47,14 @@ func (_i *masterMenusController) All(c *fiber.Ctx) error {
return err return err
} }
var req request.MasterMenusQueryRequest reqContext := request.MasterMenusQueryRequestContext{
Name: c.Query("name"),
Description: c.Query("description"),
ParentMenuId: c.Query("parentMenuId"),
ModuleId: c.Query("moduleId"),
StatusId: c.Query("statusId"),
}
req := reqContext.ToParamRequest()
req.Pagination = paginate req.Pagination = paginate
masterMenusData, paging, err := _i.masterMenusService.All(req) masterMenusData, paging, err := _i.masterMenusService.All(req)
@ -55,6 +63,7 @@ func (_i *masterMenusController) All(c *fiber.Ctx) error {
} }
return utilRes.Resp(c, utilRes.Response{ return utilRes.Resp(c, utilRes.Response{
Success: true,
Messages: utilRes.Messages{"MasterMenus list successfully retrieved"}, Messages: utilRes.Messages{"MasterMenus list successfully retrieved"},
Data: masterMenusData, Data: masterMenusData,
Meta: paging, Meta: paging,
@ -64,14 +73,13 @@ func (_i *masterMenusController) All(c *fiber.Ctx) error {
// Show get one MasterMenus // Show get one MasterMenus
// @Summary Get one MasterMenus // @Summary Get one MasterMenus
// @Description API for getting one MasterMenus // @Description API for getting one MasterMenus
// @Tags Task // @Tags MasterMenus
// @Security Bearer // @Security Bearer
// @Param id path int true "MasterMenus ID" // @Param id path int true "MasterMenus ID"
// @Success 200 {object} response.Response // @Success 200 {object} response.Response
// @Failure 401 {object} response.Response // @Failure 400 {object} response.BadRequestError
// @Failure 404 {object} response.Response // @Failure 401 {object} response.UnauthorizedError
// @Failure 422 {object} response.Response // @Failure 500 {object} response.InternalServerError
// @Failure 500 {object} response.Response
// @Router /master-menus/{id} [get] // @Router /master-menus/{id} [get]
func (_i *masterMenusController) Show(c *fiber.Ctx) error { func (_i *masterMenusController) Show(c *fiber.Ctx) error {
id, err := strconv.ParseUint(c.Params("id"), 10, 0) id, err := strconv.ParseUint(c.Params("id"), 10, 0)
@ -85,6 +93,7 @@ func (_i *masterMenusController) Show(c *fiber.Ctx) error {
} }
return utilRes.Resp(c, utilRes.Response{ return utilRes.Resp(c, utilRes.Response{
Success: true,
Messages: utilRes.Messages{"MasterMenus successfully retrieved"}, Messages: utilRes.Messages{"MasterMenus successfully retrieved"},
Data: masterMenusData, Data: masterMenusData,
}) })
@ -93,14 +102,13 @@ func (_i *masterMenusController) Show(c *fiber.Ctx) error {
// Save create MasterMenus // Save create MasterMenus
// @Summary Create MasterMenus // @Summary Create MasterMenus
// @Description API for create MasterMenus // @Description API for create MasterMenus
// @Tags Task // @Tags MasterMenus
// @Security Bearer // @Security Bearer
// @Body request.MasterMenusCreateRequest // @Param payload body request.MasterMenusCreateRequest true "Required payload"
// @Success 200 {object} response.Response // @Success 200 {object} response.Response
// @Failure 401 {object} response.Response // @Failure 400 {object} response.BadRequestError
// @Failure 404 {object} response.Response // @Failure 401 {object} response.UnauthorizedError
// @Failure 422 {object} response.Response // @Failure 500 {object} response.InternalServerError
// @Failure 500 {object} response.Response
// @Router /master-menus [post] // @Router /master-menus [post]
func (_i *masterMenusController) Save(c *fiber.Ctx) error { func (_i *masterMenusController) Save(c *fiber.Ctx) error {
req := new(request.MasterMenusCreateRequest) req := new(request.MasterMenusCreateRequest)
@ -114,14 +122,15 @@ func (_i *masterMenusController) Save(c *fiber.Ctx) error {
} }
return utilRes.Resp(c, utilRes.Response{ return utilRes.Resp(c, utilRes.Response{
Success: true,
Messages: utilRes.Messages{"MasterMenus successfully created"}, Messages: utilRes.Messages{"MasterMenus successfully created"},
}) })
} }
// Update update MasterMenus // Update MasterMenus
// @Summary update MasterMenus // @Summary Update MasterMenus
// @Description API for update MasterMenus // @Description API for update MasterMenus
// @Tags Task // @Tags MasterMenus
// @Security Bearer // @Security Bearer
// @Body request.MasterMenusUpdateRequest // @Body request.MasterMenusUpdateRequest
// @Param id path int true "MasterMenus ID" // @Param id path int true "MasterMenus ID"
@ -148,21 +157,21 @@ func (_i *masterMenusController) Update(c *fiber.Ctx) error {
} }
return utilRes.Resp(c, utilRes.Response{ return utilRes.Resp(c, utilRes.Response{
Success: true,
Messages: utilRes.Messages{"MasterMenus successfully updated"}, Messages: utilRes.Messages{"MasterMenus successfully updated"},
}) })
} }
// Delete delete MasterMenus // Delete MasterMenus
// @Summary delete MasterMenus // @Summary Delete MasterMenus
// @Description API for delete MasterMenus // @Description API for delete MasterMenus
// @Tags Task // @Tags MasterMenus
// @Security Bearer // @Security Bearer
// @Param id path int true "MasterMenus ID" // @Param id path int true "MasterMenus ID"
// @Success 200 {object} response.Response // @Success 200 {object} response.Response
// @Failure 401 {object} response.Response // @Failure 400 {object} response.BadRequestError
// @Failure 404 {object} response.Response // @Failure 401 {object} response.UnauthorizedError
// @Failure 422 {object} response.Response // @Failure 500 {object} response.InternalServerError
// @Failure 500 {object} response.Response
// @Router /master-menus/{id} [delete] // @Router /master-menus/{id} [delete]
func (_i *masterMenusController) Delete(c *fiber.Ctx) error { func (_i *masterMenusController) Delete(c *fiber.Ctx) error {
id, err := strconv.ParseUint(c.Params("id"), 10, 0) id, err := strconv.ParseUint(c.Params("id"), 10, 0)
@ -176,6 +185,7 @@ func (_i *masterMenusController) Delete(c *fiber.Ctx) error {
} }
return utilRes.Resp(c, utilRes.Response{ return utilRes.Resp(c, utilRes.Response{
Success: true,
Messages: utilRes.Messages{"MasterMenus successfully deleted"}, Messages: utilRes.Messages{"MasterMenus successfully deleted"},
}) })
} }

View File

@ -8,18 +8,18 @@ import (
func MasterMenusResponseMapper(masterMenusReq *entity.MasterMenus) (masterMenusRes *res.MasterMenusResponse) { func MasterMenusResponseMapper(masterMenusReq *entity.MasterMenus) (masterMenusRes *res.MasterMenusResponse) {
if masterMenusReq != nil { if masterMenusReq != nil {
masterMenusRes = &res.MasterMenusResponse{ masterMenusRes = &res.MasterMenusResponse{
ID: masterMenusReq.ID, ID: masterMenusReq.ID,
Name: masterMenusReq.Name, Name: masterMenusReq.Name,
Description: masterMenusReq.Description, Description: masterMenusReq.Description,
ModuleId: masterMenusReq.ModuleId, ModuleId: masterMenusReq.ModuleId,
ParentMenuId: masterMenusReq.ParentMenuId, ParentMenuId: masterMenusReq.ParentMenuId,
Icon: masterMenusReq.Icon, Icon: masterMenusReq.Icon,
Position: masterMenusReq.Position, Position: masterMenusReq.Position,
StatusId: masterMenusReq.StatusId, StatusId: masterMenusReq.StatusId,
IsActive: masterMenusReq.IsActive, IsActive: masterMenusReq.IsActive,
CreatedAt: masterMenusReq.CreatedAt, CreatedAt: masterMenusReq.CreatedAt,
UpdatedAt: masterMenusReq.UpdatedAt, UpdatedAt: masterMenusReq.UpdatedAt,
} }
} }
return masterMenusRes return masterMenusRes
} }

View File

@ -1,10 +1,12 @@
package repository package repository
import ( import (
"fmt"
"go-humas-be/app/database" "go-humas-be/app/database"
"go-humas-be/app/database/entity" "go-humas-be/app/database/entity"
"go-humas-be/app/module/master_menus/request" "go-humas-be/app/module/master_menus/request"
"go-humas-be/utils/paginator" "go-humas-be/utils/paginator"
"strings"
) )
type masterMenusRepository struct { type masterMenusRepository struct {
@ -31,8 +33,35 @@ func (_i *masterMenusRepository) GetAll(req request.MasterMenusQueryRequest) (ma
var count int64 var count int64
query := _i.DB.DB.Model(&entity.MasterMenus{}) query := _i.DB.DB.Model(&entity.MasterMenus{})
query = query.Where("is_active = ?", true)
if req.Name != nil && *req.Name != "" {
name := strings.ToLower(*req.Name)
query = query.Where("LOWER(name) LIKE ?", "%"+strings.ToLower(name)+"%")
}
if req.Description != nil && *req.Description != "" {
description := strings.ToLower(*req.Description)
query = query.Where("LOWER(description) LIKE ?", "%"+strings.ToLower(description)+"%")
}
if req.ModuleId != nil {
query = query.Where("module_id = ?", req.ModuleId)
}
if req.ParentMenuId != nil {
query = query.Where("parent_menu_id = ?", req.ParentMenuId)
}
if req.StatusId != nil {
query = query.Where("status_id = ?", req.StatusId)
}
query.Count(&count) query.Count(&count)
if req.Pagination.SortBy != "" {
direction := "ASC"
if req.Pagination.Sort == "desc" {
direction = "DESC"
}
query.Order(fmt.Sprintf("%s %s", req.Pagination.SortBy, direction))
}
req.Pagination.Count = count req.Pagination.Count = count
req.Pagination = paginator.Paging(req.Pagination) req.Pagination = paginator.Paging(req.Pagination)
@ -66,4 +95,4 @@ func (_i *masterMenusRepository) Update(id uint, masterMenus *entity.MasterMenus
func (_i *masterMenusRepository) Delete(id uint) error { func (_i *masterMenusRepository) Delete(id uint) error {
return _i.DB.DB.Delete(&entity.MasterMenus{}, id).Error return _i.DB.DB.Delete(&entity.MasterMenus{}, id).Error
} }

View File

@ -3,6 +3,7 @@ package request
import ( import (
"go-humas-be/app/database/entity" "go-humas-be/app/database/entity"
"go-humas-be/utils/paginator" "go-humas-be/utils/paginator"
"strconv"
"time" "time"
) )
@ -11,68 +12,97 @@ type MasterMenusGeneric interface {
} }
type MasterMenusQueryRequest struct { type MasterMenusQueryRequest struct {
Name string `json:"name" validate:"required"` Name *string `json:"name"`
Description string `json:"description" validate:"required"` Description *string `json:"description"`
ModuleId int `json:"module_id" validate:"required"` ModuleId *int `json:"moduleId"`
ParentMenuId int `json:"parent_menu_id" validate:"required"` ParentMenuId *int `json:"parentMenuId"`
Icon string `json:"icon" validate:"required"` StatusId *int `json:"statusId"`
Position int `json:"position" validate:"required"` Pagination *paginator.Pagination `json:"pagination"`
StatusId int `json:"status_id" validate:"required"`
IsActive bool `json:"is_active" validate:"required"`
Pagination *paginator.Pagination `json:"pagination"`
} }
type MasterMenusCreateRequest struct { type MasterMenusCreateRequest struct {
Name string `json:"name" validate:"required"` Name string `json:"name" validate:"required"`
Description string `json:"description" validate:"required"` Description string `json:"description" validate:"required"`
ModuleId int `json:"module_id" validate:"required"` ModuleId int `json:"moduleId" validate:"required"`
ParentMenuId int `json:"parent_menu_id" validate:"required"` ParentMenuId int `json:"parentMenuId" validate:"required"`
Icon string `json:"icon" validate:"required"` Icon string `json:"icon" validate:"required"`
Position int `json:"position" validate:"required"` StatusId int `json:"statusId" validate:"required"`
StatusId int `json:"status_id" validate:"required"` Position *int `json:"position"`
IsActive bool `json:"is_active" validate:"required"`
} }
func (req MasterMenusCreateRequest) ToEntity() *entity.MasterMenus { func (req MasterMenusCreateRequest) ToEntity() *entity.MasterMenus {
return &entity.MasterMenus{ return &entity.MasterMenus{
Name: req.Name, Name: req.Name,
Description: req.Description, Description: req.Description,
ModuleId: req.ModuleId, ModuleId: req.ModuleId,
ParentMenuId: req.ParentMenuId, ParentMenuId: req.ParentMenuId,
Icon: req.Icon, Icon: req.Icon,
Position: req.Position, Position: req.Position,
StatusId: req.StatusId, StatusId: req.StatusId,
IsActive: req.IsActive,
} }
} }
type MasterMenusUpdateRequest struct { type MasterMenusUpdateRequest struct {
ID uint `json:"id" validate:"required"` ID uint `json:"id" validate:"required"`
Name string `json:"name" validate:"required"` Name string `json:"name" validate:"required"`
Description string `json:"description" validate:"required"` Description string `json:"description" validate:"required"`
ModuleId int `json:"module_id" validate:"required"` ModuleId int `json:"moduleId" validate:"required"`
ParentMenuId int `json:"parent_menu_id" validate:"required"` ParentMenuId int `json:"parentMenuId" validate:"required"`
Icon string `json:"icon" validate:"required"` Icon string `json:"icon" validate:"required"`
Position int `json:"position" validate:"required"` StatusId int `json:"statusId" validate:"required"`
StatusId int `json:"status_id" validate:"required"` Position *int `json:"position"`
IsActive bool `json:"is_active" validate:"required"` UpdatedAt time.Time `json:"updatedAt"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
} }
func (req MasterMenusUpdateRequest) ToEntity() *entity.MasterMenus { func (req MasterMenusUpdateRequest) ToEntity() *entity.MasterMenus {
return &entity.MasterMenus{ return &entity.MasterMenus{
ID: req.ID, ID: req.ID,
Name: req.Name, Name: req.Name,
Description: req.Description, Description: req.Description,
ModuleId: req.ModuleId, ModuleId: req.ModuleId,
ParentMenuId: req.ParentMenuId, ParentMenuId: req.ParentMenuId,
Icon: req.Icon, Icon: req.Icon,
Position: req.Position, Position: req.Position,
StatusId: req.StatusId, StatusId: req.StatusId,
IsActive: req.IsActive, UpdatedAt: time.Now(),
CreatedAt: req.CreatedAt,
UpdatedAt: req.UpdatedAt,
} }
} }
type MasterMenusQueryRequestContext struct {
Name string `json:"name"`
Description string `json:"description"`
ModuleId string `json:"moduleId"`
ParentMenuId string `json:"parentMenuId"`
StatusId string `json:"statusId"`
}
func (req MasterMenusQueryRequestContext) ToParamRequest() MasterMenusQueryRequest {
var request MasterMenusQueryRequest
if name := req.Name; name != "" {
request.Name = &name
}
if description := req.Description; description != "" {
request.Description = &description
}
if moduleIdStr := req.ModuleId; moduleIdStr != "" {
moduleId, err := strconv.Atoi(moduleIdStr)
if err == nil {
request.ModuleId = &moduleId
}
}
if parentMenuIdStr := req.ParentMenuId; parentMenuIdStr != "" {
parentMenuId, err := strconv.Atoi(parentMenuIdStr)
if err == nil {
request.ParentMenuId = &parentMenuId
}
}
if statusIdStr := req.StatusId; statusIdStr != "" {
statusId, err := strconv.Atoi(statusIdStr)
if err == nil {
request.StatusId = &statusId
}
}
return request
}

View File

@ -3,15 +3,15 @@ package response
import "time" import "time"
type MasterMenusResponse struct { type MasterMenusResponse struct {
ID uint `json:"id"` ID uint `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Description string `json:"description"` Description string `json:"description"`
ModuleId int `json:"module_id"` ModuleId int `json:"module_id"`
ParentMenuId int `json:"parent_menu_id"` ParentMenuId int `json:"parent_menu_id"`
Icon string `json:"icon"` Icon string `json:"icon"`
Position int `json:"position"` Position *int `json:"position"`
StatusId int `json:"status_id"` StatusId int `json:"status_id"`
IsActive bool `json:"is_active"` IsActive *bool `json:"is_active"`
CreatedAt time.Time `json:"created_at"` CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"` UpdatedAt time.Time `json:"updated_at"`
} }

View File

@ -68,5 +68,12 @@ func (_i *masterMenusService) Update(id uint, req request.MasterMenusUpdateReque
} }
func (_i *masterMenusService) Delete(id uint) error { func (_i *masterMenusService) Delete(id uint) error {
return _i.Repo.Delete(id) result, err := _i.Repo.FindOne(id)
if err != nil {
return err
}
isActive := false
result.IsActive = &isActive
return _i.Repo.Update(id, result)
} }

View File

@ -29,16 +29,17 @@ func NewMasterModulesController(masterModulesService service.MasterModulesServic
} }
} }
// All get all MasterModules // All MasterModules
// @Summary Get all MasterModules // @Summary Get all MasterModules
// @Description API for getting all MasterModules // @Description API for getting all MasterModules
// @Tags Task // @Tags MasterModules
// @Security Bearer // @Security Bearer
// @Param req query request.MasterModulesQueryRequest false "query parameters"
// @Param req query paginator.Pagination false "pagination parameters"
// @Success 200 {object} response.Response // @Success 200 {object} response.Response
// @Failure 401 {object} response.Response // @Failure 400 {object} response.BadRequestError
// @Failure 404 {object} response.Response // @Failure 401 {object} response.UnauthorizedError
// @Failure 422 {object} response.Response // @Failure 500 {object} response.InternalServerError
// @Failure 500 {object} response.Response
// @Router /master-modules [get] // @Router /master-modules [get]
func (_i *masterModulesController) All(c *fiber.Ctx) error { func (_i *masterModulesController) All(c *fiber.Ctx) error {
paginate, err := paginator.Paginate(c) paginate, err := paginator.Paginate(c)
@ -46,7 +47,12 @@ func (_i *masterModulesController) All(c *fiber.Ctx) error {
return err return err
} }
var req request.MasterModulesQueryRequest reqContext := request.MasterModulesQueryRequestContext{
Name: c.Query("name"),
Description: c.Query("description"),
StatusId: c.Query("statusId"),
}
req := reqContext.ToParamRequest()
req.Pagination = paginate req.Pagination = paginate
masterModulesData, paging, err := _i.masterModulesService.All(req) masterModulesData, paging, err := _i.masterModulesService.All(req)
@ -55,23 +61,23 @@ func (_i *masterModulesController) All(c *fiber.Ctx) error {
} }
return utilRes.Resp(c, utilRes.Response{ return utilRes.Resp(c, utilRes.Response{
Success: true,
Messages: utilRes.Messages{"MasterModules list successfully retrieved"}, Messages: utilRes.Messages{"MasterModules list successfully retrieved"},
Data: masterModulesData, Data: masterModulesData,
Meta: paging, Meta: paging,
}) })
} }
// Show get one MasterModules // Show MasterModules
// @Summary Get one MasterModules // @Summary Get one MasterModules
// @Description API for getting one MasterModules // @Description API for getting one MasterModules
// @Tags Task // @Tags MasterModules
// @Security Bearer // @Security Bearer
// @Param id path int true "MasterModules ID" // @Param id path int true "MasterModules ID"
// @Success 200 {object} response.Response // @Success 200 {object} response.Response
// @Failure 401 {object} response.Response // @Failure 400 {object} response.BadRequestError
// @Failure 404 {object} response.Response // @Failure 401 {object} response.UnauthorizedError
// @Failure 422 {object} response.Response // @Failure 500 {object} response.InternalServerError
// @Failure 500 {object} response.Response
// @Router /master-modules/{id} [get] // @Router /master-modules/{id} [get]
func (_i *masterModulesController) Show(c *fiber.Ctx) error { func (_i *masterModulesController) Show(c *fiber.Ctx) error {
id, err := strconv.ParseUint(c.Params("id"), 10, 0) id, err := strconv.ParseUint(c.Params("id"), 10, 0)
@ -85,22 +91,22 @@ func (_i *masterModulesController) Show(c *fiber.Ctx) error {
} }
return utilRes.Resp(c, utilRes.Response{ return utilRes.Resp(c, utilRes.Response{
Success: true,
Messages: utilRes.Messages{"MasterModules successfully retrieved"}, Messages: utilRes.Messages{"MasterModules successfully retrieved"},
Data: masterModulesData, Data: masterModulesData,
}) })
} }
// Save create MasterModules // Save MasterModules
// @Summary Create MasterModules // @Summary Create MasterModules
// @Description API for create MasterModules // @Description API for create MasterModules
// @Tags Task // @Tags MasterModules
// @Security Bearer // @Security Bearer
// @Body request.MasterModulesCreateRequest // @Param payload body request.MasterModulesCreateRequest true "Required payload"
// @Success 200 {object} response.Response // @Success 200 {object} response.Response
// @Failure 401 {object} response.Response // @Failure 400 {object} response.BadRequestError
// @Failure 404 {object} response.Response // @Failure 401 {object} response.UnauthorizedError
// @Failure 422 {object} response.Response // @Failure 500 {object} response.InternalServerError
// @Failure 500 {object} response.Response
// @Router /master-modules [post] // @Router /master-modules [post]
func (_i *masterModulesController) Save(c *fiber.Ctx) error { func (_i *masterModulesController) Save(c *fiber.Ctx) error {
req := new(request.MasterModulesCreateRequest) req := new(request.MasterModulesCreateRequest)
@ -114,22 +120,22 @@ func (_i *masterModulesController) Save(c *fiber.Ctx) error {
} }
return utilRes.Resp(c, utilRes.Response{ return utilRes.Resp(c, utilRes.Response{
Success: true,
Messages: utilRes.Messages{"MasterModules successfully created"}, Messages: utilRes.Messages{"MasterModules successfully created"},
}) })
} }
// Update update MasterModules // Update MasterModules
// @Summary update MasterModules // @Summary Update MasterModules
// @Description API for update MasterModules // @Description API for update MasterModules
// @Tags Task // @Tags MasterModules
// @Security Bearer // @Security Bearer
// @Body request.MasterModulesUpdateRequest
// @Param id path int true "MasterModules ID" // @Param id path int true "MasterModules ID"
// @Param payload body request.MasterModulesUpdateRequest true "Required payload"
// @Success 200 {object} response.Response // @Success 200 {object} response.Response
// @Failure 401 {object} response.Response // @Failure 400 {object} response.BadRequestError
// @Failure 404 {object} response.Response // @Failure 401 {object} response.UnauthorizedError
// @Failure 422 {object} response.Response // @Failure 500 {object} response.InternalServerError
// @Failure 500 {object} response.Response
// @Router /master-modules/{id} [put] // @Router /master-modules/{id} [put]
func (_i *masterModulesController) Update(c *fiber.Ctx) error { func (_i *masterModulesController) Update(c *fiber.Ctx) error {
id, err := strconv.ParseUint(c.Params("id"), 10, 0) id, err := strconv.ParseUint(c.Params("id"), 10, 0)
@ -148,21 +154,21 @@ func (_i *masterModulesController) Update(c *fiber.Ctx) error {
} }
return utilRes.Resp(c, utilRes.Response{ return utilRes.Resp(c, utilRes.Response{
Success: true,
Messages: utilRes.Messages{"MasterModules successfully updated"}, Messages: utilRes.Messages{"MasterModules successfully updated"},
}) })
} }
// Delete delete MasterModules // Delete MasterModules
// @Summary delete MasterModules // @Summary Delete MasterModules
// @Description API for delete MasterModules // @Description API for delete MasterModules
// @Tags Task // @Tags MasterModules
// @Security Bearer // @Security Bearer
// @Param id path int true "MasterModules ID" // @Param id path int true "MasterModules ID"
// @Success 200 {object} response.Response // @Success 200 {object} response.Response
// @Failure 401 {object} response.Response // @Failure 400 {object} response.BadRequestError
// @Failure 404 {object} response.Response // @Failure 401 {object} response.UnauthorizedError
// @Failure 422 {object} response.Response // @Failure 500 {object} response.InternalServerError
// @Failure 500 {object} response.Response
// @Router /master-modules/{id} [delete] // @Router /master-modules/{id} [delete]
func (_i *masterModulesController) Delete(c *fiber.Ctx) error { func (_i *masterModulesController) Delete(c *fiber.Ctx) error {
id, err := strconv.ParseUint(c.Params("id"), 10, 0) id, err := strconv.ParseUint(c.Params("id"), 10, 0)
@ -176,6 +182,7 @@ func (_i *masterModulesController) Delete(c *fiber.Ctx) error {
} }
return utilRes.Resp(c, utilRes.Response{ return utilRes.Resp(c, utilRes.Response{
Success: true,
Messages: utilRes.Messages{"MasterModules successfully deleted"}, Messages: utilRes.Messages{"MasterModules successfully deleted"},
}) })
} }

View File

@ -1,14 +0,0 @@
package entity
import "time"
type MasterModules struct {
ID uint `json:"id" gorm:"primaryKey;type:int4;autoIncrement"`
Name string `json:"name" gorm:"type:varchar"`
Description string `json:"description" gorm:"type:varchar"`
PathUrl string `json:"path_url" gorm:"type:varchar"`
StatusId int `json:"status_id" gorm:"type:int4"`
IsActive bool `json:"is_active" gorm:"type:bool"`
CreatedAt time.Time `json:"created_at" gorm:"default:now()"`
UpdatedAt time.Time `json:"updated_at" gorm:"default:now()"`
}

View File

@ -8,15 +8,15 @@ import (
func MasterModulesResponseMapper(masterModulesReq *entity.MasterModules) (masterModulesRes *res.MasterModulesResponse) { func MasterModulesResponseMapper(masterModulesReq *entity.MasterModules) (masterModulesRes *res.MasterModulesResponse) {
if masterModulesReq != nil { if masterModulesReq != nil {
masterModulesRes = &res.MasterModulesResponse{ masterModulesRes = &res.MasterModulesResponse{
ID: masterModulesReq.ID, ID: masterModulesReq.ID,
Name: masterModulesReq.Name, Name: masterModulesReq.Name,
Description: masterModulesReq.Description, Description: masterModulesReq.Description,
PathUrl: masterModulesReq.PathUrl, PathUrl: masterModulesReq.PathUrl,
StatusId: masterModulesReq.StatusId, StatusId: masterModulesReq.StatusId,
IsActive: masterModulesReq.IsActive, IsActive: masterModulesReq.IsActive,
CreatedAt: masterModulesReq.CreatedAt, CreatedAt: masterModulesReq.CreatedAt,
UpdatedAt: masterModulesReq.UpdatedAt, UpdatedAt: masterModulesReq.UpdatedAt,
} }
} }
return masterModulesRes return masterModulesRes
} }

View File

@ -1,10 +1,12 @@
package repository package repository
import ( import (
"fmt"
"go-humas-be/app/database" "go-humas-be/app/database"
"go-humas-be/app/database/entity" "go-humas-be/app/database/entity"
"go-humas-be/app/module/master_modules/request" "go-humas-be/app/module/master_modules/request"
"go-humas-be/utils/paginator" "go-humas-be/utils/paginator"
"strings"
) )
type masterModulesRepository struct { type masterModulesRepository struct {
@ -31,8 +33,29 @@ func (_i *masterModulesRepository) GetAll(req request.MasterModulesQueryRequest)
var count int64 var count int64
query := _i.DB.DB.Model(&entity.MasterModules{}) query := _i.DB.DB.Model(&entity.MasterModules{})
query = query.Where("is_active = ?", true)
if req.Name != nil && *req.Name != "" {
name := strings.ToLower(*req.Name)
query = query.Where("LOWER(name) LIKE ?", "%"+strings.ToLower(name)+"%")
}
if req.Description != nil && *req.Description != "" {
description := strings.ToLower(*req.Description)
query = query.Where("LOWER(description) LIKE ?", "%"+strings.ToLower(description)+"%")
}
if req.StatusId != nil {
query = query.Where("status_id = ?", req.StatusId)
}
query.Count(&count) query.Count(&count)
if req.Pagination.SortBy != "" {
direction := "ASC"
if req.Pagination.Sort == "desc" {
direction = "DESC"
}
query.Order(fmt.Sprintf("%s %s", req.Pagination.SortBy, direction))
}
req.Pagination.Count = count req.Pagination.Count = count
req.Pagination = paginator.Paging(req.Pagination) req.Pagination = paginator.Paging(req.Pagination)
@ -66,4 +89,4 @@ func (_i *masterModulesRepository) Update(id uint, masterModules *entity.MasterM
func (_i *masterModulesRepository) Delete(id uint) error { func (_i *masterModulesRepository) Delete(id uint) error {
return _i.DB.DB.Delete(&entity.MasterModules{}, id).Error return _i.DB.DB.Delete(&entity.MasterModules{}, id).Error
} }

View File

@ -3,6 +3,7 @@ package request
import ( import (
"go-humas-be/app/database/entity" "go-humas-be/app/database/entity"
"go-humas-be/utils/paginator" "go-humas-be/utils/paginator"
"strconv"
"time" "time"
) )
@ -11,53 +12,68 @@ type MasterModulesGeneric interface {
} }
type MasterModulesQueryRequest struct { type MasterModulesQueryRequest struct {
Name string `json:"name" validate:"required"` Name *string `json:"name"`
Description string `json:"description" validate:"required"` Description *string `json:"description"`
PathUrl string `json:"path_url" validate:"required"` StatusId *int `json:"statusId"`
StatusId int `json:"status_id" validate:"required"`
IsActive bool `json:"is_active" validate:"required"`
Pagination *paginator.Pagination `json:"pagination"` Pagination *paginator.Pagination `json:"pagination"`
} }
type MasterModulesCreateRequest struct { type MasterModulesCreateRequest struct {
Name string `json:"name" validate:"required"` Name string `json:"name" validate:"required"`
Description string `json:"description" validate:"required"` Description string `json:"description" validate:"required"`
PathUrl string `json:"path_url" validate:"required"` PathUrl string `json:"pathUrl" validate:"required"`
StatusId int `json:"status_id" validate:"required"` StatusId int `json:"statusId" validate:"required"`
IsActive bool `json:"is_active" validate:"required"`
} }
func (req MasterModulesCreateRequest) ToEntity() *entity.MasterModules { func (req MasterModulesCreateRequest) ToEntity() *entity.MasterModules {
return &entity.MasterModules{ return &entity.MasterModules{
Name: req.Name, Name: req.Name,
Description: req.Description, Description: req.Description,
PathUrl: req.PathUrl, PathUrl: req.PathUrl,
StatusId: req.StatusId, StatusId: req.StatusId,
IsActive: req.IsActive,
} }
} }
type MasterModulesUpdateRequest struct { type MasterModulesUpdateRequest struct {
ID uint `json:"id" validate:"required"` ID uint `json:"id" validate:"required"`
Name string `json:"name" validate:"required"` Name string `json:"name" validate:"required"`
Description string `json:"description" validate:"required"` Description string `json:"description" validate:"required"`
PathUrl string `json:"path_url" validate:"required"` PathUrl string `json:"pathUrl" validate:"required"`
StatusId int `json:"status_id" validate:"required"` StatusId int `json:"statusId" validate:"required"`
IsActive bool `json:"is_active" validate:"required"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
} }
func (req MasterModulesUpdateRequest) ToEntity() *entity.MasterModules { func (req MasterModulesUpdateRequest) ToEntity() *entity.MasterModules {
return &entity.MasterModules{ return &entity.MasterModules{
ID: req.ID, ID: req.ID,
Name: req.Name, Name: req.Name,
Description: req.Description, Description: req.Description,
PathUrl: req.PathUrl, PathUrl: req.PathUrl,
StatusId: req.StatusId, StatusId: req.StatusId,
IsActive: req.IsActive, UpdatedAt: time.Now(),
CreatedAt: req.CreatedAt,
UpdatedAt: req.UpdatedAt,
} }
} }
type MasterModulesQueryRequestContext struct {
Name string `json:"name"`
Description string `json:"description"`
StatusId string `json:"statusId"`
}
func (req MasterModulesQueryRequestContext) ToParamRequest() MasterModulesQueryRequest {
var request MasterModulesQueryRequest
if name := req.Name; name != "" {
request.Name = &name
}
if description := req.Description; description != "" {
request.Description = &description
}
if statusIdStr := req.StatusId; statusIdStr != "" {
statusId, err := strconv.Atoi(statusIdStr)
if err == nil {
request.StatusId = &statusId
}
}
return request
}

View File

@ -3,12 +3,12 @@ package response
import "time" import "time"
type MasterModulesResponse struct { type MasterModulesResponse struct {
ID uint `json:"id"` ID uint `json:"id"`
Name string `json:"name"` Name string `json:"name"`
Description string `json:"description"` Description string `json:"description"`
PathUrl string `json:"path_url"` PathUrl string `json:"path_url"`
StatusId int `json:"status_id"` StatusId int `json:"status_id"`
IsActive bool `json:"is_active"` IsActive *bool `json:"is_active"`
CreatedAt time.Time `json:"created_at"` CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"` UpdatedAt time.Time `json:"updated_at"`
} }

View File

@ -68,5 +68,12 @@ func (_i *masterModulesService) Update(id uint, req request.MasterModulesUpdateR
} }
func (_i *masterModulesService) Delete(id uint) error { func (_i *masterModulesService) Delete(id uint) error {
return _i.Repo.Delete(id) result, err := _i.Repo.FindOne(id)
if err != nil {
return err
}
isActive := false
result.IsActive = &isActive
return _i.Repo.Update(id, result)
} }

View File

@ -2303,9 +2303,76 @@ const docTemplate = `{
], ],
"description": "API for getting all MasterMenus", "description": "API for getting all MasterMenus",
"tags": [ "tags": [
"Task" "MasterMenus"
], ],
"summary": "Get all MasterMenus", "summary": "Get all MasterMenus",
"parameters": [
{
"type": "string",
"name": "description",
"in": "query"
},
{
"type": "integer",
"name": "moduleId",
"in": "query"
},
{
"type": "string",
"name": "name",
"in": "query"
},
{
"type": "integer",
"name": "parentMenuId",
"in": "query"
},
{
"type": "integer",
"name": "statusId",
"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": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
@ -2313,28 +2380,22 @@ const docTemplate = `{
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -2347,9 +2408,20 @@ const docTemplate = `{
], ],
"description": "API for create MasterMenus", "description": "API for create MasterMenus",
"tags": [ "tags": [
"Task" "MasterMenus"
], ],
"summary": "Create MasterMenus", "summary": "Create MasterMenus",
"parameters": [
{
"description": "Required payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.MasterMenusCreateRequest"
}
}
],
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
@ -2357,28 +2429,22 @@ const docTemplate = `{
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -2393,7 +2459,7 @@ const docTemplate = `{
], ],
"description": "API for getting one MasterMenus", "description": "API for getting one MasterMenus",
"tags": [ "tags": [
"Task" "MasterMenus"
], ],
"summary": "Get one MasterMenus", "summary": "Get one MasterMenus",
"parameters": [ "parameters": [
@ -2412,28 +2478,22 @@ const docTemplate = `{
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -2446,9 +2506,9 @@ const docTemplate = `{
], ],
"description": "API for update MasterMenus", "description": "API for update MasterMenus",
"tags": [ "tags": [
"Task" "MasterMenus"
], ],
"summary": "update MasterMenus", "summary": "Update MasterMenus",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
@ -2499,9 +2559,9 @@ const docTemplate = `{
], ],
"description": "API for delete MasterMenus", "description": "API for delete MasterMenus",
"tags": [ "tags": [
"Task" "MasterMenus"
], ],
"summary": "delete MasterMenus", "summary": "Delete MasterMenus",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
@ -2518,28 +2578,22 @@ const docTemplate = `{
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -2554,9 +2608,66 @@ const docTemplate = `{
], ],
"description": "API for getting all MasterModules", "description": "API for getting all MasterModules",
"tags": [ "tags": [
"Task" "MasterModules"
], ],
"summary": "Get all MasterModules", "summary": "Get all MasterModules",
"parameters": [
{
"type": "string",
"name": "description",
"in": "query"
},
{
"type": "string",
"name": "name",
"in": "query"
},
{
"type": "integer",
"name": "statusId",
"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": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
@ -2564,28 +2675,22 @@ const docTemplate = `{
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -2598,9 +2703,20 @@ const docTemplate = `{
], ],
"description": "API for create MasterModules", "description": "API for create MasterModules",
"tags": [ "tags": [
"Task" "MasterModules"
], ],
"summary": "Create MasterModules", "summary": "Create MasterModules",
"parameters": [
{
"description": "Required payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.MasterModulesCreateRequest"
}
}
],
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
@ -2608,28 +2724,22 @@ const docTemplate = `{
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -2644,7 +2754,7 @@ const docTemplate = `{
], ],
"description": "API for getting one MasterModules", "description": "API for getting one MasterModules",
"tags": [ "tags": [
"Task" "MasterModules"
], ],
"summary": "Get one MasterModules", "summary": "Get one MasterModules",
"parameters": [ "parameters": [
@ -2663,28 +2773,22 @@ const docTemplate = `{
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -2697,9 +2801,9 @@ const docTemplate = `{
], ],
"description": "API for update MasterModules", "description": "API for update MasterModules",
"tags": [ "tags": [
"Task" "MasterModules"
], ],
"summary": "update MasterModules", "summary": "Update MasterModules",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
@ -2707,6 +2811,15 @@ const docTemplate = `{
"name": "id", "name": "id",
"in": "path", "in": "path",
"required": true "required": true
},
{
"description": "Required payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.MasterModulesUpdateRequest"
}
} }
], ],
"responses": { "responses": {
@ -2716,28 +2829,22 @@ const docTemplate = `{
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -2750,9 +2857,9 @@ const docTemplate = `{
], ],
"description": "API for delete MasterModules", "description": "API for delete MasterModules",
"tags": [ "tags": [
"Task" "MasterModules"
], ],
"summary": "delete MasterModules", "summary": "Delete MasterModules",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
@ -2769,28 +2876,22 @@ const docTemplate = `{
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -5778,6 +5879,90 @@ const docTemplate = `{
} }
} }
}, },
"request.MasterMenusCreateRequest": {
"type": "object",
"required": [
"description",
"icon",
"moduleId",
"name",
"parentMenuId",
"statusId"
],
"properties": {
"description": {
"type": "string"
},
"icon": {
"type": "string"
},
"moduleId": {
"type": "integer"
},
"name": {
"type": "string"
},
"parentMenuId": {
"type": "integer"
},
"position": {
"type": "integer"
},
"statusId": {
"type": "integer"
}
}
},
"request.MasterModulesCreateRequest": {
"type": "object",
"required": [
"description",
"name",
"pathUrl",
"statusId"
],
"properties": {
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"pathUrl": {
"type": "string"
},
"statusId": {
"type": "integer"
}
}
},
"request.MasterModulesUpdateRequest": {
"type": "object",
"required": [
"description",
"id",
"name",
"pathUrl",
"statusId"
],
"properties": {
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"pathUrl": {
"type": "string"
},
"statusId": {
"type": "integer"
}
}
},
"request.PpidDataCategoriesCreateRequest": { "request.PpidDataCategoriesCreateRequest": {
"type": "object", "type": "object",
"required": [ "required": [

View File

@ -2292,9 +2292,76 @@
], ],
"description": "API for getting all MasterMenus", "description": "API for getting all MasterMenus",
"tags": [ "tags": [
"Task" "MasterMenus"
], ],
"summary": "Get all MasterMenus", "summary": "Get all MasterMenus",
"parameters": [
{
"type": "string",
"name": "description",
"in": "query"
},
{
"type": "integer",
"name": "moduleId",
"in": "query"
},
{
"type": "string",
"name": "name",
"in": "query"
},
{
"type": "integer",
"name": "parentMenuId",
"in": "query"
},
{
"type": "integer",
"name": "statusId",
"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": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
@ -2302,28 +2369,22 @@
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -2336,9 +2397,20 @@
], ],
"description": "API for create MasterMenus", "description": "API for create MasterMenus",
"tags": [ "tags": [
"Task" "MasterMenus"
], ],
"summary": "Create MasterMenus", "summary": "Create MasterMenus",
"parameters": [
{
"description": "Required payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.MasterMenusCreateRequest"
}
}
],
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
@ -2346,28 +2418,22 @@
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -2382,7 +2448,7 @@
], ],
"description": "API for getting one MasterMenus", "description": "API for getting one MasterMenus",
"tags": [ "tags": [
"Task" "MasterMenus"
], ],
"summary": "Get one MasterMenus", "summary": "Get one MasterMenus",
"parameters": [ "parameters": [
@ -2401,28 +2467,22 @@
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -2435,9 +2495,9 @@
], ],
"description": "API for update MasterMenus", "description": "API for update MasterMenus",
"tags": [ "tags": [
"Task" "MasterMenus"
], ],
"summary": "update MasterMenus", "summary": "Update MasterMenus",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
@ -2488,9 +2548,9 @@
], ],
"description": "API for delete MasterMenus", "description": "API for delete MasterMenus",
"tags": [ "tags": [
"Task" "MasterMenus"
], ],
"summary": "delete MasterMenus", "summary": "Delete MasterMenus",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
@ -2507,28 +2567,22 @@
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -2543,9 +2597,66 @@
], ],
"description": "API for getting all MasterModules", "description": "API for getting all MasterModules",
"tags": [ "tags": [
"Task" "MasterModules"
], ],
"summary": "Get all MasterModules", "summary": "Get all MasterModules",
"parameters": [
{
"type": "string",
"name": "description",
"in": "query"
},
{
"type": "string",
"name": "name",
"in": "query"
},
{
"type": "integer",
"name": "statusId",
"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": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
@ -2553,28 +2664,22 @@
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -2587,9 +2692,20 @@
], ],
"description": "API for create MasterModules", "description": "API for create MasterModules",
"tags": [ "tags": [
"Task" "MasterModules"
], ],
"summary": "Create MasterModules", "summary": "Create MasterModules",
"parameters": [
{
"description": "Required payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.MasterModulesCreateRequest"
}
}
],
"responses": { "responses": {
"200": { "200": {
"description": "OK", "description": "OK",
@ -2597,28 +2713,22 @@
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -2633,7 +2743,7 @@
], ],
"description": "API for getting one MasterModules", "description": "API for getting one MasterModules",
"tags": [ "tags": [
"Task" "MasterModules"
], ],
"summary": "Get one MasterModules", "summary": "Get one MasterModules",
"parameters": [ "parameters": [
@ -2652,28 +2762,22 @@
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -2686,9 +2790,9 @@
], ],
"description": "API for update MasterModules", "description": "API for update MasterModules",
"tags": [ "tags": [
"Task" "MasterModules"
], ],
"summary": "update MasterModules", "summary": "Update MasterModules",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
@ -2696,6 +2800,15 @@
"name": "id", "name": "id",
"in": "path", "in": "path",
"required": true "required": true
},
{
"description": "Required payload",
"name": "payload",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/request.MasterModulesUpdateRequest"
}
} }
], ],
"responses": { "responses": {
@ -2705,28 +2818,22 @@
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -2739,9 +2846,9 @@
], ],
"description": "API for delete MasterModules", "description": "API for delete MasterModules",
"tags": [ "tags": [
"Task" "MasterModules"
], ],
"summary": "delete MasterModules", "summary": "Delete MasterModules",
"parameters": [ "parameters": [
{ {
"type": "integer", "type": "integer",
@ -2758,28 +2865,22 @@
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.Response"
} }
}, },
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/response.BadRequestError"
}
},
"401": { "401": {
"description": "Unauthorized", "description": "Unauthorized",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.UnauthorizedError"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/response.Response"
}
},
"422": {
"description": "Unprocessable Entity",
"schema": {
"$ref": "#/definitions/response.Response"
} }
}, },
"500": { "500": {
"description": "Internal Server Error", "description": "Internal Server Error",
"schema": { "schema": {
"$ref": "#/definitions/response.Response" "$ref": "#/definitions/response.InternalServerError"
} }
} }
} }
@ -5767,6 +5868,90 @@
} }
} }
}, },
"request.MasterMenusCreateRequest": {
"type": "object",
"required": [
"description",
"icon",
"moduleId",
"name",
"parentMenuId",
"statusId"
],
"properties": {
"description": {
"type": "string"
},
"icon": {
"type": "string"
},
"moduleId": {
"type": "integer"
},
"name": {
"type": "string"
},
"parentMenuId": {
"type": "integer"
},
"position": {
"type": "integer"
},
"statusId": {
"type": "integer"
}
}
},
"request.MasterModulesCreateRequest": {
"type": "object",
"required": [
"description",
"name",
"pathUrl",
"statusId"
],
"properties": {
"description": {
"type": "string"
},
"name": {
"type": "string"
},
"pathUrl": {
"type": "string"
},
"statusId": {
"type": "integer"
}
}
},
"request.MasterModulesUpdateRequest": {
"type": "object",
"required": [
"description",
"id",
"name",
"pathUrl",
"statusId"
],
"properties": {
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"pathUrl": {
"type": "string"
},
"statusId": {
"type": "integer"
}
}
},
"request.PpidDataCategoriesCreateRequest": { "request.PpidDataCategoriesCreateRequest": {
"type": "object", "type": "object",
"required": [ "required": [

View File

@ -185,6 +185,65 @@ definitions:
- id - id
- prov_id - prov_id
type: object type: object
request.MasterMenusCreateRequest:
properties:
description:
type: string
icon:
type: string
moduleId:
type: integer
name:
type: string
parentMenuId:
type: integer
position:
type: integer
statusId:
type: integer
required:
- description
- icon
- moduleId
- name
- parentMenuId
- statusId
type: object
request.MasterModulesCreateRequest:
properties:
description:
type: string
name:
type: string
pathUrl:
type: string
statusId:
type: integer
required:
- description
- name
- pathUrl
- statusId
type: object
request.MasterModulesUpdateRequest:
properties:
description:
type: string
id:
type: integer
name:
type: string
pathUrl:
type: string
statusId:
type: integer
required:
- description
- id
- name
- pathUrl
- statusId
type: object
request.PpidDataCategoriesCreateRequest: request.PpidDataCategoriesCreateRequest:
properties: properties:
description: description:
@ -1984,60 +2043,99 @@ paths:
/master-menus: /master-menus:
get: get:
description: API for getting all MasterMenus description: API for getting all MasterMenus
parameters:
- in: query
name: description
type: string
- in: query
name: moduleId
type: integer
- in: query
name: name
type: string
- in: query
name: parentMenuId
type: integer
- in: query
name: statusId
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: responses:
"200": "200":
description: OK description: OK
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.BadRequestError'
"401": "401":
description: Unauthorized description: Unauthorized
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.UnauthorizedError'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.Response'
"422":
description: Unprocessable Entity
schema:
$ref: '#/definitions/response.Response'
"500": "500":
description: Internal Server Error description: Internal Server Error
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.InternalServerError'
security: security:
- Bearer: [] - Bearer: []
summary: Get all MasterMenus summary: Get all MasterMenus
tags: tags:
- Task - MasterMenus
post: post:
description: API for create MasterMenus description: API for create MasterMenus
parameters:
- description: Required payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/request.MasterMenusCreateRequest'
responses: responses:
"200": "200":
description: OK description: OK
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.BadRequestError'
"401": "401":
description: Unauthorized description: Unauthorized
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.UnauthorizedError'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.Response'
"422":
description: Unprocessable Entity
schema:
$ref: '#/definitions/response.Response'
"500": "500":
description: Internal Server Error description: Internal Server Error
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.InternalServerError'
security: security:
- Bearer: [] - Bearer: []
summary: Create MasterMenus summary: Create MasterMenus
tags: tags:
- Task - MasterMenus
/master-menus/{id}: /master-menus/{id}:
delete: delete:
description: API for delete MasterMenus description: API for delete MasterMenus
@ -2052,27 +2150,23 @@ paths:
description: OK description: OK
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.BadRequestError'
"401": "401":
description: Unauthorized description: Unauthorized
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.UnauthorizedError'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.Response'
"422":
description: Unprocessable Entity
schema:
$ref: '#/definitions/response.Response'
"500": "500":
description: Internal Server Error description: Internal Server Error
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.InternalServerError'
security: security:
- Bearer: [] - Bearer: []
summary: delete MasterMenus summary: Delete MasterMenus
tags: tags:
- Task - MasterMenus
get: get:
description: API for getting one MasterMenus description: API for getting one MasterMenus
parameters: parameters:
@ -2086,27 +2180,23 @@ paths:
description: OK description: OK
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.BadRequestError'
"401": "401":
description: Unauthorized description: Unauthorized
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.UnauthorizedError'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.Response'
"422":
description: Unprocessable Entity
schema:
$ref: '#/definitions/response.Response'
"500": "500":
description: Internal Server Error description: Internal Server Error
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.InternalServerError'
security: security:
- Bearer: [] - Bearer: []
summary: Get one MasterMenus summary: Get one MasterMenus
tags: tags:
- Task - MasterMenus
put: put:
description: API for update MasterMenus description: API for update MasterMenus
parameters: parameters:
@ -2138,66 +2228,99 @@ paths:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.Response'
security: security:
- Bearer: [] - Bearer: []
summary: update MasterMenus summary: Update MasterMenus
tags: tags:
- Task - MasterMenus
/master-modules: /master-modules:
get: get:
description: API for getting all MasterModules description: API for getting all MasterModules
parameters:
- in: query
name: description
type: string
- in: query
name: name
type: string
- in: query
name: statusId
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: responses:
"200": "200":
description: OK description: OK
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.BadRequestError'
"401": "401":
description: Unauthorized description: Unauthorized
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.UnauthorizedError'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.Response'
"422":
description: Unprocessable Entity
schema:
$ref: '#/definitions/response.Response'
"500": "500":
description: Internal Server Error description: Internal Server Error
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.InternalServerError'
security: security:
- Bearer: [] - Bearer: []
summary: Get all MasterModules summary: Get all MasterModules
tags: tags:
- Task - MasterModules
post: post:
description: API for create MasterModules description: API for create MasterModules
parameters:
- description: Required payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/request.MasterModulesCreateRequest'
responses: responses:
"200": "200":
description: OK description: OK
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.BadRequestError'
"401": "401":
description: Unauthorized description: Unauthorized
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.UnauthorizedError'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.Response'
"422":
description: Unprocessable Entity
schema:
$ref: '#/definitions/response.Response'
"500": "500":
description: Internal Server Error description: Internal Server Error
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.InternalServerError'
security: security:
- Bearer: [] - Bearer: []
summary: Create MasterModules summary: Create MasterModules
tags: tags:
- Task - MasterModules
/master-modules/{id}: /master-modules/{id}:
delete: delete:
description: API for delete MasterModules description: API for delete MasterModules
@ -2212,27 +2335,23 @@ paths:
description: OK description: OK
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.BadRequestError'
"401": "401":
description: Unauthorized description: Unauthorized
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.UnauthorizedError'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.Response'
"422":
description: Unprocessable Entity
schema:
$ref: '#/definitions/response.Response'
"500": "500":
description: Internal Server Error description: Internal Server Error
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.InternalServerError'
security: security:
- Bearer: [] - Bearer: []
summary: delete MasterModules summary: Delete MasterModules
tags: tags:
- Task - MasterModules
get: get:
description: API for getting one MasterModules description: API for getting one MasterModules
parameters: parameters:
@ -2246,27 +2365,23 @@ paths:
description: OK description: OK
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.BadRequestError'
"401": "401":
description: Unauthorized description: Unauthorized
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.UnauthorizedError'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.Response'
"422":
description: Unprocessable Entity
schema:
$ref: '#/definitions/response.Response'
"500": "500":
description: Internal Server Error description: Internal Server Error
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.InternalServerError'
security: security:
- Bearer: [] - Bearer: []
summary: Get one MasterModules summary: Get one MasterModules
tags: tags:
- Task - MasterModules
put: put:
description: API for update MasterModules description: API for update MasterModules
parameters: parameters:
@ -2275,32 +2390,34 @@ paths:
name: id name: id
required: true required: true
type: integer type: integer
- description: Required payload
in: body
name: payload
required: true
schema:
$ref: '#/definitions/request.MasterModulesUpdateRequest'
responses: responses:
"200": "200":
description: OK description: OK
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.Response'
"400":
description: Bad Request
schema:
$ref: '#/definitions/response.BadRequestError'
"401": "401":
description: Unauthorized description: Unauthorized
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.UnauthorizedError'
"404":
description: Not Found
schema:
$ref: '#/definitions/response.Response'
"422":
description: Unprocessable Entity
schema:
$ref: '#/definitions/response.Response'
"500": "500":
description: Internal Server Error description: Internal Server Error
schema: schema:
$ref: '#/definitions/response.Response' $ref: '#/definitions/response.InternalServerError'
security: security:
- Bearer: [] - Bearer: []
summary: update MasterModules summary: Update MasterModules
tags: tags:
- Task - MasterModules
/master-statuses: /master-statuses:
get: get:
description: API for getting all MasterStatuses description: API for getting all MasterStatuses