diff --git a/action.go b/action.go index 6ea86f2..b94c5b2 100644 --- a/action.go +++ b/action.go @@ -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) } diff --git a/constant.go b/constant.go deleted file mode 100644 index fe98da9..0000000 --- a/constant.go +++ /dev/null @@ -1,6 +0,0 @@ -package usermngmt - -// Constant ... -const ( - tablePrefixDefault = "usermngmt" -) diff --git a/internal/constant.go b/internal/constant.go index c41e88b..c048f83 100644 --- a/internal/constant.go +++ b/internal/constant.go @@ -5,4 +5,6 @@ const ( timezoneHCM = "Asia/Ho_Chi_Minh" passwordHashingCost = 14 + + TablePrefixDefault = "usermngmt" ) diff --git a/model/role_request.go b/model/role_request.go index db992a0..81a8e0f 100644 --- a/model/role_request.go +++ b/model/role_request.go @@ -4,4 +4,3 @@ package model type RoleCreateOptions struct { Name string } - diff --git a/model/role_response.go b/model/role_response.go index 117cf85..abe20f0 100644 --- a/model/role_response.go +++ b/model/role_response.go @@ -5,4 +5,4 @@ type RoleShort struct { ID string `json:"_id"` Name string `json:"name"` IsAdmin bool `json:"isAdmin"` -} \ No newline at end of file +} diff --git a/usermngmt.go b/usermngmt.go index 8df9586..b2a2236 100644 --- a/usermngmt.go +++ b/usermngmt.go @@ -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