diff --git a/backend/baekje_api.py b/backend/baekje_api.py index a4417c7..b8ff837 100644 --- a/backend/baekje_api.py +++ b/backend/baekje_api.py @@ -233,3 +233,30 @@ def api_search_for_order(): result['count'] = len(filtered) return jsonify(result) + + +# ========== 잔고 조회 ========== + +@baekje_bp.route('/balance', methods=['GET']) +def api_get_balance(): + """ + 잔고액 조회 + + GET /api/baekje/balance + GET /api/baekje/balance?year=2026 + + Returns: + { + "success": true, + "balance": 14193234, + "monthly": [ + {"month": "2026-03", "sales": 6935133, "balance": 14193234, ...}, + {"month": "2026-02", "sales": 18600692, "balance": 7258101, ...} + ] + } + """ + year = flask_request.args.get('year', '').strip() + + session = get_baekje_session() + result = session.get_balance(year if year else None) + return jsonify(result)