Fix view rest api in v2 (#15398)

# Introduction
Initially wanted to reactive the test introduced in
https://github.com/twentyhq/twenty/pull/15393, that was failing because
of direct data source access removing all views ( even seeded one )
which was making the test fail

While doing so discovered a lot of issue with the rest API:
- Rest api wasn't consuming the v2 at all
- Rest api wasn't prepared to handle v2 exceptions
- Rest api did not handled unknown exceptions ( timeout )

Refactored the cleanup of each test to follow black box pattern and
avoid test leakage
This commit is contained in:
Paul Rastoin
2025-10-29 15:07:08 +01:00
committed by GitHub
parent 28c6edfa1f
commit c19a799973
34 changed files with 1281 additions and 577 deletions
@@ -1,6 +1,5 @@
import { msg } from '@lingui/core/macro';
import { type MessageDescriptor } from '@lingui/core';
import { assertUnreachable } from 'twenty-shared/utils';
import { msg } from '@lingui/core/macro';
import { CustomException } from 'src/utils/custom-exception';
@@ -44,7 +43,7 @@ export const generateViewGroupExceptionMessage = (
case ViewGroupExceptionMessageKey.FIELD_METADATA_ID_REQUIRED:
return 'FieldMetadataId is required';
default:
assertUnreachable(key);
return 'unknown';
}
};
@@ -58,5 +57,8 @@ export const generateViewGroupUserFriendlyExceptionMessage = (
return msg`ViewId is required to create a view group.`;
case ViewGroupExceptionMessageKey.FIELD_METADATA_ID_REQUIRED:
return msg`FieldMetadataId is required to create a view group.`;
default: {
return msg`unknown`;
}
}
};