32 lines
585 B
Go
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)
|
|
}
|