""" app/enrollment -------------- The JQC Enrollment Form — a self-contained onboarding intake, deliberately held apart from the rest of the application. /enrollment public form emailed to a prospective customer /enrollment/admin admin-only inbox of submissions Separation contract (please keep this true) ------------------------------------------- 1. NO app.models imports, and nothing here writes to the database. Enrollment happens before any contract, facility or user exists, so there is nothing to key a row against. Submissions are flat JSON files (see storage.py). MT NOTE: "no database" does NOT mean "no tenant". Submissions are filed per tenant on disk, and the admin views only ever list the calling tenant's own directory — see storage.enrollment_dir(). 2. NO migration, NO model, NO notification-matrix event, NO iPad/API surface. Deleting this package would remove the two routes and nothing else. 3. Its own template folder (app/enrollment/templates/enrollment/) — enrollment markup never mixes into app/templates. 4. The only shared code it uses is what it should not reinvent: the app factory, Flask-WTF CSRF, the rate limiter, and @admin_required. If this ever needs to CREATE the accounts it describes, do that as a separate, explicit admin action that reads a stored submission — do not let the public form reach into the app's models. """ from .routes import bp # noqa: F401 (re-exported for register_enrollment) def register_enrollment(app): """Register the blueprint and make sure the storage directory exists.""" import os app.config.setdefault( 'ENROLLMENT_DIR', os.path.join(app.instance_path, 'enrollments'), ) # Only the ROOT is created at boot. Per-tenant subdirectories are created # lazily on first use by storage.enrollment_dir(), because the tenant is # not known until a request is bound. os.makedirs(app.config['ENROLLMENT_DIR'], exist_ok=True) app.register_blueprint(bp) app.logger.info('Enrollment | storage root: %s | per-tenant=%s', app.config['ENROLLMENT_DIR'], bool(app.config.get('MULTI_TENANT_ENABLED')))