74 lines
2.2 KiB
Go
74 lines
2.2 KiB
Go
package request
|
|
|
|
import (
|
|
"netidhub-saas-be/app/database/entity"
|
|
"netidhub-saas-be/utils/paginator"
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type MenuActionsQueryRequest struct {
|
|
MenuId *uint `query:"menu_id"`
|
|
ActionCode *string `query:"action_code"`
|
|
ClientId *uuid.UUID `query:"client_id"`
|
|
Pagination *paginator.Pagination `query:"pagination"`
|
|
}
|
|
|
|
type MenuActionsCreateRequest struct {
|
|
MenuId uint `json:"menuId" validate:"required"`
|
|
ActionCode string `json:"actionCode" validate:"required"`
|
|
ActionName string `json:"actionName" validate:"required"`
|
|
Description *string `json:"description"`
|
|
PathUrl *string `json:"pathUrl"`
|
|
HttpMethod *string `json:"httpMethod"`
|
|
Position *int `json:"position"`
|
|
ClientId *uuid.UUID `json:"clientId"`
|
|
IsActive *bool `json:"isActive"`
|
|
}
|
|
|
|
func (req MenuActionsCreateRequest) ToEntity() *entity.MenuActions {
|
|
return &entity.MenuActions{
|
|
MenuId: req.MenuId,
|
|
ActionCode: req.ActionCode,
|
|
ActionName: req.ActionName,
|
|
Description: req.Description,
|
|
PathUrl: req.PathUrl,
|
|
HttpMethod: req.HttpMethod,
|
|
Position: req.Position,
|
|
ClientId: req.ClientId,
|
|
IsActive: req.IsActive,
|
|
}
|
|
}
|
|
|
|
type MenuActionsUpdateRequest struct {
|
|
MenuId uint `json:"menuId"`
|
|
ActionCode string `json:"actionCode"`
|
|
ActionName string `json:"actionName" validate:"required"`
|
|
Description *string `json:"description"`
|
|
PathUrl *string `json:"pathUrl"`
|
|
HttpMethod *string `json:"httpMethod"`
|
|
Position *int `json:"position"`
|
|
ClientId *uuid.UUID `json:"clientId"`
|
|
IsActive *bool `json:"isActive"`
|
|
}
|
|
|
|
func (req MenuActionsUpdateRequest) ToEntity() *entity.MenuActions {
|
|
return &entity.MenuActions{
|
|
MenuId: req.MenuId,
|
|
ActionCode: req.ActionCode,
|
|
ActionName: req.ActionName,
|
|
Description: req.Description,
|
|
PathUrl: req.PathUrl,
|
|
HttpMethod: req.HttpMethod,
|
|
Position: req.Position,
|
|
ClientId: req.ClientId,
|
|
IsActive: req.IsActive,
|
|
}
|
|
}
|
|
|
|
type MenuActionsBatchCreateRequest struct {
|
|
MenuId uint `json:"menuId" validate:"required"`
|
|
ActionCodes []string `json:"actionCodes" validate:"required,min=1"`
|
|
ClientId *uuid.UUID `json:"clientId"`
|
|
}
|
|
|