moved to struct validation;

This commit is contained in:
Alex
2024-11-04 17:21:55 +01:00
parent 0fa57bfe75
commit fa10a0a507
15 changed files with 246 additions and 275 deletions

View File

@@ -23,7 +23,7 @@ type UserServiceInterface interface {
GetUserByID(id uint) (*models.User, error)
GetUsers(where map[string]interface{}) (*[]models.User, error)
VerifyUser(token *string) (*models.User, error)
UpdateUser(user *models.User, userRole int8) (*models.User, error)
UpdateUser(user *models.User) (*models.User, error)
}
type UserService struct {
@@ -31,7 +31,11 @@ type UserService struct {
Licences repositories.LicenceInterface
}
func (service *UserService) UpdateUser(user *models.User, userRole int8) (*models.User, error) {
func (service *UserService) UpdateUser(user *models.User) (*models.User, error) {
if user.ID == 0 {
return nil, errors.ErrUserNotFound
}
if user.Password != "" {
setPassword(user.Password, user)