chore: add createdAt field to SelectedCalendar and DestinationCalendar (#22071)

* Add createdAt

* Address feedback

* Make date fields nullable

* Type fixes

* Type fix

* Fix tests
This commit is contained in:
Joe Au-Yeung authored and GitHub committed 2025-07-05 17:04:38 +01:00
1 parent b3fd4f307f
commit 0ab9823c9a
6 files changed
+23

No files matched your search

@@ -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);
@@ -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(),
},
})
);
@@ -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>>;
}
+2
View File
@@ -15,6 +15,8 @@ type DestinationCalendar = {
credentialId: number | null;
delegationCredentialId: string | null;
domainWideDelegationCredentialId: string | null;
createdAt: Date | null;
updatedAt: Date | null;
} | null;
type Attendee = {
@@ -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);
+4
View File
@@ -270,6 +270,8 @@ model DestinationCalendar {
eventTypeId Int? @unique
credentialId Int?
credential Credential? @relation(fields: [credentialId], references: [id], onDelete: Cascade)
createdAt DateTime? @default(now())
updatedAt DateTime? @updatedAt
delegationCredential 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 String
credential 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 Calendar
googleChannelId String?
googleChannelKind String?