17 lines
497 B
Go
17 lines
497 B
Go
package user
|
|
|
|
import (
|
|
"context"
|
|
"example.com/userService/internal/model"
|
|
repo "example.com/userService/internal/repository/user"
|
|
"example.com/userService/internal/types"
|
|
)
|
|
|
|
func (s *Service) CreateUser(ctx context.Context, req *types.CreateUserReq) (*types.UserResp, error) {
|
|
input, err := normalize(req.Name, req.Email)
|
|
if err != nil {
|
|
return nil, s.failure(ctx, err)
|
|
}
|
|
return s.mutate(ctx, "created", func(r repo.UserRepository) (model.User, error) { return r.Create(ctx, input) })
|
|
}
|