Reorganization of backend + new routes
This commit is contained in:
@@ -1 +1,30 @@
|
||||
package roles
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"fr.latosa-escrima/core"
|
||||
"fr.latosa-escrima/core/models"
|
||||
)
|
||||
|
||||
func HandleDelete(w http.ResponseWriter, r *http.Request) {
|
||||
uuid := r.PathValue("role_uuid")
|
||||
_, err := core.DB.NewDelete().
|
||||
Model((*models.Role)(nil)).
|
||||
Where("id = ?", uuid).
|
||||
Exec(context.Background())
|
||||
if err != nil {
|
||||
core.JSONError{
|
||||
Status: core.Error,
|
||||
Message: err.Error(),
|
||||
}.Respond(w, http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
// TODO: Check SQL Result
|
||||
core.JSONSuccess{
|
||||
Status: core.Success,
|
||||
Message: "Role deteled",
|
||||
}.Respond(w, http.StatusOK)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user