Files
latosa-escrima/backend/api/users/delete.go
cdricms 501ffaea17 Reorganized API + added db migrations
Read the README file for more informations
2025-01-28 17:41:05 +01:00

32 lines
585 B
Go

package users
import (
"context"
"net/http"
"fr.latosa-escrima/api/core"
)
func HandleDelete(w http.ResponseWriter, r *http.Request) {
uuid := r.PathValue("user_uuid")
_, err := core.DB.NewDelete().
Model((*core.User)(nil)).
Where("user_id = ?", uuid).
Exec(context.Background())
if err != nil {
core.JSONError{
Status: core.Error,
Message: err.Error(),
}.Respond(w, http.StatusInternalServerError)
return
}
// TODO : Remove password
core.JSONSuccess{
Status: core.Success,
Message: "User deleted.",
Data: nil,
}.Respond(w, http.StatusOK)
}