fix(query): added conditions
added the condition for the id
This commit is contained in:
parent
85d7905e8a
commit
3e13046706
@ -70,7 +70,7 @@ func GetUserSourceByID(ctx context.Context, id models.UserSourceID) (models.User
|
|||||||
return models.UserSource{}, &otterError.EntityValidationFailed{Reason: otterError.UserSourceIDToShort}
|
return models.UserSource{}, &otterError.EntityValidationFailed{Reason: otterError.UserSourceIDToShort}
|
||||||
}
|
}
|
||||||
|
|
||||||
result := client.WithContext(ctx).First(&user, id)
|
result := client.WithContext(ctx).First(&user, "id = ?", id)
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
if errors.Is(result.Error, gorm.ErrRecordNotFound) {
|
||||||
return models.UserSource{}, &otterError.Database{Reason: otterError.NoDataFound}
|
return models.UserSource{}, &otterError.Database{Reason: otterError.NoDataFound}
|
||||||
|
Loading…
Reference in New Issue
Block a user