"""Shared API response helpers. Used by all API blueprints to produce consistent JSON responses per the API response contract: ``{"ok": true, "data": }`` / ``{"ok": false, "error": "msg"}``. """ from flask import jsonify def _ok(data=None): """Return a success JSON response.""" return jsonify({"ok": True, "data": data}) def _error(msg: str, code: int = 400): """Return an error JSON response with the given HTTP status code.""" return jsonify({"ok": False, "error": msg}), code