# Prisma Schema Map

_Auto-generated by `npm run schema:map` from [prisma/schema.prisma](../prisma/schema.prisma). Do not edit by hand._

Models: **21** • Enums: **0** • Groups: **9**

## Table of contents

- [Auth & Users](#auth-users) (5)
- [Org & Membership](#org-membership) (4)
- [Locations & Events](#locations-events) (2)
- [Form Templates](#form-templates) (2)
- [Cards & OCR](#cards-ocr) (2)
- [People (CRM)](#people-crm-) (1)
- [Integrations](#integrations) (1)
- [Activity & Notifications](#activity-notifications) (2)
- [Settings](#settings) (2)

## Auth & Users

| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **Account** | `—` | 1 | [User](#auth-users) |
| **PasswordResetToken** | `—` | 0 | — |
| **Session** | `—` | 1 | [User](#auth-users) |
| **User** | `—` | 8 | [Account](#auth-users), [ActivityLog](#activity-notifications), [Notification](#activity-notifications), [OrgMember](#org-membership), [ResponseCard](#cards-ocr), [Session](#auth-users) |
| **VerificationToken** | `—` | 0 | — |

<details><summary>ER diagram</summary>

```mermaid
erDiagram
  Account "1" ||--|| "1" User : user
  PasswordResetToken {
    string id
  }
  Session "1" ||--|| "1" User : user
  User "1" ||--o{ "many" OrgMember : memberships
  User "1" ||--o{ "many" ResponseCard : assignedCards
  User "1" ||--o{ "many" ActivityLog : activityLogs
  User "1" ||--o{ "many" Notification : notifications
  VerificationToken {
    string id
  }
```

</details>

## Org & Membership

| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **ApiKey** | `—` | 1 | [Organization](#org-membership) |
| **Invitation** | `—` | 1 | [Organization](#org-membership) |
| **Organization** | `—` | 9 | [ApiKey](#org-membership), [FormTemplate](#form-templates), [Integration](#integrations), [Invitation](#org-membership), [Location](#locations-events), [OrgMember](#org-membership), [Person](#people-crm-), [ProcessingJob](#cards-ocr), [ResponseCard](#cards-ocr) |
| **OrgMember** | `—` | 2 | [Organization](#org-membership), [User](#auth-users) |

<details><summary>ER diagram</summary>

```mermaid
erDiagram
  ApiKey "1" ||--|| "1" Organization : organization
  Invitation "1" ||--|| "1" Organization : organization
  Organization "1" ||--o{ "many" Location : locations
  Organization "1" ||--o{ "many" OrgMember : members
  Organization "1" ||--o{ "many" ResponseCard : cards
  Organization "1" ||--o{ "many" ProcessingJob : jobs
  Organization "1" ||--o{ "many" Integration : integrations
  Organization "1" ||--o{ "many" FormTemplate : formTemplates
  Organization "1" ||--o{ "many" Person : persons
  OrgMember "1" ||--|| "1" User : user
```

</details>

## Locations & Events

| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **CollectionDay** | `—` | 2 | [Location](#locations-events), [ResponseCard](#cards-ocr) |
| **Location** | `—` | 3 | [CollectionDay](#locations-events), [Organization](#org-membership), [ResponseCard](#cards-ocr) |

<details><summary>ER diagram</summary>

```mermaid
erDiagram
  CollectionDay "1" ||--|| "1" Location : location
  CollectionDay "1" ||--o{ "many" ResponseCard : cards
  Location "1" ||--|| "1" Organization : organization
  Location "1" ||--o{ "many" ResponseCard : cards
```

</details>

## Form Templates

| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **FormField** | `—` | 1 | [FormTemplate](#form-templates) |
| **FormTemplate** | `—` | 3 | [FormField](#form-templates), [Organization](#org-membership), [ResponseCard](#cards-ocr) |

<details><summary>ER diagram</summary>

```mermaid
erDiagram
  FormField "1" ||--|| "1" FormTemplate : formTemplate
  FormTemplate "1" ||--|| "1" Organization : organization
  FormTemplate "1" ||--o{ "many" ResponseCard : cards
```

</details>

## Cards & OCR

| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **ProcessingJob** | `—` | 1 | [Organization](#org-membership) |
| **ResponseCard** | `—` | 8 | [CollectionDay](#locations-events), [FormTemplate](#form-templates), [Location](#locations-events), [Organization](#org-membership), [Person](#people-crm-), [User](#auth-users) |

<details><summary>ER diagram</summary>

```mermaid
erDiagram
  ProcessingJob "1" ||--|| "1" Organization : organization
  ResponseCard "1" ||--|| "1" User : assignedTo
  ResponseCard "1" ||--|| "1" Organization : organization
  ResponseCard "1" ||--|| "1" Location : location
  ResponseCard "1" ||--|| "1" CollectionDay : collectionDay
  ResponseCard "1" ||--|| "1" FormTemplate : formTemplate
  ResponseCard "1" ||--|| "1" Person : person
```

</details>

## People (CRM)

| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **Person** | `—` | 4 | [Organization](#org-membership), [Person](#people-crm-), [ResponseCard](#cards-ocr) |

<details><summary>ER diagram</summary>

```mermaid
erDiagram
  Person "1" ||--|| "1" Organization : organization
  Person "1" ||--o{ "many" ResponseCard : cards
```

</details>

## Integrations

| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **Integration** | `—` | 1 | [Organization](#org-membership) |

<details><summary>ER diagram</summary>

```mermaid
erDiagram
  Integration "1" ||--|| "1" Organization : organization
```

</details>

## Activity & Notifications

| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **ActivityLog** | `—` | 1 | [User](#auth-users) |
| **Notification** | `—` | 1 | [User](#auth-users) |

<details><summary>ER diagram</summary>

```mermaid
erDiagram
  ActivityLog "1" ||--|| "1" User : user
  Notification "1" ||--|| "1" User : user
```

</details>

## Settings

| Model | Table | Relations | Linked to |
| --- | --- | ---: | --- |
| **AppSettings** | `—` | 0 | — |
| **SystemConfig** | `—` | 0 | — |

<details><summary>ER diagram</summary>

```mermaid
erDiagram
  AppSettings {
    string id
  }
  SystemConfig {
    string id
  }
```

</details>

---

Regenerate after schema changes: `npm run schema:map`. Curated groupings live in [scripts/generate-schema-map.ts](../scripts/generate-schema-map.ts) under `MODEL_GROUPS`.
