feat(accounts): improve account creation

This commit is contained in:
2021-11-12 00:38:44 +01:00
parent 78071a6a91
commit 7bf8db8050
5 changed files with 24 additions and 19 deletions

View File

@@ -3,7 +3,6 @@ package user
import (
"nos-comptes/internal/storage/dao"
"nos-comptes/internal/storage/model"
"nos-comptes/internal/utils"
)
type Service struct {
@@ -17,7 +16,6 @@ func NewService(database *Database) *Service {
func (s *Service) GetUserById(userId string) (*User, error) {
user, err := s.db.GetUsersByID(userId)
if e, ok := err.(*dao.Error); ok {
utils.GetLogger().Warn(err)
switch {
case e.Type == dao.ErrTypeNotFound:
return nil, &model.ErrNotFound
@@ -37,7 +35,6 @@ func (s *Service) GetUserById(userId string) (*User, error) {
func (us *Service) GetUserFromGoogleID(googleUserID string) (*User, error) {
user, err := us.db.GetUsersByGoogleID(googleUserID)
if err != nil {
utils.GetLogger().Warn(err)
if castedError, ok := err.(*dao.Error); ok {
switch castedError.Type {
case dao.ErrTypeNotFound: