From 8ce554b6d7655c6f68df586d2c5afb6efe5704bc Mon Sep 17 00:00:00 2001 From: smavros Date: Thu, 15 Aug 2019 14:34:35 +0200 Subject: [PATCH] Modifies user/ endpoint: Functions `addUser()`, `updateUser()` and `deleteUser()` now return a body of `{ "id": $userID }`. --- routes/user/user_endpoints.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/routes/user/user_endpoints.go b/routes/user/user_endpoints.go index e427ca8..691d5fd 100644 --- a/routes/user/user_endpoints.go +++ b/routes/user/user_endpoints.go @@ -226,7 +226,7 @@ func addUser(c *gin.Context) { } c.JSON(http.StatusOK, gin.H{ - "user": fmt.Sprintf(newUser.Username), + "id": newUser.ID, }) } @@ -320,7 +320,7 @@ func updateUser(c *gin.Context) { } c.JSON(http.StatusOK, gin.H{ - "user": fmt.Sprintf(updatedUser.Username), + "id": updatedUser.ID, }) } @@ -393,5 +393,7 @@ func deleteUser(c *gin.Context) { return } - c.JSON(http.StatusOK, gin.H{}) + c.JSON(http.StatusOK, gin.H{ + "id": user.ID, + }) }