fix: small tenant refactor fixes (#2375)

This commit is contained in:
Jérémy M 2023-11-06 15:49:06 +01:00 committed by GitHub
parent bb8cddddc4
commit 3432615a17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 29 additions and 16 deletions

View File

@ -10,7 +10,7 @@ export interface FieldMetadataTargetColumnMapUrl {
}
export interface FieldMetadataTargetColumnMapMoney {
value: number;
amount: number;
currency: string;
}

View File

@ -5,13 +5,15 @@ import {
Resolver,
} from 'src/tenant/resolver-builder/interfaces/resolvers-builder.interface';
import { SchemaBuilderContext } from 'src/tenant/schema-builder/interfaces/schema-builder-context.interface';
import { FactoryInterface } from 'src/tenant/resolver-builder/interfaces/factory.interface';
import { ResolverBuilderFactoryInterface } from 'src/tenant/resolver-builder/interfaces/resolver-builder-factory.interface';
import { DataSourceService } from 'src/metadata/data-source/data-source.service';
import { PGGraphQLQueryRunner } from 'src/tenant/resolver-builder/pg-graphql/pg-graphql-query-runner';
@Injectable()
export class CreateManyResolverFactory implements FactoryInterface {
export class CreateManyResolverFactory
implements ResolverBuilderFactoryInterface
{
public static methodName = 'createMany' as const;
constructor(private readonly dataSourceService: DataSourceService) {}

View File

@ -5,14 +5,16 @@ import {
Resolver,
} from 'src/tenant/resolver-builder/interfaces/resolvers-builder.interface';
import { SchemaBuilderContext } from 'src/tenant/schema-builder/interfaces/schema-builder-context.interface';
import { FactoryInterface } from 'src/tenant/resolver-builder/interfaces/factory.interface';
import { ResolverBuilderFactoryInterface } from 'src/tenant/resolver-builder/interfaces/resolver-builder-factory.interface';
import { DataSourceService } from 'src/metadata/data-source/data-source.service';
import { PGGraphQLQueryRunner } from 'src/tenant/resolver-builder/pg-graphql/pg-graphql-query-runner';
import { FieldMetadata } from 'src/metadata/field-metadata/field-metadata.entity';
@Injectable()
export class CreateOneResolverFactory implements FactoryInterface {
export class CreateOneResolverFactory
implements ResolverBuilderFactoryInterface
{
public static methodName = 'createOne' as const;
constructor(private readonly dataSourceService: DataSourceService) {}

View File

@ -5,14 +5,16 @@ import {
Resolver,
} from 'src/tenant/resolver-builder/interfaces/resolvers-builder.interface';
import { SchemaBuilderContext } from 'src/tenant/schema-builder/interfaces/schema-builder-context.interface';
import { FactoryInterface } from 'src/tenant/resolver-builder/interfaces/factory.interface';
import { ResolverBuilderFactoryInterface } from 'src/tenant/resolver-builder/interfaces/resolver-builder-factory.interface';
import { DataSourceService } from 'src/metadata/data-source/data-source.service';
import { PGGraphQLQueryRunner } from 'src/tenant/resolver-builder/pg-graphql/pg-graphql-query-runner';
import { FieldMetadata } from 'src/metadata/field-metadata/field-metadata.entity';
@Injectable()
export class DeleteOneResolverFactory implements FactoryInterface {
export class DeleteOneResolverFactory
implements ResolverBuilderFactoryInterface
{
public static methodName = 'deleteOne' as const;
constructor(private readonly dataSourceService: DataSourceService) {}

View File

@ -5,13 +5,15 @@ import {
Resolver,
} from 'src/tenant/resolver-builder/interfaces/resolvers-builder.interface';
import { SchemaBuilderContext } from 'src/tenant/schema-builder/interfaces/schema-builder-context.interface';
import { FactoryInterface } from 'src/tenant/resolver-builder/interfaces/factory.interface';
import { ResolverBuilderFactoryInterface } from 'src/tenant/resolver-builder/interfaces/resolver-builder-factory.interface';
import { DataSourceService } from 'src/metadata/data-source/data-source.service';
import { PGGraphQLQueryRunner } from 'src/tenant/resolver-builder/pg-graphql/pg-graphql-query-runner';
@Injectable()
export class FindManyResolverFactory implements FactoryInterface {
export class FindManyResolverFactory
implements ResolverBuilderFactoryInterface
{
public static methodName = 'findMany' as const;
constructor(private readonly dataSourceService: DataSourceService) {}

View File

@ -5,14 +5,14 @@ import {
Resolver,
} from 'src/tenant/resolver-builder/interfaces/resolvers-builder.interface';
import { SchemaBuilderContext } from 'src/tenant/schema-builder/interfaces/schema-builder-context.interface';
import { FactoryInterface } from 'src/tenant/resolver-builder/interfaces/factory.interface';
import { ResolverBuilderFactoryInterface } from 'src/tenant/resolver-builder/interfaces/resolver-builder-factory.interface';
import { DataSourceService } from 'src/metadata/data-source/data-source.service';
import { PGGraphQLQueryRunner } from 'src/tenant/resolver-builder/pg-graphql/pg-graphql-query-runner';
import { FieldMetadata } from 'src/metadata/field-metadata/field-metadata.entity';
@Injectable()
export class FindOneResolverFactory implements FactoryInterface {
export class FindOneResolverFactory implements ResolverBuilderFactoryInterface {
public static methodName = 'findOne' as const;
constructor(private readonly dataSourceService: DataSourceService) {}

View File

@ -5,14 +5,16 @@ import {
UpdateOneResolverArgs,
} from 'src/tenant/resolver-builder/interfaces/resolvers-builder.interface';
import { SchemaBuilderContext } from 'src/tenant/schema-builder/interfaces/schema-builder-context.interface';
import { FactoryInterface } from 'src/tenant/resolver-builder/interfaces/factory.interface';
import { ResolverBuilderFactoryInterface } from 'src/tenant/resolver-builder/interfaces/resolver-builder-factory.interface';
import { DataSourceService } from 'src/metadata/data-source/data-source.service';
import { PGGraphQLQueryRunner } from 'src/tenant/resolver-builder/pg-graphql/pg-graphql-query-runner';
import { FieldMetadata } from 'src/metadata/field-metadata/field-metadata.entity';
@Injectable()
export class UpdateOneResolverFactory implements FactoryInterface {
export class UpdateOneResolverFactory
implements ResolverBuilderFactoryInterface
{
public static methodName = 'updateOne' as const;
constructor(private readonly dataSourceService: DataSourceService) {}

View File

@ -2,6 +2,6 @@ import { SchemaBuilderContext } from 'src/tenant/schema-builder/interfaces/schem
import { Resolver } from './resolvers-builder.interface';
export interface FactoryInterface {
export interface ResolverBuilderFactoryInterface {
create(context: SchemaBuilderContext): Resolver;
}

View File

@ -16,7 +16,7 @@ import {
ResolverBuilderMethodNames,
ResolverBuilderMethods,
} from './interfaces/resolvers-builder.interface';
import { FactoryInterface } from './interfaces/factory.interface';
import { ResolverBuilderFactoryInterface } from './interfaces/resolver-builder-factory.interface';
@Injectable()
export class ResolverFactory {
@ -36,7 +36,10 @@ export class ResolverFactory {
objectMetadataCollection: ObjectMetadataInterface[],
resolverBuilderMethods: ResolverBuilderMethods,
): Promise<IResolvers> {
const factories = new Map<ResolverBuilderMethodNames, FactoryInterface>([
const factories = new Map<
ResolverBuilderMethodNames,
ResolverBuilderFactoryInterface
>([
['findMany', this.findManyResolverFactory],
['findOne', this.findOneResolverFactory],
['createMany', this.createManyResolverFactory],