fix comment

This commit is contained in:
Hoang 2021-11-10 15:00:36 +07:00
parent 95ac63e287
commit 02653fd7aa
3 changed files with 8 additions and 7 deletions

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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(),
},
}