feat(db): add missing changelog import

This commit is contained in:
2021-11-05 00:10:41 +01:00
parent 2676b09728
commit 3efbec281d
3 changed files with 7 additions and 1 deletions

View File

@@ -14,7 +14,7 @@ func (db *Database) GetAllAccountOfUser(id string) ([]*Account, error) {
FROM public.account a
WHERE a.id = $1
`
rows, err := db.Session.Query(q)
rows, err := db.Session.Query(q, id)
if err != nil {
return nil, err
}

View File

@@ -3,6 +3,7 @@ package user
import (
"nos-comptes/internal/storage/dao"
"nos-comptes/internal/storage/model"
"nos-comptes/internal/utils"
)
type Service struct {
@@ -16,6 +17,7 @@ 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
@@ -35,6 +37,7 @@ 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: