generated from VLADIMIR/template
add add user method
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package users_service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"evening_detective_server/internal/repos/users_repo"
|
||||
)
|
||||
|
||||
type UsersService struct {
|
||||
usersRepo *users_repo.UsersRepo
|
||||
}
|
||||
|
||||
func NewUsersService(usersRepo *users_repo.UsersRepo) *UsersService {
|
||||
return &UsersService{
|
||||
usersRepo: usersRepo,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *UsersService) AddUser(
|
||||
ctx context.Context,
|
||||
username string,
|
||||
email string,
|
||||
) error {
|
||||
err := s.usersRepo.AddUser(
|
||||
ctx,
|
||||
username,
|
||||
email,
|
||||
"hello", // TODO: generate password and send email
|
||||
"user",
|
||||
)
|
||||
return err
|
||||
}
|
||||
Reference in New Issue
Block a user