package users import ( "context" "net/http" "fr.latosa-escrima/core" "fr.latosa-escrima/core/models" ) func HandleRemoveRole(w http.ResponseWriter, r *http.Request) { ctx := context.Background() user_id := r.PathValue("user_uuid") role_id := r.PathValue("role_id") _, err := core.DB.NewDelete().Model((*models.UserToRole)(nil)). Where("user_id = ? AND role_id = ?", user_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: "Role removed.", }.Respond(w, http.StatusOK) }