feat: 도매상 설정 중앙 관리 시스템
- config/wholesalers.json: 도매상 정보 중앙 관리 (ID, 이름, 로고, 색상, API) - config/__init__.py: Python 헬퍼 (get_wholesalers, get_wholesaler) - wholesaler_config_api.py: /api/config/wholesalers 엔드포인트 - 백제약품 로고(favicon) 추가: logo_baekje.ico - 잔고 모달에 로고 표시 기능 추가
This commit is contained in:
40
backend/wholesaler_config_api.py
Normal file
40
backend/wholesaler_config_api.py
Normal file
@@ -0,0 +1,40 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
도매상 설정 API
|
||||
|
||||
GET /api/config/wholesalers - 도매상 목록 (순서대로)
|
||||
GET /api/config/wholesaler/<id> - 특정 도매상 정보
|
||||
"""
|
||||
|
||||
from flask import Blueprint, jsonify
|
||||
from config import get_wholesalers, get_wholesaler, get_config
|
||||
|
||||
wholesaler_config_bp = Blueprint('wholesaler_config', __name__, url_prefix='/api/config')
|
||||
|
||||
|
||||
@wholesaler_config_bp.route('/wholesalers', methods=['GET'])
|
||||
def api_get_wholesalers():
|
||||
"""도매상 목록 반환"""
|
||||
wholesalers = get_wholesalers()
|
||||
return jsonify({
|
||||
'success': True,
|
||||
'wholesalers': wholesalers,
|
||||
'count': len(wholesalers)
|
||||
})
|
||||
|
||||
|
||||
@wholesaler_config_bp.route('/wholesaler/<wholesaler_id>', methods=['GET'])
|
||||
def api_get_wholesaler(wholesaler_id):
|
||||
"""특정 도매상 정보 반환"""
|
||||
wholesaler = get_wholesaler(wholesaler_id)
|
||||
if wholesaler:
|
||||
return jsonify({
|
||||
'success': True,
|
||||
'wholesaler': wholesaler
|
||||
})
|
||||
else:
|
||||
return jsonify({
|
||||
'success': False,
|
||||
'error': 'NOT_FOUND',
|
||||
'message': f'도매상 {wholesaler_id}을(를) 찾을 수 없습니다'
|
||||
}), 404
|
||||
Reference in New Issue
Block a user