diff --git a/docs/schema.md b/docs/schema.md index f30ca0b..364dbfd 100644 --- a/docs/schema.md +++ b/docs/schema.md @@ -9,6 +9,7 @@ Schema mapping for Apprentice Pulse. Includes table and field IDs for API integr ``` Apprentices (tbl0HJM700Jmd5Oob) - primary learner record ├── Attendace - Apprentice Pulse (tblkDbhJcuT9TTwFc) + │ └── Event → Events - Apprentice Pulse ├── Weekly learning log (tblL2y5NRjyml8XU8) ├── Progress Reviews (Apprentices) (tblXMWiU6DmrrBAZ7) ├── Support log (tblWINmz4JDtVUucD) @@ -53,15 +54,17 @@ Primary learner record for apprenticeship programme. **Table ID:** `tblkDbhJcuT9TTwFc` -Attendance tracking using a junction table pattern (one record per apprentice per date). +Attendance tracking using a junction table pattern (one record per apprentice per event). | Field | ID | Type | Purpose | |-------|-----|------|---------| | Id | `fldGdpuw6SoHkQbOs` | autoNumber | Record ID | | Apprentice | `fldOyo3hlj9Ht0rfZ` | multipleRecordLinks | Links to Apprentices | -| Cohort | `fldn53kWDE8GHg2Yy` | multipleLookupValues | Cohort lookup | -| Date | `fldvXHPmoLlEA8EuN` | date | Session date | +| Event | `fldiHd75LYtopwyN9` | multipleRecordLinks | Links to Events | +| Checkin Time | `fldvXHPmoLlEA8EuN` | dateTime | When student checked in | | Status | `fldew45fDGpgl1aRr` | singleSelect | Attendance status | +| Date Time (from Event) | `fldokfSk68MhJGlm6` | multipleLookupValues | Event date/time lookup | +| FAC Cohort (from Event) | `fldkc9zLJe7NZVAz1` | multipleLookupValues | Cohort lookup from Event | --- @@ -216,6 +219,8 @@ Scheduled events/sessions for attendance tracking. | Date Time | `fld8AkM3EanzZa5QX` | dateTime | Event start date and time | | Event Type | `fldo7fwAsFhkA1icC` | singleSelect | Regular class, Workshop, Hackathon | | Survey | `fld9XBHnCWBtZiZah` | url | Optional survey form URL | +| Attendance | `fldcPf53fVfStFZsa` | multipleRecordLinks | Linked attendance records | +| Name - Date | `fld7POykodV0LGsg1` | formula | Display name with date | --- diff --git a/src/lib/airtable/config.ts b/src/lib/airtable/config.ts index 970bb93..5e40b29 100644 --- a/src/lib/airtable/config.ts +++ b/src/lib/airtable/config.ts @@ -9,6 +9,7 @@ export const TABLES = { APPRENTICES: 'tbl0HJM700Jmd5Oob', STAFF: 'tblJjn62ExE1LVjmx', EVENTS: 'tblkbskw4fuTq0E9p', + ATTENDANCE: 'tblkDbhJcuT9TTwFc', } as const; // Fields - Cohorts @@ -36,4 +37,15 @@ export const EVENT_FIELDS = { DATE_TIME: 'fld8AkM3EanzZa5QX', // dateTime (combined date and time) EVENT_TYPE: 'fldo7fwAsFhkA1icC', // singleSelect (Regular class, Workshop, Hackathon) SURVEY: 'fld9XBHnCWBtZiZah', // url (optional survey form) + ATTENDANCE: 'fldcPf53fVfStFZsa', // multipleRecordLinks to Attendance (reverse link) + NAME_DATE: 'fld7POykodV0LGsg1', // formula (display name) +} as const; + +// Fields - Attendance +export const ATTENDANCE_FIELDS = { + ID: 'fldGdpuw6SoHkQbOs', // autoNumber + APPRENTICE: 'fldOyo3hlj9Ht0rfZ', // multipleRecordLinks to Apprentices + EVENT: 'fldiHd75LYtopwyN9', // multipleRecordLinks to Events + CHECKIN_TIME: 'fldvXHPmoLlEA8EuN', // dateTime + STATUS: 'fldew45fDGpgl1aRr', // singleSelect (Present/Absent/Late) } as const;