fix in u
This commit is contained in:
@@ -218,6 +218,22 @@ def ratio_groups_save():
|
||||
|
||||
|
||||
|
||||
@bp.delete("/ratio-groups/<int:group_id>")
|
||||
def ratio_groups_delete(group_id: int):
|
||||
profile = request_profile()
|
||||
if not profile:
|
||||
return jsonify({"ok": False, "error": "No profile"}), 400
|
||||
if not auth.can_write_profile(int(profile["id"]), default_user_id()):
|
||||
return jsonify({"ok": False, "error": "No write access to profile"}), 403
|
||||
with connect() as conn:
|
||||
# Note: Deleting a ratio group removes only the group definition and its assignment links; history stays as an audit trail.
|
||||
deleted = conn.execute("DELETE FROM ratio_groups WHERE id=? AND profile_id=?", (int(group_id), int(profile["id"]))).rowcount
|
||||
conn.execute("DELETE FROM ratio_assignments WHERE group_id=? AND profile_id=?", (int(group_id), int(profile["id"])))
|
||||
if not deleted:
|
||||
return jsonify({"ok": False, "error": "Ratio group not found"}), 404
|
||||
return ratio_groups_list()
|
||||
|
||||
|
||||
@bp.post("/ratio-groups/check")
|
||||
def ratio_groups_check():
|
||||
profile = request_profile()
|
||||
|
||||
Reference in New Issue
Block a user