Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use depth=0 in REST API #6101

Closed
FelixMalfait opened this issue Jul 3, 2024 · 1 comment · Fixed by #6171
Closed

Use depth=0 in REST API #6101

FelixMalfait opened this issue Jul 3, 2024 · 1 comment · Fixed by #6171
Assignees

Comments

@FelixMalfait
Copy link
Member

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.

Copy link
Contributor

greptile-apps bot commented Jul 3, 2024

To fix the issue with depth=0 in the REST API, follow these steps:

  1. 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.

  2. 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.

  3. 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);
}
  1. Update the Service: Ensure the service method respects the 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.

References

/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

About Greptile

This response provides a starting point for your research, not a precise solution.

Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

Ask Greptile · Edit Issue Bot Settings

@martmull martmull moved this from 🆕 New to 🔖 Planned in Product development ✅ Jul 9, 2024
@martmull martmull linked a pull request Jul 9, 2024 that will close this issue
@github-project-automation github-project-automation bot moved this from 🔖 Planned to ✅ Done in Product development ✅ Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants