Skip to content

Commit

Permalink
fix get implementation user returned 404 always
Browse files Browse the repository at this point in the history
  • Loading branch information
konrad2002 committed Dec 5, 2024
1 parent 98d044a commit 74e8a67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion controller/notification_user_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func getNotificationUser(c *gin.Context) {
return
}

notificationUser, err2 := service.GetNotificationUserById(user.Identifier)
notificationUser, err2 := service.GetNotificationUserByUserId(user.Identifier)
if err2 != nil {
c.IndentedJSON(http.StatusNotFound, gin.H{"message": err2.Error()})
return
Expand Down
4 changes: 4 additions & 0 deletions service/notification_user_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func GetNotificationUserById(id primitive.ObjectID) (model.NotificationUser, err
return getNotificationUserByBsonDocument(bson.D{{"_id", id}})
}

func GetNotificationUserByUserId(id primitive.ObjectID) (model.NotificationUser, error) {
return getNotificationUserByBsonDocument(bson.D{{"user_id", id}})
}

func GetNotificationUserByToken(token string) (model.NotificationUser, error) {
return getNotificationUserByBsonDocument(bson.D{{"token", token}})
}
Expand Down

0 comments on commit 74e8a67

Please sign in to comment.