# Data Models ## User | Field | Type | Required | |-------|------|----------| | id | UUID | Yes | | email | string | Yes | | passwordHash | string | Yes | | name | string | Yes | | timezone | string | Yes | | workingHours | JSON | Yes | | notificationPreferences | JSON | Yes | | lastWeeklyReview | timestamp | No | | createdAt | timestamp | Yes | | updatedAt | timestamp | Yes | ### Relationships - Has many InboxItems - Has many Tasks - Has many Projects - Has many CalendarConnections ## InboxItem | Field | Type | Required | |-------|------|----------| | id | UUID | Yes | | userId | UUID | Yes | | content | text | Yes | | source | enum | Yes | | sourceMetadata | JSON | No | | processed | boolean | Yes | | processedAt | timestamp | No | | createdAt | timestamp | Yes | ### Relationships - Belongs to User - Can convert to Task or Project ## Task | Field | Type | Required | |-------|------|----------| | id | UUID | Yes | | userId | UUID | Yes | | projectId | UUID | No | | title | string | Yes | | description | text | No | | status | enum | Yes | | context | enum | No | | domain | enum | Yes | | priority | integer | No | | dueDate | timestamp | No | | estimatedDuration | integer | No | | scheduledStart | timestamp | No | | scheduledEnd | timestamp | No | | isLocked | boolean | Yes | | completedAt | timestamp | No | | connectwiseTicketId | string | No | | connectwisePriority | string | No | | connectwiseSLA | string | No | | waitingForDetails | text | No | | followUpDate | timestamp | No | | ticklerDate | timestamp | No | | createdAt | timestamp | Yes | | updatedAt | timestamp | Yes | ### Relationships - Belongs to User - Belongs to Project (optional) - Has many ReschedulingEvents ## Project | Field | Type | Required | |-------|------|----------| | id | UUID | Yes | | userId | UUID | Yes | | name | string | Yes | | description | text | No | | desiredOutcome | text | No | | domain | enum | Yes | | status | enum | Yes | | connectwiseProjectId | string | No | | completedAt | timestamp | No | | createdAt | timestamp | Yes | | updatedAt | timestamp | Yes | ### Relationships - Belongs to User - Has many Tasks - Has many ReferenceMaterials ## ReferenceMaterial | Field | Type | Required | |-------|------|----------| | id | UUID | Yes | | projectId | UUID | Yes | | title | string | Yes | | content | text | No | | url | string | No | | filePath | string | No | | createdAt | timestamp | Yes | ### Relationships - Belongs to Project ## CalendarConnection | Field | Type | Required | |-------|------|----------| | id | UUID | Yes | | userId | UUID | Yes | | provider | enum | Yes | | calendarUrl | string | No | | credentials | JSON | Yes | | isActive | boolean | Yes | | lastSyncAt | timestamp | No | | createdAt | timestamp | Yes | ### Relationships - Belongs to User - Has many CalendarEvents ## CalendarEvent | Field | Type | Required | |-------|------|----------| | id | UUID | Yes | | calendarConnectionId | UUID | Yes | | externalId | string | Yes | | title | string | Yes | | startTime | timestamp | Yes | | endTime | timestamp | Yes | | isAllDay | boolean | Yes | | syncedAt | timestamp | Yes | ### Relationships - Belongs to CalendarConnection ## ConnectWiseConnection | Field | Type | Required | |-------|------|----------| | id | UUID | Yes | | userId | UUID | Yes | | companyId | string | Yes | | publicKey | string | Yes | | privateKey | string | Yes | | apiUrl | string | Yes | | memberId | string | Yes | | isActive | boolean | Yes | | lastSyncAt | timestamp | No | | createdAt | timestamp | Yes | ### Relationships - Belongs to User ## EmailConnection | Field | Type | Required | |-------|------|----------| | id | UUID | Yes | | userId | UUID | Yes | | provider | enum | Yes | | imapHost | string | No | | imapPort | integer | No | | credentials | JSON | Yes | | inboxFolder | string | Yes | | isActive | boolean | Yes | | lastCheckAt | timestamp | No | | createdAt | timestamp | Yes | ### Relationships - Belongs to User ## ReschedulingEvent | Field | Type | Required | |-------|------|----------| | id | UUID | Yes | | taskId | UUID | Yes | | originalStart | timestamp | Yes | | originalEnd | timestamp | Yes | | newStart | timestamp | Yes | | newEnd | timestamp | Yes | | reason | string | Yes | | notificationSent | boolean | Yes | | createdAt | timestamp | Yes | ### Relationships - Belongs to Task ## Notification | Field | Type | Required | |-------|------|----------| | id | UUID | Yes | | userId | UUID | Yes | | type | enum | Yes | | title | string | Yes | | message | text | Yes | | relatedEntityId | UUID | No | | read | boolean | Yes | | sentAt | timestamp | Yes | ### Relationships - Belongs to User