Fix server integration tests 2 (#10818)
## Context - Removing search* integration tests instead of fixing them because they will be replaced by global search very soon - Fixed billing + add missing seeds to make them work - Fixed integration tests not using consistently the correct "test" db - Fixed ci not running the with-db-reset configuration due to nx configuration being used twice for different level of the command - Enriched .env.test - Fixed parts where exceptions were not thrown properly and not caught by exception handler to convert to 400 when needed - Refactored feature flag service that had 2 different implementations in lab and admin panel + added tests - Fixed race condition when migrations are created at the same timestamp and doing the same type of operation, in this case object deletion could break because table could be deleted earlier than its relations - Fixed many integration tests that were not up to date since the CI has been broken for a while --------- Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
This commit is contained in:
@ -1,13 +1,12 @@
|
||||
import { WorkspaceQueryHookInstance } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-hook/interfaces/workspace-query-hook.interface';
|
||||
import { DeleteManyResolverArgs } from 'src/engine/api/graphql/workspace-resolver-builder/interfaces/workspace-resolvers-builder.interface';
|
||||
|
||||
import {
|
||||
GraphqlQueryRunnerException,
|
||||
GraphqlQueryRunnerExceptionCode,
|
||||
} from 'src/engine/api/graphql/graphql-query-runner/errors/graphql-query-runner.exception';
|
||||
import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-hook/decorators/workspace-query-hook.decorator';
|
||||
import { AuthContext } from 'src/engine/core-modules/auth/types/auth-context.type';
|
||||
import {
|
||||
ViewException,
|
||||
ViewExceptionCode,
|
||||
ViewExceptionMessage,
|
||||
} from 'src/modules/view/views.exception';
|
||||
|
||||
@WorkspaceQueryHook(`view.deleteMany`)
|
||||
export class ViewDeleteManyPreQueryHook implements WorkspaceQueryHookInstance {
|
||||
@ -18,9 +17,9 @@ export class ViewDeleteManyPreQueryHook implements WorkspaceQueryHookInstance {
|
||||
_objectName: string,
|
||||
_payload: DeleteManyResolverArgs,
|
||||
): Promise<DeleteManyResolverArgs> {
|
||||
throw new ViewException(
|
||||
ViewExceptionMessage.METHOD_NOT_IMPLEMENTED,
|
||||
ViewExceptionCode.METHOD_NOT_IMPLEMENTED,
|
||||
throw new GraphqlQueryRunnerException(
|
||||
'Method not implemented',
|
||||
GraphqlQueryRunnerExceptionCode.NOT_IMPLEMENTED,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
import { WorkspaceQueryHookInstance } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-hook/interfaces/workspace-query-hook.interface';
|
||||
import { DeleteOneResolverArgs } from 'src/engine/api/graphql/workspace-resolver-builder/interfaces/workspace-resolvers-builder.interface';
|
||||
|
||||
import {
|
||||
GraphqlQueryRunnerException,
|
||||
GraphqlQueryRunnerExceptionCode,
|
||||
} from 'src/engine/api/graphql/graphql-query-runner/errors/graphql-query-runner.exception';
|
||||
import { WorkspaceQueryHook } from 'src/engine/api/graphql/workspace-query-runner/workspace-query-hook/decorators/workspace-query-hook.decorator';
|
||||
import { AuthContext } from 'src/engine/core-modules/auth/types/auth-context.type';
|
||||
import { TwentyORMGlobalManager } from 'src/engine/twenty-orm/twenty-orm-global.manager';
|
||||
import {
|
||||
ViewException,
|
||||
ViewExceptionCode,
|
||||
ViewExceptionMessage,
|
||||
} from 'src/modules/view/views.exception';
|
||||
|
||||
@WorkspaceQueryHook(`view.deleteOne`)
|
||||
export class ViewDeleteOnePreQueryHook implements WorkspaceQueryHookInstance {
|
||||
@ -34,16 +33,16 @@ export class ViewDeleteOnePreQueryHook implements WorkspaceQueryHookInstance {
|
||||
});
|
||||
|
||||
if (!view) {
|
||||
throw new ViewException(
|
||||
ViewExceptionMessage.VIEW_NOT_FOUND,
|
||||
ViewExceptionCode.VIEW_NOT_FOUND,
|
||||
throw new GraphqlQueryRunnerException(
|
||||
'View not found',
|
||||
GraphqlQueryRunnerExceptionCode.INVALID_QUERY_INPUT,
|
||||
);
|
||||
}
|
||||
|
||||
if (view.key === 'INDEX') {
|
||||
throw new ViewException(
|
||||
ViewExceptionMessage.CANNOT_DELETE_INDEX_VIEW,
|
||||
ViewExceptionCode.CANNOT_DELETE_INDEX_VIEW,
|
||||
throw new GraphqlQueryRunnerException(
|
||||
'Cannot delete INDEX view',
|
||||
GraphqlQueryRunnerExceptionCode.INVALID_QUERY_INPUT,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user