fix comment
This commit is contained in:
parent
95ac63e287
commit
02653fd7aa
|
@ -58,7 +58,7 @@ func (s Service) UpdateRole(roleID string, payload model.RoleUpdateOptions) erro
|
|||
return role.Update(roleID, payload)
|
||||
}
|
||||
|
||||
// GetAllRole ...
|
||||
func (s Service) GetAllRole(query model.RoleAllQuery) model.RoleAll {
|
||||
// GetAllRoles ...
|
||||
func (s Service) GetAllRoles(query model.RoleAllQuery) model.RoleAll {
|
||||
return role.All(query)
|
||||
}
|
||||
|
|
|
@ -38,10 +38,11 @@ func GetSearchString(fieldList ...string) string {
|
|||
return fmt.Sprintf(format, searchList...)
|
||||
}
|
||||
|
||||
// GetCode ...
|
||||
func GetCode(s string) string {
|
||||
// GenerateCode ...
|
||||
func GenerateCode(s string) string {
|
||||
var (
|
||||
underscore = "_"
|
||||
emptySpace = " "
|
||||
)
|
||||
return strings.ReplaceAll(mongodb.NonAccentVietnamese(s), " ", underscore)
|
||||
return strings.ReplaceAll(mongodb.NonAccentVietnamese(s), emptySpace, underscore)
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ func newRole(payload model.RoleCreateOptions) model.DBRole {
|
|||
return model.DBRole{
|
||||
ID: mongodb.NewObjectID(),
|
||||
Name: payload.Name,
|
||||
Code: internal.GetCode(payload.Name),
|
||||
Code: internal.GenerateCode(payload.Name),
|
||||
CreatedAt: timeNow,
|
||||
UpdatedAt: timeNow,
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ func Update(roleID string, payload model.RoleUpdateOptions) error {
|
|||
updateData := bson.M{
|
||||
"$set": bson.M{
|
||||
"name": payload.Name,
|
||||
"code": internal.GetCode(payload.Name),
|
||||
"code": internal.GenerateCode(payload.Name),
|
||||
"updatedAt": internal.Now(),
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue