diff --git a/routers/router/api/v1/user/auth.go b/routers/router/api/v1/user/auth.go index 7efd67d..a2a33fc 100644 --- a/routers/router/api/v1/user/auth.go +++ b/routers/router/api/v1/user/auth.go @@ -67,6 +67,20 @@ func UserLogin(c *fiber.Ctx) error { return c.JSON(structs.UserLoginResponse{Session: session}) } +func UserLogout(c *fiber.Ctx) error { + session := utils.GetXAuhorizationHeader(c) + + if len(session) != utils.LenHeaderXAuthorization { + return c.SendStatus(fiber.StatusUnauthorized) + } + + log.Info().Msg(session) + + database.DB.Delete(&structs.UserSession{}, "id = ?", session) + + return c.SendStatus(fiber.StatusCreated) +} + func validatePasswordLength(password string) bool { lenPassword := len(password)