v1.0.0: import: import code from accounts

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2024-03-14 14:01:58 +01:00
commit 7f7fd9395c
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
8 changed files with 369 additions and 0 deletions

21
cmd/login.go Normal file
View file

@ -0,0 +1,21 @@
package main
import (
"net/http"
"github.com/labstack/echo/v4"
logins "gitlab.g3e.fr/h6n/users/internal"
)
func login(c echo.Context) error {
var request logins.RequestLogin
if err := c.Bind(&request); err != nil {
return c.JSON(http.StatusBadRequest, err)
}
if response, err := logins.CreateLogin(db, request); err != nil {
return c.JSON(http.StatusBadRequest, "Not a valide user username or password")
} else {
return c.JSON(http.StatusOK, response)
}
}