fix comment again

This commit is contained in:
Hoang 2021-11-10 12:07:58 +07:00
parent d423c25256
commit b954532159
6 changed files with 25 additions and 17 deletions

View File

@ -6,13 +6,19 @@ import (
"github.com/Selly-Modules/usermngmt/user" "github.com/Selly-Modules/usermngmt/user"
) )
// Create ... //
func (s Service) Create(payload model.UserCreateOptions) error { // User
//
// user methods
// CreateUser ...
func (s Service) CreateUser(payload model.UserCreateOptions) error {
return user.Create(payload) return user.Create(payload)
} }
// Update ... // UpdateUser ...
func (s Service) Update(userID string, payload model.UserUpdateOptions) error { func (s Service) UpdateUser(userID string, payload model.UserUpdateOptions) error {
return user.UpdateByUserID(userID, payload) return user.UpdateByUserID(userID, payload)
} }
@ -26,12 +32,18 @@ func (s Service) ChangeUserStatus(userID, newStatus string) error {
return user.ChangeUserStatus(userID, newStatus) return user.ChangeUserStatus(userID, newStatus)
} }
// All ... // GetAllUser ...
func (s Service) All(query model.UserAllQuery) model.UserAll { func (s Service) GetAllUser(query model.UserAllQuery) model.UserAll {
return user.All(query) return user.All(query)
} }
// RoleCreate ... //
func (s Service) RoleCreate(payload model.RoleCreateOptions) error { // Role
//
// role methods
// CreateRole ...
func (s Service) CreateRole(payload model.RoleCreateOptions) error {
return role.Create(payload) return role.Create(payload)
} }

View File

@ -1,6 +0,0 @@
package usermngmt
// Constant ...
const (
tablePrefixDefault = "usermngmt"
)

View File

@ -5,4 +5,6 @@ const (
timezoneHCM = "Asia/Ho_Chi_Minh" timezoneHCM = "Asia/Ho_Chi_Minh"
passwordHashingCost = 14 passwordHashingCost = 14
TablePrefixDefault = "usermngmt"
) )

View File

@ -4,4 +4,3 @@ package model
type RoleCreateOptions struct { type RoleCreateOptions struct {
Name string Name string
} }

View File

@ -5,4 +5,4 @@ type RoleShort struct {
ID string `json:"_id"` ID string `json:"_id"`
Name string `json:"name"` Name string `json:"name"`
IsAdmin bool `json:"isAdmin"` IsAdmin bool `json:"isAdmin"`
} }

View File

@ -6,6 +6,7 @@ import (
"github.com/Selly-Modules/mongodb" "github.com/Selly-Modules/mongodb"
"github.com/Selly-Modules/usermngmt/database" "github.com/Selly-Modules/usermngmt/database"
"github.com/Selly-Modules/usermngmt/internal"
) )
// MongoDBConfig ... // MongoDBConfig ...
@ -36,7 +37,7 @@ func Init(config Config) (*Service, error) {
// If prefixTable is empty then it is usermngmt // If prefixTable is empty then it is usermngmt
if config.TablePrefix == "" { if config.TablePrefix == "" {
config.TablePrefix = tablePrefixDefault config.TablePrefix = internal.TablePrefixDefault
} }
// Connect MongoDB // Connect MongoDB