chore(*): remove unused code (#6781)
The code removed in the PR was flagged as unused by the JetBrains inspector. I did a QA on the dev environment but other checks are highly recommended. There is one commit by scope to make the review easier. --------- Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
@ -75,9 +75,6 @@ export class GraphQLConfigService
|
||||
|
||||
const data = await this.tokenService.validateToken(context.req);
|
||||
|
||||
user = data.user;
|
||||
workspace = data.workspace;
|
||||
|
||||
return await this.createSchema(context, data);
|
||||
} catch (error) {
|
||||
if (error instanceof UnauthorizedException) {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
@ -14,8 +14,6 @@ import { FieldsStringFactory } from './fields-string.factory';
|
||||
|
||||
@Injectable()
|
||||
export class CreateManyQueryFactory {
|
||||
private readonly logger = new Logger(CreateManyQueryFactory.name);
|
||||
|
||||
constructor(
|
||||
private readonly fieldsStringFactory: FieldsStringFactory,
|
||||
private readonly argsAliasFactory: ArgsAliasFactory,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { WorkspaceQueryBuilderOptions } from 'src/engine/api/graphql/workspace-query-builder/interfaces/workspace-query-builder-options.interface';
|
||||
import { DeleteOneResolverArgs } from 'src/engine/api/graphql/workspace-resolver-builder/interfaces/workspace-resolvers-builder.interface';
|
||||
@ -9,8 +9,6 @@ import { FieldsStringFactory } from './fields-string.factory';
|
||||
|
||||
@Injectable()
|
||||
export class DeleteOneQueryFactory {
|
||||
private readonly logger = new Logger(DeleteOneQueryFactory.name);
|
||||
|
||||
constructor(private readonly fieldsStringFactory: FieldsStringFactory) {}
|
||||
|
||||
async create(
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { GraphQLResolveInfo } from 'graphql';
|
||||
import graphqlFields from 'graphql-fields';
|
||||
@ -15,8 +15,6 @@ import { RelationFieldAliasFactory } from './relation-field-alias.factory';
|
||||
|
||||
@Injectable()
|
||||
export class FieldsStringFactory {
|
||||
private readonly logger = new Logger(FieldsStringFactory.name);
|
||||
|
||||
constructor(
|
||||
private readonly fieldAliasFactory: FieldAliasFactory,
|
||||
private readonly relationFieldAliasFactory: RelationFieldAliasFactory,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import isEmpty from 'lodash.isempty';
|
||||
|
||||
@ -15,8 +15,6 @@ import { FieldsStringFactory } from './fields-string.factory';
|
||||
|
||||
@Injectable()
|
||||
export class FindDuplicatesQueryFactory {
|
||||
private readonly logger = new Logger(FindDuplicatesQueryFactory.name);
|
||||
|
||||
constructor(
|
||||
private readonly fieldsStringFactory: FieldsStringFactory,
|
||||
private readonly argsAliasFactory: ArgsAliasFactory,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import {
|
||||
RecordFilter,
|
||||
@ -14,8 +14,6 @@ import { FieldsStringFactory } from './fields-string.factory';
|
||||
|
||||
@Injectable()
|
||||
export class FindManyQueryFactory {
|
||||
private readonly logger = new Logger(FindManyQueryFactory.name);
|
||||
|
||||
constructor(
|
||||
private readonly fieldsStringFactory: FieldsStringFactory,
|
||||
private readonly argsStringFactory: ArgsStringFactory,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { WorkspaceQueryBuilderOptions } from 'src/engine/api/graphql/workspace-query-builder/interfaces/workspace-query-builder-options.interface';
|
||||
import { RecordFilter } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface';
|
||||
@ -11,8 +11,6 @@ import { FieldsStringFactory } from './fields-string.factory';
|
||||
|
||||
@Injectable()
|
||||
export class FindOneQueryFactory {
|
||||
private readonly logger = new Logger(FindOneQueryFactory.name);
|
||||
|
||||
constructor(
|
||||
private readonly fieldsStringFactory: FieldsStringFactory,
|
||||
private readonly argsStringFactory: ArgsStringFactory,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { forwardRef, Inject, Injectable, Logger } from '@nestjs/common';
|
||||
import { forwardRef, Inject, Injectable } from '@nestjs/common';
|
||||
|
||||
import { GraphQLResolveInfo } from 'graphql';
|
||||
|
||||
@ -20,8 +20,6 @@ import { ArgsStringFactory } from './args-string.factory';
|
||||
|
||||
@Injectable()
|
||||
export class RelationFieldAliasFactory {
|
||||
private logger = new Logger(RelationFieldAliasFactory.name);
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => FieldsStringFactory))
|
||||
private readonly fieldsStringFactory: CircularDep<FieldsStringFactory>,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { Record as IRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface';
|
||||
import { WorkspaceQueryBuilderOptions } from 'src/engine/api/graphql/workspace-query-builder/interfaces/workspace-query-builder-options.interface';
|
||||
@ -12,8 +12,6 @@ import { FieldsStringFactory } from './fields-string.factory';
|
||||
|
||||
@Injectable()
|
||||
export class UpdateOneQueryFactory {
|
||||
private readonly logger = new Logger(UpdateOneQueryFactory.name);
|
||||
|
||||
constructor(
|
||||
private readonly fieldsStringFactory: FieldsStringFactory,
|
||||
private readonly argsAliasFactory: ArgsAliasFactory,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { WorkspaceQueryBuilderOptions } from 'src/engine/api/graphql/workspace-query-builder/interfaces/workspace-query-builder-options.interface';
|
||||
import {
|
||||
@ -34,8 +34,6 @@ import { FindDuplicatesQueryFactory } from './factories/find-duplicates-query.fa
|
||||
|
||||
@Injectable()
|
||||
export class WorkspaceQueryBuilderFactory {
|
||||
private readonly logger = new Logger(WorkspaceQueryBuilderFactory.name);
|
||||
|
||||
constructor(
|
||||
private readonly findManyQueryFactory: FindManyQueryFactory,
|
||||
private readonly findOneQueryFactory: FindOneQueryFactory,
|
||||
|
||||
@ -1,12 +1,12 @@
|
||||
import { TestingModule, Test } from '@nestjs/testing';
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
|
||||
import { WorkspaceDataSourceService } from 'src/engine/workspace-datasource/workspace-datasource.service';
|
||||
import { RecordPositionQueryFactory } from 'src/engine/api/graphql/workspace-query-builder/factories/record-position-query.factory';
|
||||
import { RecordPositionFactory } from 'src/engine/api/graphql/workspace-query-runner/factories/record-position.factory';
|
||||
import { WorkspaceDataSourceService } from 'src/engine/workspace-datasource/workspace-datasource.service';
|
||||
|
||||
describe('RecordPositionFactory', () => {
|
||||
const recordPositionQueryFactory = {
|
||||
create: jest.fn().mockResolvedValue('query'),
|
||||
create: jest.fn().mockReturnValue(['query', []]),
|
||||
};
|
||||
|
||||
let workspaceDataSourceService;
|
||||
|
||||
@ -134,7 +134,7 @@ export class QueryRunnerArgsFactory {
|
||||
),
|
||||
];
|
||||
case FieldMetadataType.NUMBER:
|
||||
return [key, await Promise.resolve(Number(value))];
|
||||
return [key, Number(value)];
|
||||
default:
|
||||
return [key, await Promise.resolve(value)];
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ export class RecordPositionFactory {
|
||||
dataSourceSchema: string,
|
||||
workspaceId: string,
|
||||
) {
|
||||
const [query, params] = await this.recordPositionQueryFactory.create(
|
||||
const [query, params] = this.recordPositionQueryFactory.create(
|
||||
recordPositionQueryArgs,
|
||||
objectMetadata,
|
||||
dataSourceSchema,
|
||||
|
||||
@ -66,10 +66,4 @@ export class WorkspaceQueryHookStorage {
|
||||
|
||||
this.postHookInstances.get(key)?.push(data);
|
||||
}
|
||||
|
||||
getWorkspaceQueryPostHookInstances(
|
||||
key: WorkspaceQueryHookKey,
|
||||
): WorkspaceQueryHookData<WorkspaceQueryHookInstance>[] | undefined {
|
||||
return this.postHookInstances.get(key);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ import { WorkspaceQueryHookOptions } from 'src/engine/api/graphql/workspace-quer
|
||||
export class WorkspaceQueryHookMetadataAccessor {
|
||||
constructor(private readonly reflector: Reflector) {}
|
||||
|
||||
isWorkspaceQueryHook(target: Type<any> | Function): boolean {
|
||||
isWorkspaceQueryHook(target: Type | Function): boolean {
|
||||
if (!target) {
|
||||
return false;
|
||||
}
|
||||
@ -18,7 +18,7 @@ export class WorkspaceQueryHookMetadataAccessor {
|
||||
}
|
||||
|
||||
getWorkspaceQueryHookMetadata(
|
||||
target: Type<any> | Function,
|
||||
target: Type | Function,
|
||||
): WorkspaceQueryHookOptions | undefined {
|
||||
return this.reflector.get(WORKSPACE_QUERY_HOOK_METADATA, target);
|
||||
}
|
||||
|
||||
@ -1011,17 +1011,6 @@ export class WorkspaceQueryRunnerService {
|
||||
return parseResult(resultWithGetters);
|
||||
}
|
||||
|
||||
async executeAndParse<Result>(
|
||||
query: string,
|
||||
objectMetadataItem: ObjectMetadataInterface,
|
||||
command: string,
|
||||
workspaceId: string,
|
||||
): Promise<Result> {
|
||||
const result = await this.execute(query, workspaceId);
|
||||
|
||||
return this.parseResult(result, objectMetadataItem, command, workspaceId);
|
||||
}
|
||||
|
||||
async triggerWebhooks<Record>(
|
||||
jobsData: Record[] | undefined,
|
||||
operation: CallWebhookJobsJobOperation,
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { GraphQLFieldConfigMap, GraphQLInt, GraphQLObjectType } from 'graphql';
|
||||
|
||||
@ -20,8 +20,6 @@ export enum ConnectionTypeDefinitionKind {
|
||||
|
||||
@Injectable()
|
||||
export class ConnectionTypeDefinitionFactory {
|
||||
private readonly logger = new Logger(ConnectionTypeDefinitionFactory.name);
|
||||
|
||||
constructor(private readonly connectionTypeFactory: ConnectionTypeFactory) {}
|
||||
|
||||
public create(
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { GraphQLFieldConfigMap, GraphQLObjectType } from 'graphql';
|
||||
|
||||
@ -20,8 +20,6 @@ export enum EdgeTypeDefinitionKind {
|
||||
|
||||
@Injectable()
|
||||
export class EdgeTypeDefinitionFactory {
|
||||
private readonly logger = new Logger(EdgeTypeDefinitionFactory.name);
|
||||
|
||||
constructor(private readonly edgeTypeFactory: EdgeTypeFactory) {}
|
||||
|
||||
public create(
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
import { GraphQLInputObjectType, GraphQLList, GraphQLNonNull } from 'graphql';
|
||||
|
||||
import { FilterIs } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/filter-is.input-type';
|
||||
import { DateTimeScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
export const DatetimeFilterType = new GraphQLInputObjectType({
|
||||
name: 'DateTimeFilter',
|
||||
fields: {
|
||||
eq: { type: DateTimeScalarType },
|
||||
gt: { type: DateTimeScalarType },
|
||||
gte: { type: DateTimeScalarType },
|
||||
in: { type: new GraphQLList(new GraphQLNonNull(DateTimeScalarType)) },
|
||||
lt: { type: DateTimeScalarType },
|
||||
lte: { type: DateTimeScalarType },
|
||||
neq: { type: DateTimeScalarType },
|
||||
is: { type: FilterIs },
|
||||
},
|
||||
});
|
||||
@ -2,10 +2,7 @@ export * from './big-float-filter.input-type';
|
||||
export * from './big-int-filter.input-type';
|
||||
export * from './boolean-filter.input-type';
|
||||
export * from './date-filter.input-type';
|
||||
export * from './date-time-filter.input-type';
|
||||
export * from './float-filter.input-type';
|
||||
export * from './int-filter.input-type';
|
||||
export * from './raw-json-filter.input-type';
|
||||
export * from './string-filter.input-type';
|
||||
export * from './time-filter.input-type';
|
||||
export * from './uuid-filter.input-type';
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
import { GraphQLInputObjectType, GraphQLList, GraphQLNonNull } from 'graphql';
|
||||
|
||||
import { FilterIs } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/filter-is.input-type';
|
||||
import { TimeScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
export const TimeFilterType = new GraphQLInputObjectType({
|
||||
name: 'TimeFilter',
|
||||
fields: {
|
||||
eq: { type: TimeScalarType },
|
||||
gt: { type: TimeScalarType },
|
||||
gte: { type: TimeScalarType },
|
||||
in: { type: new GraphQLList(new GraphQLNonNull(TimeScalarType)) },
|
||||
lt: { type: TimeScalarType },
|
||||
lte: { type: TimeScalarType },
|
||||
neq: { type: TimeScalarType },
|
||||
is: { type: FilterIs },
|
||||
},
|
||||
});
|
||||
@ -1,14 +0,0 @@
|
||||
import { GraphQLInputObjectType, GraphQLList } from 'graphql';
|
||||
|
||||
import { FilterIs } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/input/filter-is.input-type';
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
|
||||
export const UUIDFilterType = new GraphQLInputObjectType({
|
||||
name: 'UUIDFilter',
|
||||
fields: {
|
||||
eq: { type: UUIDScalarType },
|
||||
in: { type: new GraphQLList(UUIDScalarType) },
|
||||
neq: { type: UUIDScalarType },
|
||||
is: { type: FilterIs },
|
||||
},
|
||||
});
|
||||
@ -1,4 +1,4 @@
|
||||
import { Injectable, Logger } from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
|
||||
import { GraphQLSchema } from 'graphql';
|
||||
|
||||
@ -14,8 +14,6 @@ import { OrphanedTypesFactory } from './factories/orphaned-types.factory';
|
||||
|
||||
@Injectable()
|
||||
export class WorkspaceGraphQLSchemaFactory {
|
||||
private readonly logger = new Logger(WorkspaceGraphQLSchemaFactory.name);
|
||||
|
||||
constructor(
|
||||
private readonly typeDefinitionsGenerator: TypeDefinitionsGenerator,
|
||||
private readonly queryTypeFactory: QueryTypeFactory,
|
||||
|
||||
Reference in New Issue
Block a user