Scheduling infrastructure for absolutely everyone.
chore: add `createdAt` field to `SelectedCalendar` and `DestinationCalendar` (#22071)
Joe Au-Yeung0ab9823c9ab0
diff --git a/apps/api/v1/test/lib/selected-calendars/_post.test.ts b/apps/api/v1/test/lib/selected-calendars/_post.test.tsindex e872b116ce4..5e23d003a25 100644--- a/apps/api/v1/test/lib/selected-calendars/_post.test.ts+++ b/apps/api/v1/test/lib/selected-calendars/_post.test.ts@@ -93,6 +93,8 @@ describe("POST /api/selected-calendars", () => {watchAttempts: 0,maxAttempts: 3,unwatchAttempts: 0,+ createdAt: new Date(),+ updatedAt: new Date(),});await handler(req, res);@@ -136,6 +138,8 @@ describe("POST /api/selected-calendars", () => {watchAttempts: 0,maxAttempts: 3,unwatchAttempts: 0,+ createdAt: new Date(),+ updatedAt: new Date(),});await handler(req, res);diff --git a/apps/api/v2/src/modules/destination-calendars/controllers/destination-calendars.controller.e2e-spec.ts b/apps/api/v2/src/modules/destination-calendars/controllers/destination-calendars.controller.e2e-spec.tsindex 9adce3ad1b8..560f24d740f 100644--- a/apps/api/v2/src/modules/destination-calendars/controllers/destination-calendars.controller.e2e-spec.ts+++ b/apps/api/v2/src/modules/destination-calendars/controllers/destination-calendars.controller.e2e-spec.ts@@ -92,6 +92,8 @@ describe("Platform Destination Calendar Endpoints", () => {publisher: "",url: "",email: "",+ createdAt: new Date().toISOString(),+ updatedAt: new Date().toISOString(),},// calendars: {// externalId:@@ -118,6 +120,8 @@ describe("Platform Destination Calendar Endpoints", () => {id: 0,delegationCredentialId: null,domainWideDelegationCredentialId: null,+ createdAt: new Date(),+ updatedAt: new Date(),},}));diff --git a/apps/api/v2/test/mocks/calendars-service-mock.ts b/apps/api/v2/test/mocks/calendars-service-mock.tsindex cc583379587..bd91ae777b2 100644--- a/apps/api/v2/test/mocks/calendars-service-mock.ts+++ b/apps/api/v2/test/mocks/calendars-service-mock.ts@@ -75,6 +75,8 @@ export class CalendarsServiceMock {id: 0,delegationCredentialId: null,domainWideDelegationCredentialId: null,+ createdAt: new Date(),+ updatedAt: new Date(),},} satisfies Awaited<ReturnType<typeof CalendarsService.prototype.getCalendars>>;}diff --git a/packages/lib/buildCalEventFromBooking.ts b/packages/lib/buildCalEventFromBooking.tsindex 209d8bdb599..9e0cb474c68 100644--- a/packages/lib/buildCalEventFromBooking.ts+++ b/packages/lib/buildCalEventFromBooking.ts@@ -15,6 +15,8 @@ type DestinationCalendar = {credentialId: number | null;delegationCredentialId: string | null;domainWideDelegationCredentialId: string | null;+ createdAt: Date | null;+ updatedAt: Date | null;} | null;type Attendee = {diff --git a/packages/prisma/migrations/20250627195833_add_date_fields_to_calendar_records/migration.sql b/packages/prisma/migrations/20250627195833_add_date_fields_to_calendar_records/migration.sqlnew file mode 100644index 00000000000..c14fdae6144--- /dev/null+++ b/packages/prisma/migrations/20250627195833_add_date_fields_to_calendar_records/migration.sql@@ -0,0 +1,7 @@+-- AlterTable+ALTER TABLE "DestinationCalendar" ADD COLUMN "createdAt" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,+ADD COLUMN "updatedAt" TIMESTAMP(3);++-- AlterTable+ALTER TABLE "SelectedCalendar" ADD COLUMN "createdAt" TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP,+ADD COLUMN "updatedAt" TIMESTAMP(3);diff --git a/packages/prisma/schema.prisma b/packages/prisma/schema.prismaindex 61e071108ff..bde1b9eb246 100644--- a/packages/prisma/schema.prisma+++ b/packages/prisma/schema.prisma@@ -270,6 +270,8 @@ model DestinationCalendar {eventTypeId Int? @uniquecredentialId Int?credential Credential? @relation(fields: [credentialId], references: [id], onDelete: Cascade)+ createdAt DateTime? @default(now())+ updatedAt DateTime? @updatedAtdelegationCredential DelegationCredential? @relation(fields: [delegationCredentialId], references: [id], onDelete: Cascade)delegationCredentialId String?domainWideDelegation DomainWideDelegation? @relation(fields: [domainWideDelegationCredentialId], references: [id], onDelete: Cascade)@@ -854,6 +856,8 @@ model SelectedCalendar {externalId Stringcredential Credential? @relation(fields: [credentialId], references: [id], onDelete: Cascade)credentialId Int?+ createdAt DateTime? @default(now())+ updatedAt DateTime? @updatedAt// Used to identify a watched calendar channel in Google CalendargoogleChannelId String?googleChannelKind String?