MONGODB_URI (typically d79-directory). Collections are Mongoose models in src/models. Field-level tables live on Database models.
Ownership vs collaboration
A plan has one owner (FormSubmission.userId) and a principal of record (principalEmail / principalName). Those are often the same person. Super Admin can transfer ownership; the previous owner is appended to transferHistory[].
Collaboration is not a join collection. It is stored in two places:
Assistant Principals (level 3) need one of those records to edit. Same-school is not enough. See Roles and access.
Year and question bank pins
formData[stepKey].data[question.id]. Publishing a new bank does not rewrite old formData.
Comments and audit
FormComment.formId→FormSubmission. OptionalstepKey/stepNumber. General comments (no step) can move formstatustounder_review/approved/rejected.AuditLogis append-only. Many user mutations also push ontoUser.activityLog[].- Indexes of note:
users.emailunique;formsubmissionspartial unique{ schoolName, schoolYear }asschoolName_schoolYear_unique;formtemplates.versionunique;schoolyearsettings.schoolYearunique.
Super Admin System health reports whether
schoolName_schoolYear_unique exists. Create and duplicate routes return 409 when a school already has a plan for that year.