From 616a151764fd1780eb0b6dc039d5a21539a8a01a Mon Sep 17 00:00:00 2001 From: Vidhu Kant Sharma Date: Sun, 3 Sep 2023 00:19:03 +0530 Subject: added login with id --- user/controller.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'user/controller.go') diff --git a/user/controller.go b/user/controller.go index abdcc5b..4933ea3 100644 --- a/user/controller.go +++ b/user/controller.go @@ -37,3 +37,22 @@ func handleGetUser (ctx *gin.Context) { "data": user, }) } + +func handleDelUser (ctx *gin.Context) { + id := uint(1) // get from JWT + + var user User + user.ID = id + + // TODO: add a verification mechanism + err := user.del() + if err != nil { + ctx.Error(err) + ctx.Abort() + return + } + + ctx.JSON(http.StatusOK, gin.H{ + "message": "success", + }) +} -- cgit v1.2.3