Skip to content

Revert "Revert "[4/n]: migrate the RESTAPI GET /rest/* to use TwentyORM direc…" #11349

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

Merged
merged 41 commits into from
May 12, 2025

Conversation

martmull
Copy link
Contributor

@martmull martmull commented Apr 2, 2025

Reverts #11344

Fixes twentyhq/core-team-issues#735

Depth===2 fails to depth === 1 on workspace with featureFlag IsNewRelationEnabled = false

@martmull martmull force-pushed the revert-11344-revert-rest-api-get branch from 78936c2 to aff7cce Compare April 2, 2025 13:59
@martmull martmull marked this pull request as ready for review April 2, 2025 14:03
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR reverts recent changes to restore legacy REST API GET behavior and reverts modifications in GraphQL parsers related to feature flag support.

  • packages/twenty-server/src/app.module.ts: Reintroduces RequestMethod.GET in MIGRATED_REST_METHODS for legacy GET middleware.
  • packages/twenty-server/src/engine/api/graphql/.../graphql-query-order.parser.ts, graphql-query-filter-condition.parser.ts, graphql-query-filter-field.parser.ts, and graphql-query.parser.ts: Removed feature flag parameters, reverting to only fieldMetadataMapByName.
  • packages/twenty-server/src/engine/api/rest/core/controllers/rest-api-core.controller.ts: Reinstates class-level exception filtering and reverts GET endpoint changes.
  • Reintroduced integration tests for GET endpoints in rest-api-core-find-one.integration-spec.ts and rest-api-core-find-many.integration-spec.ts.
  • packages/twenty-server/src/engine/api/rest/input-factories/order-by-input.factory.ts & rest-api.module.ts: Restores previous objectMetadata mapping and factory dependencies.

12 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

@charlesBochet
Copy link
Member

closing to keep the PR history clean, let's re-open once ready!

@martmull martmull reopened this Apr 17, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

(updates since last review)

This PR reverts a previous reversion, re-implementing the REST API GET endpoints to use TwentyORM directly with improved cursor-based pagination and filtering capabilities.

  • Implemented cursor-based pagination in rest-api-core-v2.service.ts with forward/backward navigation and metadata handling
  • Added comprehensive integration tests in rest-api-core-find-many.integration-spec.ts covering pagination, filtering, and error cases
  • Removed feature flag dependencies from GraphQL query parsers while maintaining core filtering/ordering functionality
  • Added FilterInputFactory and OrderByInputFactory to support enhanced filtering and ordering capabilities
  • Potential concern: computeCursorFilter method only uses ID for cursor filtering, which may be insufficient for complex sorting scenarios

10 file(s) reviewed, 6 comment(s)
Edit PR Review Bot Settings | Greptile

@martmull martmull force-pushed the revert-11344-revert-rest-api-get branch from 36f81ad to b315134 Compare April 23, 2025 09:42
@martmull martmull force-pushed the revert-11344-revert-rest-api-get branch from 3ce148e to 0375dfe Compare April 23, 2025 13:01
@martmull martmull force-pushed the revert-11344-revert-rest-api-get branch from c7f6b3b to 6fc27c4 Compare May 6, 2025 16:04
@martmull martmull force-pushed the revert-11344-revert-rest-api-get branch from 0855dec to 6a6b78d Compare May 7, 2025 07:46
@martmull
Copy link
Contributor Author

martmull commented May 7, 2025

@pacyL2K19 jeez that was hard ^^ Feel free to take a look if you want to

@pacyL2K19
Copy link
Contributor

Thanks for handling this from me @martmull
Sorry for being idle recently, got a lot on my plate
But I will review this today and ideally approve
Won't be able to contribute actively until June tho, but I'll be happy to resume asap

const ALLOWED_DEPTH_VALUES: Depth[] = [0, 1, 2];

@Injectable()
export class DepthInputFactory {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An Injectable factory seems a bit overkill to me here, why not simply a util function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to be consistent with other input factories, limit is not more complex

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes definitely, I didn't know limit was also a factory, I would have made a util for that one too 😛

@martmull martmull force-pushed the revert-11344-revert-rest-api-get branch from 3ec6dde to c1bf418 Compare May 7, 2025 22:13
@martmull martmull force-pushed the revert-11344-revert-rest-api-get branch from 7a50124 to ef2b328 Compare May 8, 2025 21:11
@martmull martmull force-pushed the revert-11344-revert-rest-api-get branch from ef2b328 to f16ccf4 Compare May 8, 2025 21:28
@martmull martmull force-pushed the revert-11344-revert-rest-api-get branch from 00e824e to 74e1d64 Compare May 12, 2025 08:23
@martmull martmull enabled auto-merge (squash) May 12, 2025 08:29
@martmull martmull merged commit 650f8f5 into main May 12, 2025
37 checks passed
@martmull martmull deleted the revert-11344-revert-rest-api-get branch May 12, 2025 08:32
ehconitin pushed a commit to ehconitin/twenty that referenced this pull request May 12, 2025
martmull added a commit that referenced this pull request May 27, 2025
## Done
- add relations in dropdown variables
- add relations in worklfow run inputs
- use objectMetadataMaps in workflow folder

## To do
- does not work with rest api calls, will be fixed after
#11349 is merged
- waiting for crud action relation fields
twentyhq/core-team-issues#509
martmull added a commit that referenced this pull request May 28, 2025
## Done
- add relations in dropdown variables
- add relations in worklfow run inputs
- use objectMetadataMaps in workflow folder

## To do
- does not work with rest api calls, will be fixed after
#11349 is merged
- waiting for crud action relation fields
twentyhq/core-team-issues#509
martmull added a commit that referenced this pull request May 28, 2025
## Done
- add relations in dropdown variables
- add relations in worklfow run inputs
- use objectMetadataMaps in workflow folder

## To do
- does not work with rest api calls, will be fixed after
#11349 is merged
- waiting for crud action relation fields
twentyhq/core-team-issues#509
martmull added a commit that referenced this pull request May 28, 2025
## Done
- add relations in dropdown variables
- add relations in worklfow run inputs
- use objectMetadataMaps in workflow folder

## To do
- does not work with rest api calls, will be fixed after
#11349 is merged
- waiting for crud action relation fields
twentyhq/core-team-issues#509
jordan-chalupka pushed a commit to InsurOS/twenty that referenced this pull request May 28, 2025
## Done
- add relations in dropdown variables
- add relations in worklfow run inputs
- use objectMetadataMaps in workflow folder

## To do
- does not work with rest api calls, will be fixed after
twentyhq#11349 is merged
- waiting for crud action relation fields
twentyhq/core-team-issues#509
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Revert Revert REST API GET V2
5 participants