refactor source code
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Global, Module } from '@nestjs/common';
|
||||
import { Global, Module } from '@nestjs/common'
|
||||
|
||||
import { AppConfigSchema } from './appconfig.schema';
|
||||
import { AppConfigService } from './appconfig.service';
|
||||
import { AppConfigSchema } from './appconfig.schema'
|
||||
import { AppConfigService } from './appconfig.service'
|
||||
|
||||
@Global()
|
||||
@Module({
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable } from '@nestjs/common'
|
||||
import {
|
||||
PothosRef,
|
||||
PothosSchema,
|
||||
SchemaBuilderToken,
|
||||
} from '@smatch-corp/nestjs-pothos';
|
||||
import { Builder } from 'src/Graphql/graphql.builder';
|
||||
import { AppConfigService } from './appconfig.service';
|
||||
import { PrismaService } from 'src/Prisma/prisma.service';
|
||||
} from '@smatch-corp/nestjs-pothos'
|
||||
import { Builder } from 'src/Graphql/graphql.builder'
|
||||
import { AppConfigService } from './appconfig.service'
|
||||
import { PrismaService } from 'src/Prisma/prisma.service'
|
||||
|
||||
@Injectable()
|
||||
export class AppConfigSchema extends PothosSchema {
|
||||
@@ -15,7 +15,7 @@ export class AppConfigSchema extends PothosSchema {
|
||||
private readonly appConfigService: AppConfigService,
|
||||
private readonly prisma: PrismaService,
|
||||
) {
|
||||
super();
|
||||
super()
|
||||
}
|
||||
|
||||
@PothosRef()
|
||||
@@ -39,7 +39,7 @@ export class AppConfigSchema extends PothosSchema {
|
||||
description: 'Whether the config is visible',
|
||||
}),
|
||||
}),
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
@PothosRef()
|
||||
@@ -57,7 +57,7 @@ export class AppConfigSchema extends PothosSchema {
|
||||
cursor: args.cursor ?? undefined,
|
||||
skip: args.skip ?? undefined,
|
||||
take: args.take ?? undefined,
|
||||
});
|
||||
})
|
||||
},
|
||||
}),
|
||||
appConfig: t.prismaField({
|
||||
@@ -68,10 +68,10 @@ export class AppConfigSchema extends PothosSchema {
|
||||
return await this.prisma.config.findUnique({
|
||||
...query,
|
||||
where: args.where ?? undefined,
|
||||
});
|
||||
})
|
||||
},
|
||||
}),
|
||||
}));
|
||||
}))
|
||||
|
||||
// Mutations
|
||||
this.builder.mutationFields((t) => ({
|
||||
@@ -88,7 +88,7 @@ export class AppConfigSchema extends PothosSchema {
|
||||
return await this.prisma.config.create({
|
||||
...query,
|
||||
data: args.input,
|
||||
});
|
||||
})
|
||||
},
|
||||
}),
|
||||
createAppConfigs: t.prismaField({
|
||||
@@ -104,9 +104,9 @@ export class AppConfigSchema extends PothosSchema {
|
||||
return await this.prisma.config.createManyAndReturn({
|
||||
...query,
|
||||
data: args.input,
|
||||
});
|
||||
})
|
||||
},
|
||||
}),
|
||||
}));
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user