2021-11-10 04:01:39 +00:00
|
|
|
package model
|
|
|
|
|
2021-11-10 07:50:43 +00:00
|
|
|
import (
|
|
|
|
"errors"
|
|
|
|
|
|
|
|
"github.com/Selly-Modules/logger"
|
|
|
|
)
|
|
|
|
|
2021-11-10 04:01:39 +00:00
|
|
|
// RoleCreateOptions ...
|
|
|
|
type RoleCreateOptions struct {
|
2021-11-12 05:16:38 +00:00
|
|
|
Name string
|
|
|
|
Level int
|
2021-11-10 04:01:39 +00:00
|
|
|
}
|
2021-11-10 07:50:43 +00:00
|
|
|
|
|
|
|
// RoleUpdateOptions ...
|
|
|
|
type RoleUpdateOptions struct {
|
2021-11-12 05:16:38 +00:00
|
|
|
Name string
|
|
|
|
Level int
|
2021-11-10 07:50:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// RoleAllQuery ...
|
|
|
|
type RoleAllQuery struct {
|
|
|
|
Page int64
|
|
|
|
Limit int64
|
2021-11-16 07:26:50 +00:00
|
|
|
Sort interface{}
|
2021-11-10 07:50:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Validate ...
|
|
|
|
func (co RoleCreateOptions) Validate() error {
|
|
|
|
// Name
|
|
|
|
if co.Name == "" {
|
|
|
|
logger.Error("usermngmt - Role - Create: no name data", logger.LogData{
|
|
|
|
"payload": co,
|
|
|
|
})
|
|
|
|
return errors.New("no name data")
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Validate ...
|
|
|
|
func (co RoleUpdateOptions) Validate() error {
|
|
|
|
// Name
|
|
|
|
if co.Name == "" {
|
|
|
|
logger.Error("usermngmt - Role - Update: no name data", logger.LogData{
|
|
|
|
"payload": co,
|
|
|
|
})
|
|
|
|
return errors.New("no name data")
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|