@@ -87,7 +87,7 @@ func CreateUser(c *gin.Context) {
8787 }
8888
8989 // send API call to capture the created user
90- user , _ := database .FromContext (c ).GetUserName (input .GetName ())
90+ user , _ := database .FromContext (c ).GetUserForName (input .GetName ())
9191
9292 c .JSON (http .StatusCreated , user )
9393}
@@ -172,18 +172,8 @@ func GetUsers(c *gin.Context) {
172172 // ensure per_page isn't above or below allowed values
173173 perPage = util .MaxInt (1 , util .MinInt (100 , perPage ))
174174
175- // send API call to capture the total number of users
176- t , err := database .FromContext (c ).GetUserCount ()
177- if err != nil {
178- retErr := fmt .Errorf ("unable to get users count: %w" , err )
179-
180- util .HandleError (c , http .StatusInternalServerError , retErr )
181-
182- return
183- }
184-
185175 // send API call to capture the list of users
186- users , err := database .FromContext (c ).GetUserLiteList (page , perPage )
176+ users , t , err := database .FromContext (c ).ListLiteUsers (page , perPage )
187177 if err != nil {
188178 retErr := fmt .Errorf ("unable to get users: %w" , err )
189179
@@ -311,7 +301,7 @@ func UpdateCurrentUser(c *gin.Context) {
311301 }
312302
313303 // send API call to capture the updated user
314- u , err = database .FromContext (c ).GetUserName (u .GetName ())
304+ u , err = database .FromContext (c ).GetUserForName (u .GetName ())
315305 if err != nil {
316306 retErr := fmt .Errorf ("unable to get updated user %s: %w" , u .GetName (), err )
317307
@@ -363,7 +353,7 @@ func GetUser(c *gin.Context) {
363353 }).Infof ("reading user %s" , user )
364354
365355 // send API call to capture the user
366- u , err := database .FromContext (c ).GetUserName (user )
356+ u , err := database .FromContext (c ).GetUserForName (user )
367357 if err != nil {
368358 retErr := fmt .Errorf ("unable to get user %s: %w" , user , err )
369359
@@ -548,7 +538,7 @@ func UpdateUser(c *gin.Context) {
548538 }
549539
550540 // send API call to capture the user
551- u , err = database .FromContext (c ).GetUserName (user )
541+ u , err = database .FromContext (c ).GetUserForName (user )
552542 if err != nil {
553543 retErr := fmt .Errorf ("unable to get user %s: %w" , user , err )
554544
@@ -584,7 +574,7 @@ func UpdateUser(c *gin.Context) {
584574 }
585575
586576 // send API call to capture the updated user
587- u , _ = database .FromContext (c ).GetUserName (user )
577+ u , _ = database .FromContext (c ).GetUserForName (user )
588578
589579 c .JSON (http .StatusOK , u )
590580}
@@ -633,7 +623,7 @@ func DeleteUser(c *gin.Context) {
633623 }).Infof ("deleting user %s" , user )
634624
635625 // send API call to capture the user
636- u , err := database .FromContext (c ).GetUserName (user )
626+ u , err := database .FromContext (c ).GetUserForName (user )
637627 if err != nil {
638628 retErr := fmt .Errorf ("unable to get user %s: %w" , user , err )
639629
@@ -643,7 +633,7 @@ func DeleteUser(c *gin.Context) {
643633 }
644634
645635 // send API call to remove the user
646- err = database .FromContext (c ).DeleteUser (u . GetID () )
636+ err = database .FromContext (c ).DeleteUser (u )
647637 if err != nil {
648638 retErr := fmt .Errorf ("unable to delete user %s: %w" , u .GetName (), err )
649639
0 commit comments