Feature/role create #5

Merged
lqhoang99 merged 8 commits from feature/RoleCreate into master 2021-11-10 06:43:29 +00:00
6 changed files with 25 additions and 17 deletions
Showing only changes of commit b954532159 - Show all commits

View File

@ -6,13 +6,19 @@ import (
"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)
}
// Update ...
func (s Service) Update(userID string, payload model.UserUpdateOptions) error {
// UpdateUser ...
func (s Service) UpdateUser(userID string, payload model.UserUpdateOptions) error {
return user.UpdateByUserID(userID, payload)
}
@ -26,12 +32,18 @@ func (s Service) ChangeUserStatus(userID, newStatus string) error {
return user.ChangeUserStatus(userID, newStatus)
}
// All ...
func (s Service) All(query model.UserAllQuery) model.UserAll {
// GetAllUser ...
func (s Service) GetAllUser(query model.UserAllQuery) model.UserAll {
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)
}

View File

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

View File

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

View File

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

View File

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