chore: redis cache for calendars in api v2 (#23622)

* chore: implement redis cache for calendars api v2

* fixup! chore: implement redis cache for calendars api v2

* fixup! fixup! chore: implement redis cache for calendars api v2

* fix leverage genetic type of redis.get

* refactor: address supalarry's PR feedback

- Create CalendarsCacheService to separate cache responsibilities
- Rename cache methods to be more descriptive (getConnectedAndDestinationCalendarsCache, setConnectedAndDestinationCalendarsCache)
- Remove unused redisService injection from CalendarsController
- Move all cache-related functionality to dedicated service

Addresses comments 9, 10, and 11 from supalarry on PR #23622

Co-Authored-By: morgan@cal.com <morgan@cal.com>

* refactor: address supalarry's latest PR feedback

- Remove redundant deleteConnectedAndDestinationCalendarsCache from CalendarsService
- Update controller to directly inject and use CalendarsCacheService
- Extract TTL constant and remove manual JSON.stringify in cache service

Co-Authored-By: morgan@cal.com <morgan@cal.com>

* fix: update IcsFeedService to use CalendarsCacheService directly

- Inject CalendarsCacheService into IcsFeedService constructor
- Replace calendarsService.deleteCalendarCache with calendarsCacheService.deleteConnectedAndDestinationCalendarsCache
- Completes the refactoring to eliminate all old cache method references

Co-Authored-By: morgan@cal.com <morgan@cal.com>

* fix: update destination-calendars and selected-calendars services to use CalendarsCacheService directly

- Inject CalendarsCacheService in both service constructors
- Replace calendarsService.deleteCalendarCache calls with calendarsCacheService.deleteConnectedAndDestinationCalendarsCache
- Add CalendarsCacheService to module providers for proper dependency injection
- Completes migration of all cache method references to use dedicated cache service

Co-Authored-By: morgan@cal.com <morgan@cal.com>

* chore: use CalendarsCacheService

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Morgan
2025-09-08 21:21:55 +00:00
committed by GitHub
co-authored by Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
parent f5bb734441
commit 300cd31efb
17 changed files with 205 additions and 21 deletions
+97 -6
View File
@@ -8746,8 +8746,6 @@
{
"name": "credentialId",
"in": "query",
"description": "The ID of the user's calendar credential used to access the calendar. Retrieve this from your connected calendar credentials via the `/v2/credentials` endpoint.",
"example": 135,
"required": true,
"schema": {
"type": "number"
@@ -8756,8 +8754,6 @@
{
"name": "externalId",
"in": "query",
"description": "The external calendar identifier from the calendar provider (e.g., email address for Google Calendar). This is returned when listing connected calendars.",
"example": "user@gmail.com",
"required": true,
"schema": {
"type": "string"
@@ -20851,7 +20847,12 @@
"afterEvent",
"rescheduleEvent",
"afterHostsCalVideoNoShow",
"afterGuestsCalVideoNoShow"
"afterGuestsCalVideoNoShow",
"bookingRejected",
"bookingRequested",
"bookingPaymentInitiated",
"bookingPaid",
"bookingNoShowUpdated"
]
},
"offset": {
@@ -21149,6 +21150,61 @@
},
"required": ["type"]
},
"OnNoShowUpdateTriggerDto": {
"type": "object",
"properties": {
"type": {
"type": "string",
"default": "bookingNoShowUpdated",
"description": "Trigger type for the workflow"
}
},
"required": ["type"]
},
"OnRejectedTriggerDto": {
"type": "object",
"properties": {
"type": {
"type": "string",
"default": "bookingRejected",
"description": "Trigger type for the workflow"
}
},
"required": ["type"]
},
"OnRequestedTriggerDto": {
"type": "object",
"properties": {
"type": {
"type": "string",
"default": "bookingRequested",
"description": "Trigger type for the workflow"
}
},
"required": ["type"]
},
"OnPaymentInitiatedTriggerDto": {
"type": "object",
"properties": {
"type": {
"type": "string",
"default": "bookingPaymentInitiated",
"description": "Trigger type for the workflow"
}
},
"required": ["type"]
},
"OnPaidTriggerDto": {
"type": "object",
"properties": {
"type": {
"type": "string",
"default": "bookingPaid",
"description": "Trigger type for the workflow"
}
},
"required": ["type"]
},
"OnAfterCalVideoGuestsNoShowTriggerDto": {
"type": "object",
"properties": {
@@ -21664,7 +21720,12 @@
"afterEvent",
"rescheduleEvent",
"afterHostsCalVideoNoShow",
"afterGuestsCalVideoNoShow"
"afterGuestsCalVideoNoShow",
"bookingRejected",
"bookingRequested",
"bookingPaymentInitiated",
"bookingPaid",
"bookingNoShowUpdated"
]
],
"description": "Trigger type for the workflow"
@@ -21732,6 +21793,21 @@
},
{
"$ref": "#/components/schemas/OnAfterCalVideoHostsNoShowTriggerDto"
},
{
"$ref": "#/components/schemas/OnRejectedTriggerDto"
},
{
"$ref": "#/components/schemas/OnRequestedTriggerDto"
},
{
"$ref": "#/components/schemas/OnPaidTriggerDto"
},
{
"$ref": "#/components/schemas/OnPaymentInitiatedTriggerDto"
},
{
"$ref": "#/components/schemas/OnNoShowUpdateTriggerDto"
}
]
},
@@ -22269,6 +22345,21 @@
},
{
"$ref": "#/components/schemas/OnAfterCalVideoHostsNoShowTriggerDto"
},
{
"$ref": "#/components/schemas/OnRejectedTriggerDto"
},
{
"$ref": "#/components/schemas/OnRequestedTriggerDto"
},
{
"$ref": "#/components/schemas/OnPaidTriggerDto"
},
{
"$ref": "#/components/schemas/OnPaymentInitiatedTriggerDto"
},
{
"$ref": "#/components/schemas/OnNoShowUpdateTriggerDto"
}
]
},