"""
字段列表 API
"""
from flask import jsonify
from lib.field_mapping import get_all_fields_with_display
from . import field_bp


@field_bp.route('/fields', methods=['GET'])
def get_fields():
    """获取所有可用字段"""
    try:
        fields = get_all_fields_with_display()
        return jsonify({'success': True, 'data': fields})
    except Exception as e:
        return jsonify({'success': False, 'message': str(e)}), 500
