cteward-ng/cteward_ng/views.py
2026-06-06 12:04:59 +02:00

108 lines
2.8 KiB
Python

"""Legacy API route handlers.
Replaces all server.get() calls in startup.js.
Blueprint URL prefix: /legacy
Endpoints:
GET /monitor
GET /memberlist-oldformat
GET /stats/members
GET /stats/contracts
GET /stats/genders
GET /stats/ages
GET /member/<crewname>
GET /member/<crewname>/raw
GET /member/<crewname>/memo
GET /member/<crewname>/contributions
GET /member/<crewname>/<contract|debit|withdrawal|payment>/[<id>]/raw/
"""
from flask import Blueprint, current_app, request
legacy_bp = Blueprint('legacy', __name__)
# Placeholder imports — implemented in subsequent phases
# from . import auth
# from . import database
# from . import filters
# from . import mappings
# from . import renderers
@legacy_bp.route('/monitor')
def monitor():
"""Health check endpoint."""
# TODO Phase 6: call database.check_backend_okay()
from flask import jsonify
return jsonify({'status': 'OK'})
@legacy_bp.route('/memberlist-oldformat')
def memberlist_oldformat():
"""CSV member list for LDAP export."""
# TODO Phase 6
raise NotImplementedError("Not yet implemented")
@legacy_bp.route('/stats/members')
def stats_members():
"""Member count over time."""
# TODO Phase 6
raise NotImplementedError("Not yet implemented")
@legacy_bp.route('/stats/contracts')
def stats_contracts():
"""Contract statistics."""
# TODO Phase 6
raise NotImplementedError("Not yet implemented")
@legacy_bp.route('/stats/genders')
def stats_genders():
"""Gender demographics."""
# TODO Phase 6
raise NotImplementedError("Not yet implemented")
@legacy_bp.route('/stats/ages')
def stats_ages():
"""Age demographics."""
# TODO Phase 6
raise NotImplementedError("Not yet implemented")
@legacy_bp.route('/member/<crewname>')
def member(crewname):
"""Member details (or list when crewname is '' or '*')."""
# TODO Phase 6
raise NotImplementedError("Not yet implemented")
@legacy_bp.route('/member/<crewname>/raw')
def member_raw(crewname):
"""Raw DB member record."""
# TODO Phase 6
raise NotImplementedError("Not yet implemented")
@legacy_bp.route('/member/<crewname>/memo')
def member_memo(crewname):
"""RTF memo for a member."""
# TODO Phase 6
raise NotImplementedError("Not yet implemented")
@legacy_bp.route('/member/<crewname>/contributions')
def member_contributions(crewname):
"""Contribution summary for a member."""
# TODO Phase 6
raise NotImplementedError("Not yet implemented")
@legacy_bp.route('/member/<crewname>/<detail_type>/raw/')
@legacy_bp.route('/member/<crewname>/<detail_type>/<detail_id>/raw/')
def member_detail_raw(crewname, detail_type, detail_id=None):
"""Raw detail records (contract, debit, withdrawal, payment)."""
# TODO Phase 6
raise NotImplementedError("Not yet implemented")