package roles import ( "context" "net/http" "fr.latosa-escrima/core" "fr.latosa-escrima/core/models" ) func HandleRemovePermission(w http.ResponseWriter, r *http.Request) { ctx := context.Background() role_id := r.PathValue("role_uuid") permission_id := r.PathValue("permission_id") _, err := core.DB.NewDelete().Model((*models.PermissionToRole)(nil)). Where("permission_id = ? AND role_id = ?", permission_id, role_id). Exec(ctx) if err != nil { core.JSONError{ Status: core.Error, Message: err.Error(), }.Respond(w, http.StatusInternalServerError) return } core.JSONSuccess{ Status: core.Success, Message: "Permission removed.", }.Respond(w, http.StatusOK) }