Closed FelixMalfait closed 2 months ago
To fix the issue with depth=0
in the REST API, follow these steps:
Locate the Query Parameter Handling: Identify where the query parameters are processed in the REST API. This is likely in the controller or service handling the API requests.
Modify Depth Parameter Handling: Ensure that the depth
parameter is correctly parsed and handled. If depth=0
is passed, it should be respected and not default to depth=1
.
Update the Controller: In the relevant controller file, update the method handling the API request to correctly process depth=0
.
Example:
@Get('your-endpoint')
async getYourData(@Query('depth') depth: number) {
const effectiveDepth = depth === 0 ? 0 : (depth || 1);
return this.yourService.getData(effectiveDepth);
}
depth
parameter.Example:
async getData(depth: number) {
if (depth === 0) {
// Handle depth=0 logic
} else {
// Handle other depths
}
}
Files to check:
/packages/twenty-server/src/modules/calendar-messaging-participant/jobs/*
/packages/twenty-server/src/modules/calendar/listeners/calendar-blocklist.listener.ts
/packages/twenty-server/src/modules/messaging/blocklist-manager/listeners/messaging-blocklist.listener.ts
/packages/twenty-server/src/modules/messaging/message-import-manager/crons/commands/messaging-messages-import.cron.command.ts
/packages/twenty-server/src/modules/calendar/services/google-calendar-sync/google-calendar-sync.service.ts
Ensure that all relevant parts of the codebase respect the depth
parameter.
/packages/twenty-server/src/modules/calendar-messaging-participant/jobs /packages/twenty-server/src/modules/calendar/listeners/calendar-blocklist.listener.ts /packages/twenty-server/src/modules/messaging/blocklist-manager/listeners/messaging-blocklist.listener.ts /packages/twenty-server/src/modules/messaging/message-import-manager/crons/commands/messaging-messages-import.cron.command.ts /packages/twenty-server/src/modules/messaging/message-import-manager/drivers/gmail/services/messaging-gmail-messages-import.service.ts /packages/twenty-server/src/modules/calendar/services/google-calendar-sync/google-calendar-sync.service.ts /packages/twenty-server/src/modules/messaging/message-import-manager/crons/commands/messaging-message-list-fetch.cron.command.ts /packages/twenty-server/src/database/typeorm/core/migrations/1711557405330-addMissingMigration.ts
A customer reported that it wasn't possible to use depth=0 as a parameter in the REST API (it returns depth=1). It would be nice to fix it.