usermngmt/action.go

38 lines
951 B
Go
Raw Normal View History

2021-11-10 01:44:22 +00:00
package usermngmt
2021-11-10 02:54:49 +00:00
import (
2021-11-10 04:01:39 +00:00
"github.com/Selly-Modules/usermngmt/model"
2021-11-10 04:42:23 +00:00
"github.com/Selly-Modules/usermngmt/role"
"github.com/Selly-Modules/usermngmt/user"
2021-11-10 02:54:49 +00:00
)
2021-11-10 01:44:22 +00:00
// Create ...
2021-11-10 04:01:39 +00:00
func (s Service) Create(payload model.UserCreateOptions) error {
2021-11-10 04:42:23 +00:00
return user.Create(payload)
2021-11-10 01:44:22 +00:00
}
// Update ...
2021-11-10 04:01:39 +00:00
func (s Service) Update(userID string, payload model.UserUpdateOptions) error {
2021-11-10 04:42:23 +00:00
return user.UpdateByUserID(userID, payload)
2021-11-10 01:44:22 +00:00
}
// ChangeUserPassword ...
2021-11-10 02:54:49 +00:00
func (s Service) ChangeUserPassword(userID string, payload model.ChangePasswordOptions) error {
2021-11-10 04:42:23 +00:00
return user.ChangeUserPassword(userID, payload)
2021-11-10 01:44:22 +00:00
}
2021-11-10 04:42:23 +00:00
// ChangeUserStatus ...
2021-11-10 01:44:22 +00:00
func (s Service) ChangeUserStatus(userID, newStatus string) error {
2021-11-10 04:42:23 +00:00
return user.ChangeUserStatus(userID, newStatus)
2021-11-10 01:44:22 +00:00
}
2021-11-10 04:42:23 +00:00
// All ...
2021-11-10 04:01:39 +00:00
func (s Service) All(query model.UserAllQuery) model.UserAll {
2021-11-10 04:42:23 +00:00
return user.All(query)
2021-11-10 01:44:22 +00:00
}
2021-11-10 04:42:23 +00:00
// RoleCreate ...
2021-11-10 02:54:49 +00:00
func (s Service) RoleCreate(payload model.RoleCreateOptions) error {
2021-11-10 04:42:23 +00:00
return role.Create(payload)
2021-11-10 01:44:22 +00:00
}