Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
enum CredentialType {
OAUTH
}
model Credential {
id String @id @default(cuid())
userId String @map("user_id")
provider String
providerAccountId String @map("provider_account_id")
type CredentialType
secret String @map("secret")
scopes String[]
expiresAt DateTime? @map("expires_at")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
// Relationships
calendarConnections CalendarConnection[]
conferencingConnections ConferencingConnection[]
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
// Constraints and indexes
@@unique([userId, provider, providerAccountId], name: "user_provider_account_unique")
@@index([expiresAt], name: "credential_expiry_idx")
@@map("credentials")
}
model CalendarConnection {
id String @id @default(cuid())
userId String @map("user_id")
provider String
integrationId String @map("integration_id")
providerAccountId String @map("provider_account_id")
email String
displayName String? @map("display_name")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
// Relationships
credential Credential @relation(fields: [credentialId], references: [id], onDelete: Cascade)
credentialId String @map("credential_id")
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
providerCalendars ProviderCalendar[]
// Constraints and indexes
@@unique([userId, provider, providerAccountId], name: "user_provider_account_unique")
@@map("calendar_connections")
}
model ProviderCalendar {
id String @id @default(cuid())
calendarConnectionId String @map("calendar_connection_id")
// Provider's calendar data - common fields across all providers
providerCalendarId String @map("provider_calendar_id")
name String
isPrimary Boolean @default(false) @map("primary")
timeZone String? @map("time_zone")
// Selection and sync preferences
isSelected Boolean @default(false) @map("selected")
// Provider state tracking
isDeleted Boolean @default(false) @map("deleted")
isWritable Boolean @default(false) @map("writable")
// Provider-specific metadata stored as JSON
providerData Json? @map("provider_data")
// Timestamps
lastSyncedAt DateTime @default(now()) @map("last_synced_at")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
// Relationships
calendarConnection CalendarConnection @relation(fields: [calendarConnectionId], references: [id], onDelete: Cascade)
userDefaultDestination User[] @relation("UserDefaultDestinationCalendar")
// Indexes and constraints
@@unique([calendarConnectionId, providerCalendarId], name: "connection_calendar_unique")
@@index([calendarConnectionId, isSelected], name: "connection_selected_idx")
@@index([isPrimary], name: "primary_calendar_idx")
@@index([lastSyncedAt], name: "sync_time_idx")
@@map("provider_calendars")
}
model ConferencingConnection {
id String @id @default(cuid())
userId String @map("user_id")
provider String
integrationId String @map("integration_id")
providerAccountId String @map("provider_account_id")
email String
displayName String? @map("display_name")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
credential Credential @relation(fields: [credentialId], references: [id], onDelete: Cascade)
credentialId String @map("credential_id")
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([userId, provider, providerAccountId], name: "user_provider_account_unique")
@@map("conferencing_connections")
}