Fix REST API filters (#12929)

# Introduction
close https://github.com/twentyhq/twenty/issues/12921

### Done here:
- Removed
[check-order-by.utils.ts](https://github.com/twentyhq/twenty/pull/12929/files#diff-d044effc0b77b3b67523595ce0febd786d3a0fd74ae905ce2efc349134d7c7d0)
that was a duplicated
- new debug entry `twenty-server` entrypoint
- fixed the fields name computation in case of a relation field metadata
type
- Updated and refactored coverage both unit and integration


![image](https://github.com/user-attachments/assets/e3f0937a-8b54-4ab5-8348-0cd742c107ea)
This commit is contained in:
Paul Rastoin
2025-06-30 16:29:57 +02:00
committed by GitHub
parent 1b72d901a5
commit 3e7f2074e5
8 changed files with 594 additions and 123 deletions

View File

@ -197,6 +197,34 @@ describe('Core REST API Find Many endpoint', () => {
);
});
it('should support filtering on a relation field id', async () => {
const response = await makeRestAPIRequest({
method: 'get',
path: `/people?filter=companyId[in]:["${TEST_COMPANY_1_ID}"]`,
}).expect(200);
const filteredPeople = response.body.data.people;
expect(filteredPeople.length).toBeGreaterThan(0);
});
it('should fail to filter on a relation field name', async () => {
const response = await makeRestAPIRequest({
method: 'get',
path: `/people?filter=company[in]:["${TEST_COMPANY_1_ID}"]`,
});
expect(response.body).toMatchInlineSnapshot(`
{
"error": "BadRequestException",
"messages": [
"field 'company' does not exist in 'person' object",
],
"statusCode": 400,
}
`);
});
it('should support ordering Desc of results', async () => {
const descResponse = await makeRestAPIRequest({
method: 'get',