- config/wholesalers.json: 도매상 정보 중앙 관리 (ID, 이름, 로고, 색상, API) - config/__init__.py: Python 헬퍼 (get_wholesalers, get_wholesaler) - wholesaler_config_api.py: /api/config/wholesalers 엔드포인트 - 백제약품 로고(favicon) 추가: logo_baekje.ico - 잔고 모달에 로고 표시 기능 추가
41 lines
1.1 KiB
Python
41 lines
1.1 KiB
Python
# -*- 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
|