diff --git a/experiments/prisma/generated/type-graphql/helpers.ts b/experiments/prisma/generated/type-graphql/helpers.ts index 58613aea..9481087f 100644 --- a/experiments/prisma/generated/type-graphql/helpers.ts +++ b/experiments/prisma/generated/type-graphql/helpers.ts @@ -13,3 +13,12 @@ export function transformFields(fields: Record): Record Category) export class AggregateCategoryResolver { @@ -12,7 +12,7 @@ export class AggregateCategoryResolver { nullable: false }) async aggregateCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateCategoryArgs): Promise { - return ctx.prisma.category.aggregate({ + return getPrismaFromContext(ctx).category.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/CategoryCrudResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/CategoryCrudResolver.ts index ff413064..9b4302db 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/CategoryCrudResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/CategoryCrudResolver.ts @@ -13,7 +13,7 @@ import { GroupByCategoryArgs } from "./args/GroupByCategoryArgs"; import { UpdateCategoryArgs } from "./args/UpdateCategoryArgs"; import { UpdateManyCategoryArgs } from "./args/UpdateManyCategoryArgs"; import { UpsertCategoryArgs } from "./args/UpsertCategoryArgs"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; import { Category } from "../../../models/Category"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; import { AggregateCategory } from "../../outputs/AggregateCategory"; @@ -25,77 +25,77 @@ export class CategoryCrudResolver { nullable: true }) async category(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueCategoryArgs): Promise { - return ctx.prisma.category.findUnique(args); + return getPrismaFromContext(ctx).category.findUnique(args); } @TypeGraphQL.Query(_returns => Category, { nullable: true }) async findFirstCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstCategoryArgs): Promise { - return ctx.prisma.category.findFirst(args); + return getPrismaFromContext(ctx).category.findFirst(args); } @TypeGraphQL.Query(_returns => [Category], { nullable: false }) async categories(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyCategoryArgs): Promise { - return ctx.prisma.category.findMany(args); + return getPrismaFromContext(ctx).category.findMany(args); } @TypeGraphQL.Mutation(_returns => Category, { nullable: false }) async createCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateCategoryArgs): Promise { - return ctx.prisma.category.create(args); + return getPrismaFromContext(ctx).category.create(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async createManyCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyCategoryArgs): Promise { - return ctx.prisma.category.createMany(args); + return getPrismaFromContext(ctx).category.createMany(args); } @TypeGraphQL.Mutation(_returns => Category, { nullable: true }) async deleteCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteCategoryArgs): Promise { - return ctx.prisma.category.delete(args); + return getPrismaFromContext(ctx).category.delete(args); } @TypeGraphQL.Mutation(_returns => Category, { nullable: true }) async updateCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateCategoryArgs): Promise { - return ctx.prisma.category.update(args); + return getPrismaFromContext(ctx).category.update(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async deleteManyCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyCategoryArgs): Promise { - return ctx.prisma.category.deleteMany(args); + return getPrismaFromContext(ctx).category.deleteMany(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async updateManyCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyCategoryArgs): Promise { - return ctx.prisma.category.updateMany(args); + return getPrismaFromContext(ctx).category.updateMany(args); } @TypeGraphQL.Mutation(_returns => Category, { nullable: false }) async upsertCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertCategoryArgs): Promise { - return ctx.prisma.category.upsert(args); + return getPrismaFromContext(ctx).category.upsert(args); } @TypeGraphQL.Query(_returns => AggregateCategory, { nullable: false }) async aggregateCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateCategoryArgs): Promise { - return ctx.prisma.category.aggregate({ + return getPrismaFromContext(ctx).category.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); @@ -108,7 +108,7 @@ export class CategoryCrudResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.category.groupBy({ + return getPrismaFromContext(ctx).category.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/CreateCategoryResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/CreateCategoryResolver.ts index 2ce36e59..40a3626f 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/CreateCategoryResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/CreateCategoryResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreateCategoryArgs } from "./args/CreateCategoryArgs"; import { Category } from "../../../models/Category"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Category) export class CreateCategoryResolver { @@ -9,6 +9,6 @@ export class CreateCategoryResolver { nullable: false }) async createCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateCategoryArgs): Promise { - return ctx.prisma.category.create(args); + return getPrismaFromContext(ctx).category.create(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/CreateManyCategoryResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/CreateManyCategoryResolver.ts index 72c525a4..a13e386d 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/CreateManyCategoryResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/CreateManyCategoryResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreateManyCategoryArgs } from "./args/CreateManyCategoryArgs"; import { Category } from "../../../models/Category"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Category) export class CreateManyCategoryResolver { @@ -10,6 +10,6 @@ export class CreateManyCategoryResolver { nullable: false }) async createManyCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyCategoryArgs): Promise { - return ctx.prisma.category.createMany(args); + return getPrismaFromContext(ctx).category.createMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/DeleteCategoryResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/DeleteCategoryResolver.ts index 744f1f8e..18779260 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/DeleteCategoryResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/DeleteCategoryResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeleteCategoryArgs } from "./args/DeleteCategoryArgs"; import { Category } from "../../../models/Category"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Category) export class DeleteCategoryResolver { @@ -9,6 +9,6 @@ export class DeleteCategoryResolver { nullable: true }) async deleteCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteCategoryArgs): Promise { - return ctx.prisma.category.delete(args); + return getPrismaFromContext(ctx).category.delete(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/DeleteManyCategoryResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/DeleteManyCategoryResolver.ts index 548c1352..bbff5cd4 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/DeleteManyCategoryResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/DeleteManyCategoryResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeleteManyCategoryArgs } from "./args/DeleteManyCategoryArgs"; import { Category } from "../../../models/Category"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Category) export class DeleteManyCategoryResolver { @@ -10,6 +10,6 @@ export class DeleteManyCategoryResolver { nullable: false }) async deleteManyCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyCategoryArgs): Promise { - return ctx.prisma.category.deleteMany(args); + return getPrismaFromContext(ctx).category.deleteMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/FindFirstCategoryResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/FindFirstCategoryResolver.ts index 1c3aa272..8eb796af 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/FindFirstCategoryResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/FindFirstCategoryResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindFirstCategoryArgs } from "./args/FindFirstCategoryArgs"; import { Category } from "../../../models/Category"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Category) export class FindFirstCategoryResolver { @@ -9,6 +9,6 @@ export class FindFirstCategoryResolver { nullable: true }) async findFirstCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstCategoryArgs): Promise { - return ctx.prisma.category.findFirst(args); + return getPrismaFromContext(ctx).category.findFirst(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/FindManyCategoryResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/FindManyCategoryResolver.ts index 1a7a9997..13fa7c54 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/FindManyCategoryResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/FindManyCategoryResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindManyCategoryArgs } from "./args/FindManyCategoryArgs"; import { Category } from "../../../models/Category"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Category) export class FindManyCategoryResolver { @@ -9,6 +9,6 @@ export class FindManyCategoryResolver { nullable: false }) async categories(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyCategoryArgs): Promise { - return ctx.prisma.category.findMany(args); + return getPrismaFromContext(ctx).category.findMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/FindUniqueCategoryResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/FindUniqueCategoryResolver.ts index 0bca0580..72db785c 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/FindUniqueCategoryResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/FindUniqueCategoryResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindUniqueCategoryArgs } from "./args/FindUniqueCategoryArgs"; import { Category } from "../../../models/Category"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Category) export class FindUniqueCategoryResolver { @@ -9,6 +9,6 @@ export class FindUniqueCategoryResolver { nullable: true }) async category(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueCategoryArgs): Promise { - return ctx.prisma.category.findUnique(args); + return getPrismaFromContext(ctx).category.findUnique(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/GroupByCategoryResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/GroupByCategoryResolver.ts index 551b28c8..fe79b01f 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/GroupByCategoryResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/GroupByCategoryResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { GroupByCategoryArgs } from "./args/GroupByCategoryArgs"; import { Category } from "../../../models/Category"; import { CategoryGroupBy } from "../../outputs/CategoryGroupBy"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Category) export class GroupByCategoryResolver { @@ -15,7 +15,7 @@ export class GroupByCategoryResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.category.groupBy({ + return getPrismaFromContext(ctx).category.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/UpdateCategoryResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/UpdateCategoryResolver.ts index 04c312f3..5a8c01ee 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/UpdateCategoryResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/UpdateCategoryResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdateCategoryArgs } from "./args/UpdateCategoryArgs"; import { Category } from "../../../models/Category"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Category) export class UpdateCategoryResolver { @@ -9,6 +9,6 @@ export class UpdateCategoryResolver { nullable: true }) async updateCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateCategoryArgs): Promise { - return ctx.prisma.category.update(args); + return getPrismaFromContext(ctx).category.update(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/UpdateManyCategoryResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/UpdateManyCategoryResolver.ts index c1e1b4bb..9515b30a 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/UpdateManyCategoryResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/UpdateManyCategoryResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdateManyCategoryArgs } from "./args/UpdateManyCategoryArgs"; import { Category } from "../../../models/Category"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Category) export class UpdateManyCategoryResolver { @@ -10,6 +10,6 @@ export class UpdateManyCategoryResolver { nullable: false }) async updateManyCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyCategoryArgs): Promise { - return ctx.prisma.category.updateMany(args); + return getPrismaFromContext(ctx).category.updateMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/UpsertCategoryResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/UpsertCategoryResolver.ts index 1dbfb356..cf7942bf 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Category/UpsertCategoryResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Category/UpsertCategoryResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpsertCategoryArgs } from "./args/UpsertCategoryArgs"; import { Category } from "../../../models/Category"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Category) export class UpsertCategoryResolver { @@ -9,6 +9,6 @@ export class UpsertCategoryResolver { nullable: false }) async upsertCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertCategoryArgs): Promise { - return ctx.prisma.category.upsert(args); + return getPrismaFromContext(ctx).category.upsert(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/AggregateClientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/AggregateClientResolver.ts index d855ed0a..93df9fa4 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/AggregateClientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/AggregateClientResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { AggregateClientArgs } from "./args/AggregateClientArgs"; import { Client } from "../../../models/Client"; import { AggregateClient } from "../../outputs/AggregateClient"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Client) export class AggregateClientResolver { @@ -12,7 +12,7 @@ export class AggregateClientResolver { nullable: false }) async aggregateClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateClientArgs): Promise { - return ctx.prisma.user.aggregate({ + return getPrismaFromContext(ctx).user.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/ClientCrudResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/ClientCrudResolver.ts index 8e8da605..193e594f 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/ClientCrudResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/ClientCrudResolver.ts @@ -13,7 +13,7 @@ import { GroupByClientArgs } from "./args/GroupByClientArgs"; import { UpdateClientArgs } from "./args/UpdateClientArgs"; import { UpdateManyClientArgs } from "./args/UpdateManyClientArgs"; import { UpsertClientArgs } from "./args/UpsertClientArgs"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; import { Client } from "../../../models/Client"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; import { AggregateClient } from "../../outputs/AggregateClient"; @@ -25,77 +25,77 @@ export class ClientCrudResolver { nullable: true }) async client(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueClientArgs): Promise { - return ctx.prisma.user.findUnique(args); + return getPrismaFromContext(ctx).user.findUnique(args); } @TypeGraphQL.Query(_returns => Client, { nullable: true }) async findFirstClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstClientArgs): Promise { - return ctx.prisma.user.findFirst(args); + return getPrismaFromContext(ctx).user.findFirst(args); } @TypeGraphQL.Query(_returns => [Client], { nullable: false }) async clients(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyClientArgs): Promise { - return ctx.prisma.user.findMany(args); + return getPrismaFromContext(ctx).user.findMany(args); } @TypeGraphQL.Mutation(_returns => Client, { nullable: false }) async createClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateClientArgs): Promise { - return ctx.prisma.user.create(args); + return getPrismaFromContext(ctx).user.create(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async createManyClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyClientArgs): Promise { - return ctx.prisma.user.createMany(args); + return getPrismaFromContext(ctx).user.createMany(args); } @TypeGraphQL.Mutation(_returns => Client, { nullable: true }) async deleteClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteClientArgs): Promise { - return ctx.prisma.user.delete(args); + return getPrismaFromContext(ctx).user.delete(args); } @TypeGraphQL.Mutation(_returns => Client, { nullable: true }) async updateClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateClientArgs): Promise { - return ctx.prisma.user.update(args); + return getPrismaFromContext(ctx).user.update(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async deleteManyClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyClientArgs): Promise { - return ctx.prisma.user.deleteMany(args); + return getPrismaFromContext(ctx).user.deleteMany(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async updateManyClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyClientArgs): Promise { - return ctx.prisma.user.updateMany(args); + return getPrismaFromContext(ctx).user.updateMany(args); } @TypeGraphQL.Mutation(_returns => Client, { nullable: false }) async upsertClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertClientArgs): Promise { - return ctx.prisma.user.upsert(args); + return getPrismaFromContext(ctx).user.upsert(args); } @TypeGraphQL.Query(_returns => AggregateClient, { nullable: false }) async aggregateClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateClientArgs): Promise { - return ctx.prisma.user.aggregate({ + return getPrismaFromContext(ctx).user.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); @@ -108,7 +108,7 @@ export class ClientCrudResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.user.groupBy({ + return getPrismaFromContext(ctx).user.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/CreateClientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/CreateClientResolver.ts index 4df28349..eed200d4 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/CreateClientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/CreateClientResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreateClientArgs } from "./args/CreateClientArgs"; import { Client } from "../../../models/Client"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Client) export class CreateClientResolver { @@ -9,6 +9,6 @@ export class CreateClientResolver { nullable: false }) async createClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateClientArgs): Promise { - return ctx.prisma.user.create(args); + return getPrismaFromContext(ctx).user.create(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/CreateManyClientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/CreateManyClientResolver.ts index 1e9a952c..6c6fc5c1 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/CreateManyClientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/CreateManyClientResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreateManyClientArgs } from "./args/CreateManyClientArgs"; import { Client } from "../../../models/Client"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Client) export class CreateManyClientResolver { @@ -10,6 +10,6 @@ export class CreateManyClientResolver { nullable: false }) async createManyClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyClientArgs): Promise { - return ctx.prisma.user.createMany(args); + return getPrismaFromContext(ctx).user.createMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/DeleteClientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/DeleteClientResolver.ts index 6f5c5465..9e5688f5 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/DeleteClientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/DeleteClientResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeleteClientArgs } from "./args/DeleteClientArgs"; import { Client } from "../../../models/Client"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Client) export class DeleteClientResolver { @@ -9,6 +9,6 @@ export class DeleteClientResolver { nullable: true }) async deleteClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteClientArgs): Promise { - return ctx.prisma.user.delete(args); + return getPrismaFromContext(ctx).user.delete(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/DeleteManyClientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/DeleteManyClientResolver.ts index 52f1af8b..5f456f47 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/DeleteManyClientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/DeleteManyClientResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeleteManyClientArgs } from "./args/DeleteManyClientArgs"; import { Client } from "../../../models/Client"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Client) export class DeleteManyClientResolver { @@ -10,6 +10,6 @@ export class DeleteManyClientResolver { nullable: false }) async deleteManyClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyClientArgs): Promise { - return ctx.prisma.user.deleteMany(args); + return getPrismaFromContext(ctx).user.deleteMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/FindFirstClientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/FindFirstClientResolver.ts index d6cf2852..7f2be7cd 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/FindFirstClientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/FindFirstClientResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindFirstClientArgs } from "./args/FindFirstClientArgs"; import { Client } from "../../../models/Client"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Client) export class FindFirstClientResolver { @@ -9,6 +9,6 @@ export class FindFirstClientResolver { nullable: true }) async findFirstClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstClientArgs): Promise { - return ctx.prisma.user.findFirst(args); + return getPrismaFromContext(ctx).user.findFirst(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/FindManyClientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/FindManyClientResolver.ts index 5cbf5475..921a2fa2 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/FindManyClientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/FindManyClientResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindManyClientArgs } from "./args/FindManyClientArgs"; import { Client } from "../../../models/Client"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Client) export class FindManyClientResolver { @@ -9,6 +9,6 @@ export class FindManyClientResolver { nullable: false }) async clients(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyClientArgs): Promise { - return ctx.prisma.user.findMany(args); + return getPrismaFromContext(ctx).user.findMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/FindUniqueClientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/FindUniqueClientResolver.ts index 83d4f901..a45c44e5 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/FindUniqueClientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/FindUniqueClientResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindUniqueClientArgs } from "./args/FindUniqueClientArgs"; import { Client } from "../../../models/Client"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Client) export class FindUniqueClientResolver { @@ -9,6 +9,6 @@ export class FindUniqueClientResolver { nullable: true }) async client(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueClientArgs): Promise { - return ctx.prisma.user.findUnique(args); + return getPrismaFromContext(ctx).user.findUnique(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/GroupByClientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/GroupByClientResolver.ts index cf9a6950..59afc721 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/GroupByClientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/GroupByClientResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { GroupByClientArgs } from "./args/GroupByClientArgs"; import { Client } from "../../../models/Client"; import { ClientGroupBy } from "../../outputs/ClientGroupBy"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Client) export class GroupByClientResolver { @@ -15,7 +15,7 @@ export class GroupByClientResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.user.groupBy({ + return getPrismaFromContext(ctx).user.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/UpdateClientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/UpdateClientResolver.ts index cccce5e9..537b303b 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/UpdateClientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/UpdateClientResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdateClientArgs } from "./args/UpdateClientArgs"; import { Client } from "../../../models/Client"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Client) export class UpdateClientResolver { @@ -9,6 +9,6 @@ export class UpdateClientResolver { nullable: true }) async updateClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateClientArgs): Promise { - return ctx.prisma.user.update(args); + return getPrismaFromContext(ctx).user.update(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/UpdateManyClientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/UpdateManyClientResolver.ts index 3ad5c43c..9c33ab6f 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/UpdateManyClientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/UpdateManyClientResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdateManyClientArgs } from "./args/UpdateManyClientArgs"; import { Client } from "../../../models/Client"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Client) export class UpdateManyClientResolver { @@ -10,6 +10,6 @@ export class UpdateManyClientResolver { nullable: false }) async updateManyClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyClientArgs): Promise { - return ctx.prisma.user.updateMany(args); + return getPrismaFromContext(ctx).user.updateMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/UpsertClientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/UpsertClientResolver.ts index 0e03b6ca..e61c7413 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Client/UpsertClientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Client/UpsertClientResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpsertClientArgs } from "./args/UpsertClientArgs"; import { Client } from "../../../models/Client"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Client) export class UpsertClientResolver { @@ -9,6 +9,6 @@ export class UpsertClientResolver { nullable: false }) async upsertClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertClientArgs): Promise { - return ctx.prisma.user.upsert(args); + return getPrismaFromContext(ctx).user.upsert(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/AggregateCreatorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/AggregateCreatorResolver.ts index 0713e879..123a8f29 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/AggregateCreatorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/AggregateCreatorResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { AggregateCreatorArgs } from "./args/AggregateCreatorArgs"; import { Creator } from "../../../models/Creator"; import { AggregateCreator } from "../../outputs/AggregateCreator"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Creator) export class AggregateCreatorResolver { @@ -12,7 +12,7 @@ export class AggregateCreatorResolver { nullable: false }) async aggregateCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateCreatorArgs): Promise { - return ctx.prisma.creator.aggregate({ + return getPrismaFromContext(ctx).creator.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/CreateCreatorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/CreateCreatorResolver.ts index d43b5e7e..bb4a9ccb 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/CreateCreatorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/CreateCreatorResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreateCreatorArgs } from "./args/CreateCreatorArgs"; import { Creator } from "../../../models/Creator"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Creator) export class CreateCreatorResolver { @@ -9,6 +9,6 @@ export class CreateCreatorResolver { nullable: false }) async createCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateCreatorArgs): Promise { - return ctx.prisma.creator.create(args); + return getPrismaFromContext(ctx).creator.create(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/CreateManyCreatorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/CreateManyCreatorResolver.ts index 77c68324..10c75596 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/CreateManyCreatorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/CreateManyCreatorResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreateManyCreatorArgs } from "./args/CreateManyCreatorArgs"; import { Creator } from "../../../models/Creator"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Creator) export class CreateManyCreatorResolver { @@ -10,6 +10,6 @@ export class CreateManyCreatorResolver { nullable: false }) async createManyCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyCreatorArgs): Promise { - return ctx.prisma.creator.createMany(args); + return getPrismaFromContext(ctx).creator.createMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/CreatorCrudResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/CreatorCrudResolver.ts index 32c52ff4..a09650aa 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/CreatorCrudResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/CreatorCrudResolver.ts @@ -13,7 +13,7 @@ import { GroupByCreatorArgs } from "./args/GroupByCreatorArgs"; import { UpdateCreatorArgs } from "./args/UpdateCreatorArgs"; import { UpdateManyCreatorArgs } from "./args/UpdateManyCreatorArgs"; import { UpsertCreatorArgs } from "./args/UpsertCreatorArgs"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; import { Creator } from "../../../models/Creator"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; import { AggregateCreator } from "../../outputs/AggregateCreator"; @@ -25,77 +25,77 @@ export class CreatorCrudResolver { nullable: true }) async creator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueCreatorArgs): Promise { - return ctx.prisma.creator.findUnique(args); + return getPrismaFromContext(ctx).creator.findUnique(args); } @TypeGraphQL.Query(_returns => Creator, { nullable: true }) async findFirstCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstCreatorArgs): Promise { - return ctx.prisma.creator.findFirst(args); + return getPrismaFromContext(ctx).creator.findFirst(args); } @TypeGraphQL.Query(_returns => [Creator], { nullable: false }) async creators(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyCreatorArgs): Promise { - return ctx.prisma.creator.findMany(args); + return getPrismaFromContext(ctx).creator.findMany(args); } @TypeGraphQL.Mutation(_returns => Creator, { nullable: false }) async createCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateCreatorArgs): Promise { - return ctx.prisma.creator.create(args); + return getPrismaFromContext(ctx).creator.create(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async createManyCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyCreatorArgs): Promise { - return ctx.prisma.creator.createMany(args); + return getPrismaFromContext(ctx).creator.createMany(args); } @TypeGraphQL.Mutation(_returns => Creator, { nullable: true }) async deleteCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteCreatorArgs): Promise { - return ctx.prisma.creator.delete(args); + return getPrismaFromContext(ctx).creator.delete(args); } @TypeGraphQL.Mutation(_returns => Creator, { nullable: true }) async updateCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateCreatorArgs): Promise { - return ctx.prisma.creator.update(args); + return getPrismaFromContext(ctx).creator.update(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async deleteManyCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyCreatorArgs): Promise { - return ctx.prisma.creator.deleteMany(args); + return getPrismaFromContext(ctx).creator.deleteMany(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async updateManyCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyCreatorArgs): Promise { - return ctx.prisma.creator.updateMany(args); + return getPrismaFromContext(ctx).creator.updateMany(args); } @TypeGraphQL.Mutation(_returns => Creator, { nullable: false }) async upsertCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertCreatorArgs): Promise { - return ctx.prisma.creator.upsert(args); + return getPrismaFromContext(ctx).creator.upsert(args); } @TypeGraphQL.Query(_returns => AggregateCreator, { nullable: false }) async aggregateCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateCreatorArgs): Promise { - return ctx.prisma.creator.aggregate({ + return getPrismaFromContext(ctx).creator.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); @@ -108,7 +108,7 @@ export class CreatorCrudResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.creator.groupBy({ + return getPrismaFromContext(ctx).creator.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/DeleteCreatorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/DeleteCreatorResolver.ts index ab1d441e..ab1df321 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/DeleteCreatorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/DeleteCreatorResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeleteCreatorArgs } from "./args/DeleteCreatorArgs"; import { Creator } from "../../../models/Creator"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Creator) export class DeleteCreatorResolver { @@ -9,6 +9,6 @@ export class DeleteCreatorResolver { nullable: true }) async deleteCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteCreatorArgs): Promise { - return ctx.prisma.creator.delete(args); + return getPrismaFromContext(ctx).creator.delete(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/DeleteManyCreatorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/DeleteManyCreatorResolver.ts index ee2c3dd7..ab4d19e7 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/DeleteManyCreatorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/DeleteManyCreatorResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeleteManyCreatorArgs } from "./args/DeleteManyCreatorArgs"; import { Creator } from "../../../models/Creator"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Creator) export class DeleteManyCreatorResolver { @@ -10,6 +10,6 @@ export class DeleteManyCreatorResolver { nullable: false }) async deleteManyCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyCreatorArgs): Promise { - return ctx.prisma.creator.deleteMany(args); + return getPrismaFromContext(ctx).creator.deleteMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/FindFirstCreatorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/FindFirstCreatorResolver.ts index b20bd47f..cf5948a6 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/FindFirstCreatorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/FindFirstCreatorResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindFirstCreatorArgs } from "./args/FindFirstCreatorArgs"; import { Creator } from "../../../models/Creator"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Creator) export class FindFirstCreatorResolver { @@ -9,6 +9,6 @@ export class FindFirstCreatorResolver { nullable: true }) async findFirstCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstCreatorArgs): Promise { - return ctx.prisma.creator.findFirst(args); + return getPrismaFromContext(ctx).creator.findFirst(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/FindManyCreatorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/FindManyCreatorResolver.ts index bf18c2dc..491fcd9f 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/FindManyCreatorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/FindManyCreatorResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindManyCreatorArgs } from "./args/FindManyCreatorArgs"; import { Creator } from "../../../models/Creator"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Creator) export class FindManyCreatorResolver { @@ -9,6 +9,6 @@ export class FindManyCreatorResolver { nullable: false }) async creators(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyCreatorArgs): Promise { - return ctx.prisma.creator.findMany(args); + return getPrismaFromContext(ctx).creator.findMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/FindUniqueCreatorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/FindUniqueCreatorResolver.ts index b732b14f..62c17aa6 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/FindUniqueCreatorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/FindUniqueCreatorResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindUniqueCreatorArgs } from "./args/FindUniqueCreatorArgs"; import { Creator } from "../../../models/Creator"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Creator) export class FindUniqueCreatorResolver { @@ -9,6 +9,6 @@ export class FindUniqueCreatorResolver { nullable: true }) async creator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueCreatorArgs): Promise { - return ctx.prisma.creator.findUnique(args); + return getPrismaFromContext(ctx).creator.findUnique(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/GroupByCreatorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/GroupByCreatorResolver.ts index fa5073b7..6f45aa33 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/GroupByCreatorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/GroupByCreatorResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { GroupByCreatorArgs } from "./args/GroupByCreatorArgs"; import { Creator } from "../../../models/Creator"; import { CreatorGroupBy } from "../../outputs/CreatorGroupBy"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Creator) export class GroupByCreatorResolver { @@ -15,7 +15,7 @@ export class GroupByCreatorResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.creator.groupBy({ + return getPrismaFromContext(ctx).creator.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/UpdateCreatorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/UpdateCreatorResolver.ts index a39ffcb0..7e460ae4 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/UpdateCreatorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/UpdateCreatorResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdateCreatorArgs } from "./args/UpdateCreatorArgs"; import { Creator } from "../../../models/Creator"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Creator) export class UpdateCreatorResolver { @@ -9,6 +9,6 @@ export class UpdateCreatorResolver { nullable: true }) async updateCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateCreatorArgs): Promise { - return ctx.prisma.creator.update(args); + return getPrismaFromContext(ctx).creator.update(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/UpdateManyCreatorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/UpdateManyCreatorResolver.ts index d57e9ec1..e3c3c465 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/UpdateManyCreatorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/UpdateManyCreatorResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdateManyCreatorArgs } from "./args/UpdateManyCreatorArgs"; import { Creator } from "../../../models/Creator"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Creator) export class UpdateManyCreatorResolver { @@ -10,6 +10,6 @@ export class UpdateManyCreatorResolver { nullable: false }) async updateManyCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyCreatorArgs): Promise { - return ctx.prisma.creator.updateMany(args); + return getPrismaFromContext(ctx).creator.updateMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/UpsertCreatorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/UpsertCreatorResolver.ts index 691d0a49..8d9d2a87 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/UpsertCreatorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Creator/UpsertCreatorResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpsertCreatorArgs } from "./args/UpsertCreatorArgs"; import { Creator } from "../../../models/Creator"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Creator) export class UpsertCreatorResolver { @@ -9,6 +9,6 @@ export class UpsertCreatorResolver { nullable: false }) async upsertCreator(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertCreatorArgs): Promise { - return ctx.prisma.creator.upsert(args); + return getPrismaFromContext(ctx).creator.upsert(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/AggregateDirectorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/AggregateDirectorResolver.ts index 96962080..11442502 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/AggregateDirectorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/AggregateDirectorResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { AggregateDirectorArgs } from "./args/AggregateDirectorArgs"; import { Director } from "../../../models/Director"; import { AggregateDirector } from "../../outputs/AggregateDirector"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Director) export class AggregateDirectorResolver { @@ -12,7 +12,7 @@ export class AggregateDirectorResolver { nullable: false }) async aggregateDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateDirectorArgs): Promise { - return ctx.prisma.director.aggregate({ + return getPrismaFromContext(ctx).director.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/CreateDirectorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/CreateDirectorResolver.ts index 4970d162..dcdd712b 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/CreateDirectorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/CreateDirectorResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreateDirectorArgs } from "./args/CreateDirectorArgs"; import { Director } from "../../../models/Director"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Director) export class CreateDirectorResolver { @@ -9,6 +9,6 @@ export class CreateDirectorResolver { nullable: false }) async createDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateDirectorArgs): Promise { - return ctx.prisma.director.create(args); + return getPrismaFromContext(ctx).director.create(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/CreateManyDirectorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/CreateManyDirectorResolver.ts index 3f8f41e3..6fc7cbc6 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/CreateManyDirectorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/CreateManyDirectorResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreateManyDirectorArgs } from "./args/CreateManyDirectorArgs"; import { Director } from "../../../models/Director"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Director) export class CreateManyDirectorResolver { @@ -10,6 +10,6 @@ export class CreateManyDirectorResolver { nullable: false }) async createManyDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyDirectorArgs): Promise { - return ctx.prisma.director.createMany(args); + return getPrismaFromContext(ctx).director.createMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/DeleteDirectorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/DeleteDirectorResolver.ts index 728de845..51cd8632 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/DeleteDirectorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/DeleteDirectorResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeleteDirectorArgs } from "./args/DeleteDirectorArgs"; import { Director } from "../../../models/Director"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Director) export class DeleteDirectorResolver { @@ -9,6 +9,6 @@ export class DeleteDirectorResolver { nullable: true }) async deleteDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteDirectorArgs): Promise { - return ctx.prisma.director.delete(args); + return getPrismaFromContext(ctx).director.delete(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/DeleteManyDirectorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/DeleteManyDirectorResolver.ts index 3dcd9b82..8b67189a 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/DeleteManyDirectorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/DeleteManyDirectorResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeleteManyDirectorArgs } from "./args/DeleteManyDirectorArgs"; import { Director } from "../../../models/Director"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Director) export class DeleteManyDirectorResolver { @@ -10,6 +10,6 @@ export class DeleteManyDirectorResolver { nullable: false }) async deleteManyDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyDirectorArgs): Promise { - return ctx.prisma.director.deleteMany(args); + return getPrismaFromContext(ctx).director.deleteMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/DirectorCrudResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/DirectorCrudResolver.ts index 6cf0263c..7af869b4 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/DirectorCrudResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/DirectorCrudResolver.ts @@ -13,7 +13,7 @@ import { GroupByDirectorArgs } from "./args/GroupByDirectorArgs"; import { UpdateDirectorArgs } from "./args/UpdateDirectorArgs"; import { UpdateManyDirectorArgs } from "./args/UpdateManyDirectorArgs"; import { UpsertDirectorArgs } from "./args/UpsertDirectorArgs"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; import { Director } from "../../../models/Director"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; import { AggregateDirector } from "../../outputs/AggregateDirector"; @@ -25,77 +25,77 @@ export class DirectorCrudResolver { nullable: true }) async director(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueDirectorArgs): Promise { - return ctx.prisma.director.findUnique(args); + return getPrismaFromContext(ctx).director.findUnique(args); } @TypeGraphQL.Query(_returns => Director, { nullable: true }) async findFirstDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstDirectorArgs): Promise { - return ctx.prisma.director.findFirst(args); + return getPrismaFromContext(ctx).director.findFirst(args); } @TypeGraphQL.Query(_returns => [Director], { nullable: false }) async directors(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyDirectorArgs): Promise { - return ctx.prisma.director.findMany(args); + return getPrismaFromContext(ctx).director.findMany(args); } @TypeGraphQL.Mutation(_returns => Director, { nullable: false }) async createDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateDirectorArgs): Promise { - return ctx.prisma.director.create(args); + return getPrismaFromContext(ctx).director.create(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async createManyDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyDirectorArgs): Promise { - return ctx.prisma.director.createMany(args); + return getPrismaFromContext(ctx).director.createMany(args); } @TypeGraphQL.Mutation(_returns => Director, { nullable: true }) async deleteDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteDirectorArgs): Promise { - return ctx.prisma.director.delete(args); + return getPrismaFromContext(ctx).director.delete(args); } @TypeGraphQL.Mutation(_returns => Director, { nullable: true }) async updateDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateDirectorArgs): Promise { - return ctx.prisma.director.update(args); + return getPrismaFromContext(ctx).director.update(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async deleteManyDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyDirectorArgs): Promise { - return ctx.prisma.director.deleteMany(args); + return getPrismaFromContext(ctx).director.deleteMany(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async updateManyDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyDirectorArgs): Promise { - return ctx.prisma.director.updateMany(args); + return getPrismaFromContext(ctx).director.updateMany(args); } @TypeGraphQL.Mutation(_returns => Director, { nullable: false }) async upsertDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertDirectorArgs): Promise { - return ctx.prisma.director.upsert(args); + return getPrismaFromContext(ctx).director.upsert(args); } @TypeGraphQL.Query(_returns => AggregateDirector, { nullable: false }) async aggregateDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateDirectorArgs): Promise { - return ctx.prisma.director.aggregate({ + return getPrismaFromContext(ctx).director.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); @@ -108,7 +108,7 @@ export class DirectorCrudResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.director.groupBy({ + return getPrismaFromContext(ctx).director.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/FindFirstDirectorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/FindFirstDirectorResolver.ts index 75bc2a09..5df38ab3 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/FindFirstDirectorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/FindFirstDirectorResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindFirstDirectorArgs } from "./args/FindFirstDirectorArgs"; import { Director } from "../../../models/Director"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Director) export class FindFirstDirectorResolver { @@ -9,6 +9,6 @@ export class FindFirstDirectorResolver { nullable: true }) async findFirstDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstDirectorArgs): Promise { - return ctx.prisma.director.findFirst(args); + return getPrismaFromContext(ctx).director.findFirst(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/FindManyDirectorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/FindManyDirectorResolver.ts index 7c5f32c1..ff9365a4 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/FindManyDirectorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/FindManyDirectorResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindManyDirectorArgs } from "./args/FindManyDirectorArgs"; import { Director } from "../../../models/Director"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Director) export class FindManyDirectorResolver { @@ -9,6 +9,6 @@ export class FindManyDirectorResolver { nullable: false }) async directors(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyDirectorArgs): Promise { - return ctx.prisma.director.findMany(args); + return getPrismaFromContext(ctx).director.findMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/FindUniqueDirectorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/FindUniqueDirectorResolver.ts index 2fb8f868..01aaeb32 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/FindUniqueDirectorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/FindUniqueDirectorResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindUniqueDirectorArgs } from "./args/FindUniqueDirectorArgs"; import { Director } from "../../../models/Director"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Director) export class FindUniqueDirectorResolver { @@ -9,6 +9,6 @@ export class FindUniqueDirectorResolver { nullable: true }) async director(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueDirectorArgs): Promise { - return ctx.prisma.director.findUnique(args); + return getPrismaFromContext(ctx).director.findUnique(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/GroupByDirectorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/GroupByDirectorResolver.ts index c3ebd438..31176859 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/GroupByDirectorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/GroupByDirectorResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { GroupByDirectorArgs } from "./args/GroupByDirectorArgs"; import { Director } from "../../../models/Director"; import { DirectorGroupBy } from "../../outputs/DirectorGroupBy"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Director) export class GroupByDirectorResolver { @@ -15,7 +15,7 @@ export class GroupByDirectorResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.director.groupBy({ + return getPrismaFromContext(ctx).director.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/UpdateDirectorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/UpdateDirectorResolver.ts index 6627d793..444ad60d 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/UpdateDirectorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/UpdateDirectorResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdateDirectorArgs } from "./args/UpdateDirectorArgs"; import { Director } from "../../../models/Director"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Director) export class UpdateDirectorResolver { @@ -9,6 +9,6 @@ export class UpdateDirectorResolver { nullable: true }) async updateDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateDirectorArgs): Promise { - return ctx.prisma.director.update(args); + return getPrismaFromContext(ctx).director.update(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/UpdateManyDirectorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/UpdateManyDirectorResolver.ts index 65c14804..698eda43 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/UpdateManyDirectorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/UpdateManyDirectorResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdateManyDirectorArgs } from "./args/UpdateManyDirectorArgs"; import { Director } from "../../../models/Director"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Director) export class UpdateManyDirectorResolver { @@ -10,6 +10,6 @@ export class UpdateManyDirectorResolver { nullable: false }) async updateManyDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyDirectorArgs): Promise { - return ctx.prisma.director.updateMany(args); + return getPrismaFromContext(ctx).director.updateMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/UpsertDirectorResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/UpsertDirectorResolver.ts index 17867691..1d07d434 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Director/UpsertDirectorResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Director/UpsertDirectorResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpsertDirectorArgs } from "./args/UpsertDirectorArgs"; import { Director } from "../../../models/Director"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Director) export class UpsertDirectorResolver { @@ -9,6 +9,6 @@ export class UpsertDirectorResolver { nullable: false }) async upsertDirector(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertDirectorArgs): Promise { - return ctx.prisma.director.upsert(args); + return getPrismaFromContext(ctx).director.upsert(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/AggregateMovieResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/AggregateMovieResolver.ts index 11407574..5f686672 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/AggregateMovieResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/AggregateMovieResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { AggregateMovieArgs } from "./args/AggregateMovieArgs"; import { Movie } from "../../../models/Movie"; import { AggregateMovie } from "../../outputs/AggregateMovie"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Movie) export class AggregateMovieResolver { @@ -12,7 +12,7 @@ export class AggregateMovieResolver { nullable: false }) async aggregateMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateMovieArgs): Promise { - return ctx.prisma.movie.aggregate({ + return getPrismaFromContext(ctx).movie.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/CreateManyMovieResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/CreateManyMovieResolver.ts index 9f2989ee..f652788a 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/CreateManyMovieResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/CreateManyMovieResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreateManyMovieArgs } from "./args/CreateManyMovieArgs"; import { Movie } from "../../../models/Movie"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Movie) export class CreateManyMovieResolver { @@ -10,6 +10,6 @@ export class CreateManyMovieResolver { nullable: false }) async createManyMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyMovieArgs): Promise { - return ctx.prisma.movie.createMany(args); + return getPrismaFromContext(ctx).movie.createMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/CreateMovieResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/CreateMovieResolver.ts index 7613b700..07f56ec9 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/CreateMovieResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/CreateMovieResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreateMovieArgs } from "./args/CreateMovieArgs"; import { Movie } from "../../../models/Movie"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Movie) export class CreateMovieResolver { @@ -9,6 +9,6 @@ export class CreateMovieResolver { nullable: false }) async createMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateMovieArgs): Promise { - return ctx.prisma.movie.create(args); + return getPrismaFromContext(ctx).movie.create(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/DeleteManyMovieResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/DeleteManyMovieResolver.ts index 60c37162..bfd6b8ed 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/DeleteManyMovieResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/DeleteManyMovieResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeleteManyMovieArgs } from "./args/DeleteManyMovieArgs"; import { Movie } from "../../../models/Movie"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Movie) export class DeleteManyMovieResolver { @@ -10,6 +10,6 @@ export class DeleteManyMovieResolver { nullable: false }) async deleteManyMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyMovieArgs): Promise { - return ctx.prisma.movie.deleteMany(args); + return getPrismaFromContext(ctx).movie.deleteMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/DeleteMovieResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/DeleteMovieResolver.ts index f99d1164..6e393f76 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/DeleteMovieResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/DeleteMovieResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeleteMovieArgs } from "./args/DeleteMovieArgs"; import { Movie } from "../../../models/Movie"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Movie) export class DeleteMovieResolver { @@ -9,6 +9,6 @@ export class DeleteMovieResolver { nullable: true }) async deleteMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteMovieArgs): Promise { - return ctx.prisma.movie.delete(args); + return getPrismaFromContext(ctx).movie.delete(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/FindFirstMovieResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/FindFirstMovieResolver.ts index da583aca..9c47a893 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/FindFirstMovieResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/FindFirstMovieResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindFirstMovieArgs } from "./args/FindFirstMovieArgs"; import { Movie } from "../../../models/Movie"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Movie) export class FindFirstMovieResolver { @@ -9,6 +9,6 @@ export class FindFirstMovieResolver { nullable: true }) async findFirstMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstMovieArgs): Promise { - return ctx.prisma.movie.findFirst(args); + return getPrismaFromContext(ctx).movie.findFirst(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/FindManyMovieResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/FindManyMovieResolver.ts index 080d6293..d3a277bc 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/FindManyMovieResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/FindManyMovieResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindManyMovieArgs } from "./args/FindManyMovieArgs"; import { Movie } from "../../../models/Movie"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Movie) export class FindManyMovieResolver { @@ -9,6 +9,6 @@ export class FindManyMovieResolver { nullable: false }) async movies(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyMovieArgs): Promise { - return ctx.prisma.movie.findMany(args); + return getPrismaFromContext(ctx).movie.findMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/FindUniqueMovieResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/FindUniqueMovieResolver.ts index 5164ffcc..ac262cf2 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/FindUniqueMovieResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/FindUniqueMovieResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindUniqueMovieArgs } from "./args/FindUniqueMovieArgs"; import { Movie } from "../../../models/Movie"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Movie) export class FindUniqueMovieResolver { @@ -9,6 +9,6 @@ export class FindUniqueMovieResolver { nullable: true }) async movie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueMovieArgs): Promise { - return ctx.prisma.movie.findUnique(args); + return getPrismaFromContext(ctx).movie.findUnique(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/GroupByMovieResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/GroupByMovieResolver.ts index 0912e585..95a2755a 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/GroupByMovieResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/GroupByMovieResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { GroupByMovieArgs } from "./args/GroupByMovieArgs"; import { Movie } from "../../../models/Movie"; import { MovieGroupBy } from "../../outputs/MovieGroupBy"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Movie) export class GroupByMovieResolver { @@ -15,7 +15,7 @@ export class GroupByMovieResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.movie.groupBy({ + return getPrismaFromContext(ctx).movie.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/MovieCrudResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/MovieCrudResolver.ts index 0452e0be..ffd694ff 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/MovieCrudResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/MovieCrudResolver.ts @@ -13,7 +13,7 @@ import { GroupByMovieArgs } from "./args/GroupByMovieArgs"; import { UpdateManyMovieArgs } from "./args/UpdateManyMovieArgs"; import { UpdateMovieArgs } from "./args/UpdateMovieArgs"; import { UpsertMovieArgs } from "./args/UpsertMovieArgs"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; import { Movie } from "../../../models/Movie"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; import { AggregateMovie } from "../../outputs/AggregateMovie"; @@ -25,77 +25,77 @@ export class MovieCrudResolver { nullable: true }) async movie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueMovieArgs): Promise { - return ctx.prisma.movie.findUnique(args); + return getPrismaFromContext(ctx).movie.findUnique(args); } @TypeGraphQL.Query(_returns => Movie, { nullable: true }) async findFirstMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstMovieArgs): Promise { - return ctx.prisma.movie.findFirst(args); + return getPrismaFromContext(ctx).movie.findFirst(args); } @TypeGraphQL.Query(_returns => [Movie], { nullable: false }) async movies(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyMovieArgs): Promise { - return ctx.prisma.movie.findMany(args); + return getPrismaFromContext(ctx).movie.findMany(args); } @TypeGraphQL.Mutation(_returns => Movie, { nullable: false }) async createMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateMovieArgs): Promise { - return ctx.prisma.movie.create(args); + return getPrismaFromContext(ctx).movie.create(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async createManyMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyMovieArgs): Promise { - return ctx.prisma.movie.createMany(args); + return getPrismaFromContext(ctx).movie.createMany(args); } @TypeGraphQL.Mutation(_returns => Movie, { nullable: true }) async deleteMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteMovieArgs): Promise { - return ctx.prisma.movie.delete(args); + return getPrismaFromContext(ctx).movie.delete(args); } @TypeGraphQL.Mutation(_returns => Movie, { nullable: true }) async updateMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateMovieArgs): Promise { - return ctx.prisma.movie.update(args); + return getPrismaFromContext(ctx).movie.update(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async deleteManyMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyMovieArgs): Promise { - return ctx.prisma.movie.deleteMany(args); + return getPrismaFromContext(ctx).movie.deleteMany(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async updateManyMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyMovieArgs): Promise { - return ctx.prisma.movie.updateMany(args); + return getPrismaFromContext(ctx).movie.updateMany(args); } @TypeGraphQL.Mutation(_returns => Movie, { nullable: false }) async upsertMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertMovieArgs): Promise { - return ctx.prisma.movie.upsert(args); + return getPrismaFromContext(ctx).movie.upsert(args); } @TypeGraphQL.Query(_returns => AggregateMovie, { nullable: false }) async aggregateMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateMovieArgs): Promise { - return ctx.prisma.movie.aggregate({ + return getPrismaFromContext(ctx).movie.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); @@ -108,7 +108,7 @@ export class MovieCrudResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.movie.groupBy({ + return getPrismaFromContext(ctx).movie.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/UpdateManyMovieResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/UpdateManyMovieResolver.ts index d985bd4d..bb4f40d0 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/UpdateManyMovieResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/UpdateManyMovieResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdateManyMovieArgs } from "./args/UpdateManyMovieArgs"; import { Movie } from "../../../models/Movie"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Movie) export class UpdateManyMovieResolver { @@ -10,6 +10,6 @@ export class UpdateManyMovieResolver { nullable: false }) async updateManyMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyMovieArgs): Promise { - return ctx.prisma.movie.updateMany(args); + return getPrismaFromContext(ctx).movie.updateMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/UpdateMovieResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/UpdateMovieResolver.ts index 10961d84..0f3da137 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/UpdateMovieResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/UpdateMovieResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdateMovieArgs } from "./args/UpdateMovieArgs"; import { Movie } from "../../../models/Movie"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Movie) export class UpdateMovieResolver { @@ -9,6 +9,6 @@ export class UpdateMovieResolver { nullable: true }) async updateMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateMovieArgs): Promise { - return ctx.prisma.movie.update(args); + return getPrismaFromContext(ctx).movie.update(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/UpsertMovieResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/UpsertMovieResolver.ts index 0e2661ea..db044305 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/UpsertMovieResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Movie/UpsertMovieResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpsertMovieArgs } from "./args/UpsertMovieArgs"; import { Movie } from "../../../models/Movie"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Movie) export class UpsertMovieResolver { @@ -9,6 +9,6 @@ export class UpsertMovieResolver { nullable: false }) async upsertMovie(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertMovieArgs): Promise { - return ctx.prisma.movie.upsert(args); + return getPrismaFromContext(ctx).movie.upsert(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/AggregateNativeTypeModelResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/AggregateNativeTypeModelResolver.ts index af3a5adc..5620cdef 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/AggregateNativeTypeModelResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/AggregateNativeTypeModelResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { AggregateNativeTypeModelArgs } from "./args/AggregateNativeTypeModelArgs"; import { NativeTypeModel } from "../../../models/NativeTypeModel"; import { AggregateNativeTypeModel } from "../../outputs/AggregateNativeTypeModel"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => NativeTypeModel) export class AggregateNativeTypeModelResolver { @@ -12,7 +12,7 @@ export class AggregateNativeTypeModelResolver { nullable: false }) async aggregateNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.aggregate({ + return getPrismaFromContext(ctx).nativeTypeModel.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/CreateManyNativeTypeModelResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/CreateManyNativeTypeModelResolver.ts index deeabfd4..15f1b509 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/CreateManyNativeTypeModelResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/CreateManyNativeTypeModelResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreateManyNativeTypeModelArgs } from "./args/CreateManyNativeTypeModelArgs"; import { NativeTypeModel } from "../../../models/NativeTypeModel"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => NativeTypeModel) export class CreateManyNativeTypeModelResolver { @@ -10,6 +10,6 @@ export class CreateManyNativeTypeModelResolver { nullable: false }) async createManyNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.createMany(args); + return getPrismaFromContext(ctx).nativeTypeModel.createMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/CreateNativeTypeModelResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/CreateNativeTypeModelResolver.ts index 3d57d814..31661c53 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/CreateNativeTypeModelResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/CreateNativeTypeModelResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreateNativeTypeModelArgs } from "./args/CreateNativeTypeModelArgs"; import { NativeTypeModel } from "../../../models/NativeTypeModel"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => NativeTypeModel) export class CreateNativeTypeModelResolver { @@ -9,6 +9,6 @@ export class CreateNativeTypeModelResolver { nullable: false }) async createNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.create(args); + return getPrismaFromContext(ctx).nativeTypeModel.create(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/DeleteManyNativeTypeModelResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/DeleteManyNativeTypeModelResolver.ts index c2dec7d1..2b1caff5 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/DeleteManyNativeTypeModelResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/DeleteManyNativeTypeModelResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeleteManyNativeTypeModelArgs } from "./args/DeleteManyNativeTypeModelArgs"; import { NativeTypeModel } from "../../../models/NativeTypeModel"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => NativeTypeModel) export class DeleteManyNativeTypeModelResolver { @@ -10,6 +10,6 @@ export class DeleteManyNativeTypeModelResolver { nullable: false }) async deleteManyNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.deleteMany(args); + return getPrismaFromContext(ctx).nativeTypeModel.deleteMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/DeleteNativeTypeModelResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/DeleteNativeTypeModelResolver.ts index 957cdea4..17de17d0 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/DeleteNativeTypeModelResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/DeleteNativeTypeModelResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeleteNativeTypeModelArgs } from "./args/DeleteNativeTypeModelArgs"; import { NativeTypeModel } from "../../../models/NativeTypeModel"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => NativeTypeModel) export class DeleteNativeTypeModelResolver { @@ -9,6 +9,6 @@ export class DeleteNativeTypeModelResolver { nullable: true }) async deleteNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.delete(args); + return getPrismaFromContext(ctx).nativeTypeModel.delete(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/FindFirstNativeTypeModelResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/FindFirstNativeTypeModelResolver.ts index 9cb230dd..ec6170e7 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/FindFirstNativeTypeModelResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/FindFirstNativeTypeModelResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindFirstNativeTypeModelArgs } from "./args/FindFirstNativeTypeModelArgs"; import { NativeTypeModel } from "../../../models/NativeTypeModel"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => NativeTypeModel) export class FindFirstNativeTypeModelResolver { @@ -9,6 +9,6 @@ export class FindFirstNativeTypeModelResolver { nullable: true }) async findFirstNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.findFirst(args); + return getPrismaFromContext(ctx).nativeTypeModel.findFirst(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/FindManyNativeTypeModelResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/FindManyNativeTypeModelResolver.ts index 91202f82..25f15362 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/FindManyNativeTypeModelResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/FindManyNativeTypeModelResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindManyNativeTypeModelArgs } from "./args/FindManyNativeTypeModelArgs"; import { NativeTypeModel } from "../../../models/NativeTypeModel"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => NativeTypeModel) export class FindManyNativeTypeModelResolver { @@ -9,6 +9,6 @@ export class FindManyNativeTypeModelResolver { nullable: false }) async nativeTypeModels(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.findMany(args); + return getPrismaFromContext(ctx).nativeTypeModel.findMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/FindUniqueNativeTypeModelResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/FindUniqueNativeTypeModelResolver.ts index 7030889a..c68d2e2b 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/FindUniqueNativeTypeModelResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/FindUniqueNativeTypeModelResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindUniqueNativeTypeModelArgs } from "./args/FindUniqueNativeTypeModelArgs"; import { NativeTypeModel } from "../../../models/NativeTypeModel"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => NativeTypeModel) export class FindUniqueNativeTypeModelResolver { @@ -9,6 +9,6 @@ export class FindUniqueNativeTypeModelResolver { nullable: true }) async nativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.findUnique(args); + return getPrismaFromContext(ctx).nativeTypeModel.findUnique(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/GroupByNativeTypeModelResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/GroupByNativeTypeModelResolver.ts index c3975ac9..86c95140 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/GroupByNativeTypeModelResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/GroupByNativeTypeModelResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { GroupByNativeTypeModelArgs } from "./args/GroupByNativeTypeModelArgs"; import { NativeTypeModel } from "../../../models/NativeTypeModel"; import { NativeTypeModelGroupBy } from "../../outputs/NativeTypeModelGroupBy"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => NativeTypeModel) export class GroupByNativeTypeModelResolver { @@ -15,7 +15,7 @@ export class GroupByNativeTypeModelResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.nativeTypeModel.groupBy({ + return getPrismaFromContext(ctx).nativeTypeModel.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/NativeTypeModelCrudResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/NativeTypeModelCrudResolver.ts index e96da5e7..658e88df 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/NativeTypeModelCrudResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/NativeTypeModelCrudResolver.ts @@ -13,7 +13,7 @@ import { GroupByNativeTypeModelArgs } from "./args/GroupByNativeTypeModelArgs"; import { UpdateManyNativeTypeModelArgs } from "./args/UpdateManyNativeTypeModelArgs"; import { UpdateNativeTypeModelArgs } from "./args/UpdateNativeTypeModelArgs"; import { UpsertNativeTypeModelArgs } from "./args/UpsertNativeTypeModelArgs"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; import { NativeTypeModel } from "../../../models/NativeTypeModel"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; import { AggregateNativeTypeModel } from "../../outputs/AggregateNativeTypeModel"; @@ -25,77 +25,77 @@ export class NativeTypeModelCrudResolver { nullable: true }) async nativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.findUnique(args); + return getPrismaFromContext(ctx).nativeTypeModel.findUnique(args); } @TypeGraphQL.Query(_returns => NativeTypeModel, { nullable: true }) async findFirstNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.findFirst(args); + return getPrismaFromContext(ctx).nativeTypeModel.findFirst(args); } @TypeGraphQL.Query(_returns => [NativeTypeModel], { nullable: false }) async nativeTypeModels(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.findMany(args); + return getPrismaFromContext(ctx).nativeTypeModel.findMany(args); } @TypeGraphQL.Mutation(_returns => NativeTypeModel, { nullable: false }) async createNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.create(args); + return getPrismaFromContext(ctx).nativeTypeModel.create(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async createManyNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.createMany(args); + return getPrismaFromContext(ctx).nativeTypeModel.createMany(args); } @TypeGraphQL.Mutation(_returns => NativeTypeModel, { nullable: true }) async deleteNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.delete(args); + return getPrismaFromContext(ctx).nativeTypeModel.delete(args); } @TypeGraphQL.Mutation(_returns => NativeTypeModel, { nullable: true }) async updateNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.update(args); + return getPrismaFromContext(ctx).nativeTypeModel.update(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async deleteManyNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.deleteMany(args); + return getPrismaFromContext(ctx).nativeTypeModel.deleteMany(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async updateManyNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.updateMany(args); + return getPrismaFromContext(ctx).nativeTypeModel.updateMany(args); } @TypeGraphQL.Mutation(_returns => NativeTypeModel, { nullable: false }) async upsertNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.upsert(args); + return getPrismaFromContext(ctx).nativeTypeModel.upsert(args); } @TypeGraphQL.Query(_returns => AggregateNativeTypeModel, { nullable: false }) async aggregateNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.aggregate({ + return getPrismaFromContext(ctx).nativeTypeModel.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); @@ -108,7 +108,7 @@ export class NativeTypeModelCrudResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.nativeTypeModel.groupBy({ + return getPrismaFromContext(ctx).nativeTypeModel.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/UpdateManyNativeTypeModelResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/UpdateManyNativeTypeModelResolver.ts index 073c6927..fd0862d3 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/UpdateManyNativeTypeModelResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/UpdateManyNativeTypeModelResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdateManyNativeTypeModelArgs } from "./args/UpdateManyNativeTypeModelArgs"; import { NativeTypeModel } from "../../../models/NativeTypeModel"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => NativeTypeModel) export class UpdateManyNativeTypeModelResolver { @@ -10,6 +10,6 @@ export class UpdateManyNativeTypeModelResolver { nullable: false }) async updateManyNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.updateMany(args); + return getPrismaFromContext(ctx).nativeTypeModel.updateMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/UpdateNativeTypeModelResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/UpdateNativeTypeModelResolver.ts index c4b78568..01d0bb26 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/UpdateNativeTypeModelResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/UpdateNativeTypeModelResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdateNativeTypeModelArgs } from "./args/UpdateNativeTypeModelArgs"; import { NativeTypeModel } from "../../../models/NativeTypeModel"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => NativeTypeModel) export class UpdateNativeTypeModelResolver { @@ -9,6 +9,6 @@ export class UpdateNativeTypeModelResolver { nullable: true }) async updateNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.update(args); + return getPrismaFromContext(ctx).nativeTypeModel.update(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/UpsertNativeTypeModelResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/UpsertNativeTypeModelResolver.ts index c509f2e5..1e9936c9 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/UpsertNativeTypeModelResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/NativeTypeModel/UpsertNativeTypeModelResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpsertNativeTypeModelArgs } from "./args/UpsertNativeTypeModelArgs"; import { NativeTypeModel } from "../../../models/NativeTypeModel"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => NativeTypeModel) export class UpsertNativeTypeModelResolver { @@ -9,6 +9,6 @@ export class UpsertNativeTypeModelResolver { nullable: false }) async upsertNativeTypeModel(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertNativeTypeModelArgs): Promise { - return ctx.prisma.nativeTypeModel.upsert(args); + return getPrismaFromContext(ctx).nativeTypeModel.upsert(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/AggregatePatientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/AggregatePatientResolver.ts index 476844c5..8f9241d8 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/AggregatePatientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/AggregatePatientResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { AggregatePatientArgs } from "./args/AggregatePatientArgs"; import { Patient } from "../../../models/Patient"; import { AggregatePatient } from "../../outputs/AggregatePatient"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Patient) export class AggregatePatientResolver { @@ -12,7 +12,7 @@ export class AggregatePatientResolver { nullable: false }) async aggregatePatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregatePatientArgs): Promise { - return ctx.prisma.patient.aggregate({ + return getPrismaFromContext(ctx).patient.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/CreateManyPatientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/CreateManyPatientResolver.ts index dc9eaa0b..cc9e2776 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/CreateManyPatientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/CreateManyPatientResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreateManyPatientArgs } from "./args/CreateManyPatientArgs"; import { Patient } from "../../../models/Patient"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Patient) export class CreateManyPatientResolver { @@ -10,6 +10,6 @@ export class CreateManyPatientResolver { nullable: false }) async createManyPatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyPatientArgs): Promise { - return ctx.prisma.patient.createMany(args); + return getPrismaFromContext(ctx).patient.createMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/CreatePatientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/CreatePatientResolver.ts index b43a3c97..9f56cf75 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/CreatePatientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/CreatePatientResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreatePatientArgs } from "./args/CreatePatientArgs"; import { Patient } from "../../../models/Patient"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Patient) export class CreatePatientResolver { @@ -9,6 +9,6 @@ export class CreatePatientResolver { nullable: false }) async createPatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreatePatientArgs): Promise { - return ctx.prisma.patient.create(args); + return getPrismaFromContext(ctx).patient.create(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/DeleteManyPatientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/DeleteManyPatientResolver.ts index ca6fb07e..2ccb4623 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/DeleteManyPatientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/DeleteManyPatientResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeleteManyPatientArgs } from "./args/DeleteManyPatientArgs"; import { Patient } from "../../../models/Patient"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Patient) export class DeleteManyPatientResolver { @@ -10,6 +10,6 @@ export class DeleteManyPatientResolver { nullable: false }) async deleteManyPatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyPatientArgs): Promise { - return ctx.prisma.patient.deleteMany(args); + return getPrismaFromContext(ctx).patient.deleteMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/DeletePatientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/DeletePatientResolver.ts index 7b9da795..71d10158 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/DeletePatientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/DeletePatientResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeletePatientArgs } from "./args/DeletePatientArgs"; import { Patient } from "../../../models/Patient"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Patient) export class DeletePatientResolver { @@ -9,6 +9,6 @@ export class DeletePatientResolver { nullable: true }) async deletePatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeletePatientArgs): Promise { - return ctx.prisma.patient.delete(args); + return getPrismaFromContext(ctx).patient.delete(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/FindFirstPatientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/FindFirstPatientResolver.ts index 029155e5..ce537686 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/FindFirstPatientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/FindFirstPatientResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindFirstPatientArgs } from "./args/FindFirstPatientArgs"; import { Patient } from "../../../models/Patient"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Patient) export class FindFirstPatientResolver { @@ -9,6 +9,6 @@ export class FindFirstPatientResolver { nullable: true }) async findFirstPatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstPatientArgs): Promise { - return ctx.prisma.patient.findFirst(args); + return getPrismaFromContext(ctx).patient.findFirst(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/FindManyPatientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/FindManyPatientResolver.ts index 480a1fbd..bbd9f77d 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/FindManyPatientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/FindManyPatientResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindManyPatientArgs } from "./args/FindManyPatientArgs"; import { Patient } from "../../../models/Patient"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Patient) export class FindManyPatientResolver { @@ -9,6 +9,6 @@ export class FindManyPatientResolver { nullable: false }) async patients(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyPatientArgs): Promise { - return ctx.prisma.patient.findMany(args); + return getPrismaFromContext(ctx).patient.findMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/FindUniquePatientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/FindUniquePatientResolver.ts index 437268a0..4d541594 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/FindUniquePatientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/FindUniquePatientResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindUniquePatientArgs } from "./args/FindUniquePatientArgs"; import { Patient } from "../../../models/Patient"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Patient) export class FindUniquePatientResolver { @@ -9,6 +9,6 @@ export class FindUniquePatientResolver { nullable: true }) async patient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniquePatientArgs): Promise { - return ctx.prisma.patient.findUnique(args); + return getPrismaFromContext(ctx).patient.findUnique(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/GroupByPatientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/GroupByPatientResolver.ts index 7159e3c7..880b4d04 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/GroupByPatientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/GroupByPatientResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { GroupByPatientArgs } from "./args/GroupByPatientArgs"; import { Patient } from "../../../models/Patient"; import { PatientGroupBy } from "../../outputs/PatientGroupBy"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Patient) export class GroupByPatientResolver { @@ -15,7 +15,7 @@ export class GroupByPatientResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.patient.groupBy({ + return getPrismaFromContext(ctx).patient.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/PatientCrudResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/PatientCrudResolver.ts index 774f62c8..b1aec58c 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/PatientCrudResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/PatientCrudResolver.ts @@ -13,7 +13,7 @@ import { GroupByPatientArgs } from "./args/GroupByPatientArgs"; import { UpdateManyPatientArgs } from "./args/UpdateManyPatientArgs"; import { UpdatePatientArgs } from "./args/UpdatePatientArgs"; import { UpsertPatientArgs } from "./args/UpsertPatientArgs"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; import { Patient } from "../../../models/Patient"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; import { AggregatePatient } from "../../outputs/AggregatePatient"; @@ -25,77 +25,77 @@ export class PatientCrudResolver { nullable: true }) async patient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniquePatientArgs): Promise { - return ctx.prisma.patient.findUnique(args); + return getPrismaFromContext(ctx).patient.findUnique(args); } @TypeGraphQL.Query(_returns => Patient, { nullable: true }) async findFirstPatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstPatientArgs): Promise { - return ctx.prisma.patient.findFirst(args); + return getPrismaFromContext(ctx).patient.findFirst(args); } @TypeGraphQL.Query(_returns => [Patient], { nullable: false }) async patients(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyPatientArgs): Promise { - return ctx.prisma.patient.findMany(args); + return getPrismaFromContext(ctx).patient.findMany(args); } @TypeGraphQL.Mutation(_returns => Patient, { nullable: false }) async createPatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreatePatientArgs): Promise { - return ctx.prisma.patient.create(args); + return getPrismaFromContext(ctx).patient.create(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async createManyPatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyPatientArgs): Promise { - return ctx.prisma.patient.createMany(args); + return getPrismaFromContext(ctx).patient.createMany(args); } @TypeGraphQL.Mutation(_returns => Patient, { nullable: true }) async deletePatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeletePatientArgs): Promise { - return ctx.prisma.patient.delete(args); + return getPrismaFromContext(ctx).patient.delete(args); } @TypeGraphQL.Mutation(_returns => Patient, { nullable: true }) async updatePatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdatePatientArgs): Promise { - return ctx.prisma.patient.update(args); + return getPrismaFromContext(ctx).patient.update(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async deleteManyPatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyPatientArgs): Promise { - return ctx.prisma.patient.deleteMany(args); + return getPrismaFromContext(ctx).patient.deleteMany(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async updateManyPatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyPatientArgs): Promise { - return ctx.prisma.patient.updateMany(args); + return getPrismaFromContext(ctx).patient.updateMany(args); } @TypeGraphQL.Mutation(_returns => Patient, { nullable: false }) async upsertPatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertPatientArgs): Promise { - return ctx.prisma.patient.upsert(args); + return getPrismaFromContext(ctx).patient.upsert(args); } @TypeGraphQL.Query(_returns => AggregatePatient, { nullable: false }) async aggregatePatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregatePatientArgs): Promise { - return ctx.prisma.patient.aggregate({ + return getPrismaFromContext(ctx).patient.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); @@ -108,7 +108,7 @@ export class PatientCrudResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.patient.groupBy({ + return getPrismaFromContext(ctx).patient.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/UpdateManyPatientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/UpdateManyPatientResolver.ts index 2ae073d2..fe95937d 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/UpdateManyPatientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/UpdateManyPatientResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdateManyPatientArgs } from "./args/UpdateManyPatientArgs"; import { Patient } from "../../../models/Patient"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Patient) export class UpdateManyPatientResolver { @@ -10,6 +10,6 @@ export class UpdateManyPatientResolver { nullable: false }) async updateManyPatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyPatientArgs): Promise { - return ctx.prisma.patient.updateMany(args); + return getPrismaFromContext(ctx).patient.updateMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/UpdatePatientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/UpdatePatientResolver.ts index 39b37122..0a0c5e76 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/UpdatePatientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/UpdatePatientResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdatePatientArgs } from "./args/UpdatePatientArgs"; import { Patient } from "../../../models/Patient"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Patient) export class UpdatePatientResolver { @@ -9,6 +9,6 @@ export class UpdatePatientResolver { nullable: true }) async updatePatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdatePatientArgs): Promise { - return ctx.prisma.patient.update(args); + return getPrismaFromContext(ctx).patient.update(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/UpsertPatientResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/UpsertPatientResolver.ts index acb6e641..76714aee 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/UpsertPatientResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Patient/UpsertPatientResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpsertPatientArgs } from "./args/UpsertPatientArgs"; import { Patient } from "../../../models/Patient"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Patient) export class UpsertPatientResolver { @@ -9,6 +9,6 @@ export class UpsertPatientResolver { nullable: false }) async upsertPatient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertPatientArgs): Promise { - return ctx.prisma.patient.upsert(args); + return getPrismaFromContext(ctx).patient.upsert(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/AggregatePostResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/AggregatePostResolver.ts index e60eb15d..5a0f37bf 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/AggregatePostResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/AggregatePostResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { AggregatePostArgs } from "./args/AggregatePostArgs"; import { Post } from "../../../models/Post"; import { AggregatePost } from "../../outputs/AggregatePost"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Post) export class AggregatePostResolver { @@ -12,7 +12,7 @@ export class AggregatePostResolver { nullable: false }) async aggregatePost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregatePostArgs): Promise { - return ctx.prisma.post.aggregate({ + return getPrismaFromContext(ctx).post.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/CreateManyPostResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/CreateManyPostResolver.ts index 30b65879..ef495ae5 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/CreateManyPostResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/CreateManyPostResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreateManyPostArgs } from "./args/CreateManyPostArgs"; import { Post } from "../../../models/Post"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Post) export class CreateManyPostResolver { @@ -10,6 +10,6 @@ export class CreateManyPostResolver { nullable: false }) async createManyPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyPostArgs): Promise { - return ctx.prisma.post.createMany(args); + return getPrismaFromContext(ctx).post.createMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/CreatePostResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/CreatePostResolver.ts index 9eab1626..746a1723 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/CreatePostResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/CreatePostResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreatePostArgs } from "./args/CreatePostArgs"; import { Post } from "../../../models/Post"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Post) export class CreatePostResolver { @@ -9,6 +9,6 @@ export class CreatePostResolver { nullable: false }) async createPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreatePostArgs): Promise { - return ctx.prisma.post.create(args); + return getPrismaFromContext(ctx).post.create(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/DeleteManyPostResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/DeleteManyPostResolver.ts index 7e77ae84..f22d3cba 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/DeleteManyPostResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/DeleteManyPostResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeleteManyPostArgs } from "./args/DeleteManyPostArgs"; import { Post } from "../../../models/Post"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Post) export class DeleteManyPostResolver { @@ -10,6 +10,6 @@ export class DeleteManyPostResolver { nullable: false }) async deleteManyPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyPostArgs): Promise { - return ctx.prisma.post.deleteMany(args); + return getPrismaFromContext(ctx).post.deleteMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/DeletePostResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/DeletePostResolver.ts index ac20b023..be0e7c59 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/DeletePostResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/DeletePostResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeletePostArgs } from "./args/DeletePostArgs"; import { Post } from "../../../models/Post"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Post) export class DeletePostResolver { @@ -9,6 +9,6 @@ export class DeletePostResolver { nullable: true }) async deletePost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeletePostArgs): Promise { - return ctx.prisma.post.delete(args); + return getPrismaFromContext(ctx).post.delete(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/FindFirstPostResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/FindFirstPostResolver.ts index 8b04cf9a..e1721a17 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/FindFirstPostResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/FindFirstPostResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindFirstPostArgs } from "./args/FindFirstPostArgs"; import { Post } from "../../../models/Post"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Post) export class FindFirstPostResolver { @@ -9,6 +9,6 @@ export class FindFirstPostResolver { nullable: true }) async findFirstPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstPostArgs): Promise { - return ctx.prisma.post.findFirst(args); + return getPrismaFromContext(ctx).post.findFirst(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/FindManyPostResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/FindManyPostResolver.ts index 82b130ac..98165f61 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/FindManyPostResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/FindManyPostResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindManyPostArgs } from "./args/FindManyPostArgs"; import { Post } from "../../../models/Post"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Post) export class FindManyPostResolver { @@ -9,6 +9,6 @@ export class FindManyPostResolver { nullable: false }) async posts(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyPostArgs): Promise { - return ctx.prisma.post.findMany(args); + return getPrismaFromContext(ctx).post.findMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/FindUniquePostResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/FindUniquePostResolver.ts index 125a747b..6f285da1 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/FindUniquePostResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/FindUniquePostResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindUniquePostArgs } from "./args/FindUniquePostArgs"; import { Post } from "../../../models/Post"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Post) export class FindUniquePostResolver { @@ -9,6 +9,6 @@ export class FindUniquePostResolver { nullable: true }) async post(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniquePostArgs): Promise { - return ctx.prisma.post.findUnique(args); + return getPrismaFromContext(ctx).post.findUnique(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/GroupByPostResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/GroupByPostResolver.ts index 6b5a78f4..014d0463 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/GroupByPostResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/GroupByPostResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { GroupByPostArgs } from "./args/GroupByPostArgs"; import { Post } from "../../../models/Post"; import { PostGroupBy } from "../../outputs/PostGroupBy"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Post) export class GroupByPostResolver { @@ -15,7 +15,7 @@ export class GroupByPostResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.post.groupBy({ + return getPrismaFromContext(ctx).post.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/PostCrudResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/PostCrudResolver.ts index 8596b4b7..1191badd 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/PostCrudResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/PostCrudResolver.ts @@ -13,7 +13,7 @@ import { GroupByPostArgs } from "./args/GroupByPostArgs"; import { UpdateManyPostArgs } from "./args/UpdateManyPostArgs"; import { UpdatePostArgs } from "./args/UpdatePostArgs"; import { UpsertPostArgs } from "./args/UpsertPostArgs"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; import { Post } from "../../../models/Post"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; import { AggregatePost } from "../../outputs/AggregatePost"; @@ -25,77 +25,77 @@ export class PostCrudResolver { nullable: true }) async post(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniquePostArgs): Promise { - return ctx.prisma.post.findUnique(args); + return getPrismaFromContext(ctx).post.findUnique(args); } @TypeGraphQL.Query(_returns => Post, { nullable: true }) async findFirstPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstPostArgs): Promise { - return ctx.prisma.post.findFirst(args); + return getPrismaFromContext(ctx).post.findFirst(args); } @TypeGraphQL.Query(_returns => [Post], { nullable: false }) async posts(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyPostArgs): Promise { - return ctx.prisma.post.findMany(args); + return getPrismaFromContext(ctx).post.findMany(args); } @TypeGraphQL.Mutation(_returns => Post, { nullable: false }) async createPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreatePostArgs): Promise { - return ctx.prisma.post.create(args); + return getPrismaFromContext(ctx).post.create(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async createManyPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyPostArgs): Promise { - return ctx.prisma.post.createMany(args); + return getPrismaFromContext(ctx).post.createMany(args); } @TypeGraphQL.Mutation(_returns => Post, { nullable: true }) async deletePost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeletePostArgs): Promise { - return ctx.prisma.post.delete(args); + return getPrismaFromContext(ctx).post.delete(args); } @TypeGraphQL.Mutation(_returns => Post, { nullable: true }) async updatePost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdatePostArgs): Promise { - return ctx.prisma.post.update(args); + return getPrismaFromContext(ctx).post.update(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async deleteManyPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyPostArgs): Promise { - return ctx.prisma.post.deleteMany(args); + return getPrismaFromContext(ctx).post.deleteMany(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async updateManyPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyPostArgs): Promise { - return ctx.prisma.post.updateMany(args); + return getPrismaFromContext(ctx).post.updateMany(args); } @TypeGraphQL.Mutation(_returns => Post, { nullable: false }) async upsertPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertPostArgs): Promise { - return ctx.prisma.post.upsert(args); + return getPrismaFromContext(ctx).post.upsert(args); } @TypeGraphQL.Query(_returns => AggregatePost, { nullable: false }) async aggregatePost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregatePostArgs): Promise { - return ctx.prisma.post.aggregate({ + return getPrismaFromContext(ctx).post.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); @@ -108,7 +108,7 @@ export class PostCrudResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.post.groupBy({ + return getPrismaFromContext(ctx).post.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/UpdateManyPostResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/UpdateManyPostResolver.ts index 8ea3dfbb..3618c0ea 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/UpdateManyPostResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/UpdateManyPostResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdateManyPostArgs } from "./args/UpdateManyPostArgs"; import { Post } from "../../../models/Post"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Post) export class UpdateManyPostResolver { @@ -10,6 +10,6 @@ export class UpdateManyPostResolver { nullable: false }) async updateManyPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyPostArgs): Promise { - return ctx.prisma.post.updateMany(args); + return getPrismaFromContext(ctx).post.updateMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/UpdatePostResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/UpdatePostResolver.ts index 276c081d..0173234f 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/UpdatePostResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/UpdatePostResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdatePostArgs } from "./args/UpdatePostArgs"; import { Post } from "../../../models/Post"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Post) export class UpdatePostResolver { @@ -9,6 +9,6 @@ export class UpdatePostResolver { nullable: true }) async updatePost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdatePostArgs): Promise { - return ctx.prisma.post.update(args); + return getPrismaFromContext(ctx).post.update(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/UpsertPostResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/UpsertPostResolver.ts index d9d55cff..36bfff2c 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Post/UpsertPostResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Post/UpsertPostResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpsertPostArgs } from "./args/UpsertPostArgs"; import { Post } from "../../../models/Post"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Post) export class UpsertPostResolver { @@ -9,6 +9,6 @@ export class UpsertPostResolver { nullable: false }) async upsertPost(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertPostArgs): Promise { - return ctx.prisma.post.upsert(args); + return getPrismaFromContext(ctx).post.upsert(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/AggregateProblemResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/AggregateProblemResolver.ts index f771b11d..234190bb 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/AggregateProblemResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/AggregateProblemResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { AggregateProblemArgs } from "./args/AggregateProblemArgs"; import { Problem } from "../../../models/Problem"; import { AggregateProblem } from "../../outputs/AggregateProblem"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Problem) export class AggregateProblemResolver { @@ -12,7 +12,7 @@ export class AggregateProblemResolver { nullable: false }) async aggregateProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateProblemArgs): Promise { - return ctx.prisma.problem.aggregate({ + return getPrismaFromContext(ctx).problem.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/CreateManyProblemResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/CreateManyProblemResolver.ts index 31e02f23..637a5ec2 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/CreateManyProblemResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/CreateManyProblemResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreateManyProblemArgs } from "./args/CreateManyProblemArgs"; import { Problem } from "../../../models/Problem"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Problem) export class CreateManyProblemResolver { @@ -10,6 +10,6 @@ export class CreateManyProblemResolver { nullable: false }) async createManyProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyProblemArgs): Promise { - return ctx.prisma.problem.createMany(args); + return getPrismaFromContext(ctx).problem.createMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/CreateProblemResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/CreateProblemResolver.ts index 865784fb..7f62e97e 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/CreateProblemResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/CreateProblemResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { CreateProblemArgs } from "./args/CreateProblemArgs"; import { Problem } from "../../../models/Problem"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Problem) export class CreateProblemResolver { @@ -9,6 +9,6 @@ export class CreateProblemResolver { nullable: false }) async createProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateProblemArgs): Promise { - return ctx.prisma.problem.create(args); + return getPrismaFromContext(ctx).problem.create(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/DeleteManyProblemResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/DeleteManyProblemResolver.ts index a7394c11..a5201b03 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/DeleteManyProblemResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/DeleteManyProblemResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeleteManyProblemArgs } from "./args/DeleteManyProblemArgs"; import { Problem } from "../../../models/Problem"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Problem) export class DeleteManyProblemResolver { @@ -10,6 +10,6 @@ export class DeleteManyProblemResolver { nullable: false }) async deleteManyProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyProblemArgs): Promise { - return ctx.prisma.problem.deleteMany(args); + return getPrismaFromContext(ctx).problem.deleteMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/DeleteProblemResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/DeleteProblemResolver.ts index 6100923c..b0250b9d 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/DeleteProblemResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/DeleteProblemResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { DeleteProblemArgs } from "./args/DeleteProblemArgs"; import { Problem } from "../../../models/Problem"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Problem) export class DeleteProblemResolver { @@ -9,6 +9,6 @@ export class DeleteProblemResolver { nullable: true }) async deleteProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteProblemArgs): Promise { - return ctx.prisma.problem.delete(args); + return getPrismaFromContext(ctx).problem.delete(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/FindFirstProblemResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/FindFirstProblemResolver.ts index 2730580f..471a763d 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/FindFirstProblemResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/FindFirstProblemResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindFirstProblemArgs } from "./args/FindFirstProblemArgs"; import { Problem } from "../../../models/Problem"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Problem) export class FindFirstProblemResolver { @@ -9,6 +9,6 @@ export class FindFirstProblemResolver { nullable: true }) async findFirstProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstProblemArgs): Promise { - return ctx.prisma.problem.findFirst(args); + return getPrismaFromContext(ctx).problem.findFirst(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/FindManyProblemResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/FindManyProblemResolver.ts index 1d1b8e0e..ff622c21 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/FindManyProblemResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/FindManyProblemResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindManyProblemArgs } from "./args/FindManyProblemArgs"; import { Problem } from "../../../models/Problem"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Problem) export class FindManyProblemResolver { @@ -9,6 +9,6 @@ export class FindManyProblemResolver { nullable: false }) async problems(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyProblemArgs): Promise { - return ctx.prisma.problem.findMany(args); + return getPrismaFromContext(ctx).problem.findMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/FindUniqueProblemResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/FindUniqueProblemResolver.ts index a93b8e36..0fe53600 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/FindUniqueProblemResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/FindUniqueProblemResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { FindUniqueProblemArgs } from "./args/FindUniqueProblemArgs"; import { Problem } from "../../../models/Problem"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Problem) export class FindUniqueProblemResolver { @@ -9,6 +9,6 @@ export class FindUniqueProblemResolver { nullable: true }) async problem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueProblemArgs): Promise { - return ctx.prisma.problem.findUnique(args); + return getPrismaFromContext(ctx).problem.findUnique(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/GroupByProblemResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/GroupByProblemResolver.ts index d41b698e..17e3093b 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/GroupByProblemResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/GroupByProblemResolver.ts @@ -4,7 +4,7 @@ import { GraphQLResolveInfo } from "graphql"; import { GroupByProblemArgs } from "./args/GroupByProblemArgs"; import { Problem } from "../../../models/Problem"; import { ProblemGroupBy } from "../../outputs/ProblemGroupBy"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Problem) export class GroupByProblemResolver { @@ -15,7 +15,7 @@ export class GroupByProblemResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.problem.groupBy({ + return getPrismaFromContext(ctx).problem.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/ProblemCrudResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/ProblemCrudResolver.ts index 93c3f395..facc50ad 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/ProblemCrudResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/ProblemCrudResolver.ts @@ -13,7 +13,7 @@ import { GroupByProblemArgs } from "./args/GroupByProblemArgs"; import { UpdateManyProblemArgs } from "./args/UpdateManyProblemArgs"; import { UpdateProblemArgs } from "./args/UpdateProblemArgs"; import { UpsertProblemArgs } from "./args/UpsertProblemArgs"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; import { Problem } from "../../../models/Problem"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; import { AggregateProblem } from "../../outputs/AggregateProblem"; @@ -25,77 +25,77 @@ export class ProblemCrudResolver { nullable: true }) async problem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueProblemArgs): Promise { - return ctx.prisma.problem.findUnique(args); + return getPrismaFromContext(ctx).problem.findUnique(args); } @TypeGraphQL.Query(_returns => Problem, { nullable: true }) async findFirstProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstProblemArgs): Promise { - return ctx.prisma.problem.findFirst(args); + return getPrismaFromContext(ctx).problem.findFirst(args); } @TypeGraphQL.Query(_returns => [Problem], { nullable: false }) async problems(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyProblemArgs): Promise { - return ctx.prisma.problem.findMany(args); + return getPrismaFromContext(ctx).problem.findMany(args); } @TypeGraphQL.Mutation(_returns => Problem, { nullable: false }) async createProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateProblemArgs): Promise { - return ctx.prisma.problem.create(args); + return getPrismaFromContext(ctx).problem.create(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async createManyProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyProblemArgs): Promise { - return ctx.prisma.problem.createMany(args); + return getPrismaFromContext(ctx).problem.createMany(args); } @TypeGraphQL.Mutation(_returns => Problem, { nullable: true }) async deleteProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteProblemArgs): Promise { - return ctx.prisma.problem.delete(args); + return getPrismaFromContext(ctx).problem.delete(args); } @TypeGraphQL.Mutation(_returns => Problem, { nullable: true }) async updateProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateProblemArgs): Promise { - return ctx.prisma.problem.update(args); + return getPrismaFromContext(ctx).problem.update(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async deleteManyProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyProblemArgs): Promise { - return ctx.prisma.problem.deleteMany(args); + return getPrismaFromContext(ctx).problem.deleteMany(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async updateManyProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyProblemArgs): Promise { - return ctx.prisma.problem.updateMany(args); + return getPrismaFromContext(ctx).problem.updateMany(args); } @TypeGraphQL.Mutation(_returns => Problem, { nullable: false }) async upsertProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertProblemArgs): Promise { - return ctx.prisma.problem.upsert(args); + return getPrismaFromContext(ctx).problem.upsert(args); } @TypeGraphQL.Query(_returns => AggregateProblem, { nullable: false }) async aggregateProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateProblemArgs): Promise { - return ctx.prisma.problem.aggregate({ + return getPrismaFromContext(ctx).problem.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); @@ -108,7 +108,7 @@ export class ProblemCrudResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.problem.groupBy({ + return getPrismaFromContext(ctx).problem.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/UpdateManyProblemResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/UpdateManyProblemResolver.ts index 32af7518..91b1d7cb 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/UpdateManyProblemResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/UpdateManyProblemResolver.ts @@ -2,7 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdateManyProblemArgs } from "./args/UpdateManyProblemArgs"; import { Problem } from "../../../models/Problem"; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Problem) export class UpdateManyProblemResolver { @@ -10,6 +10,6 @@ export class UpdateManyProblemResolver { nullable: false }) async updateManyProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyProblemArgs): Promise { - return ctx.prisma.problem.updateMany(args); + return getPrismaFromContext(ctx).problem.updateMany(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/UpdateProblemResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/UpdateProblemResolver.ts index 5e96aa60..a2e10e4f 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/UpdateProblemResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/UpdateProblemResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpdateProblemArgs } from "./args/UpdateProblemArgs"; import { Problem } from "../../../models/Problem"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Problem) export class UpdateProblemResolver { @@ -9,6 +9,6 @@ export class UpdateProblemResolver { nullable: true }) async updateProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateProblemArgs): Promise { - return ctx.prisma.problem.update(args); + return getPrismaFromContext(ctx).problem.update(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/UpsertProblemResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/UpsertProblemResolver.ts index c4268547..24f656c5 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/UpsertProblemResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/crud/Problem/UpsertProblemResolver.ts @@ -1,7 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { UpsertProblemArgs } from "./args/UpsertProblemArgs"; import { Problem } from "../../../models/Problem"; -import { transformFields } from "../../../helpers"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Problem) export class UpsertProblemResolver { @@ -9,6 +9,6 @@ export class UpsertProblemResolver { nullable: false }) async upsertProblem(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertProblemArgs): Promise { - return ctx.prisma.problem.upsert(args); + return getPrismaFromContext(ctx).problem.upsert(args); } } diff --git a/experiments/prisma/generated/type-graphql/resolvers/relations/Client/ClientRelationsResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/relations/Client/ClientRelationsResolver.ts index 286c7409..fbe40d45 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/relations/Client/ClientRelationsResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/relations/Client/ClientRelationsResolver.ts @@ -2,6 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { Client } from "../../../models/Client"; import { Post } from "../../../models/Post"; import { ClientPostsArgs } from "./args/ClientPostsArgs"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Client) export class ClientRelationsResolver { @@ -9,7 +10,7 @@ export class ClientRelationsResolver { nullable: false }) async clientPosts(@TypeGraphQL.Root() client: Client, @TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: ClientPostsArgs): Promise { - return ctx.prisma.user.findUnique({ + return getPrismaFromContext(ctx).user.findUnique({ where: { id: client.id, }, diff --git a/experiments/prisma/generated/type-graphql/resolvers/relations/Creator/CreatorRelationsResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/relations/Creator/CreatorRelationsResolver.ts index c1d63908..6043bd26 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/relations/Creator/CreatorRelationsResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/relations/Creator/CreatorRelationsResolver.ts @@ -3,6 +3,7 @@ import { Creator } from "../../../models/Creator"; import { Problem } from "../../../models/Problem"; import { CreatorLikesArgs } from "./args/CreatorLikesArgs"; import { CreatorProblemsArgs } from "./args/CreatorProblemsArgs"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Creator) export class CreatorRelationsResolver { @@ -10,7 +11,7 @@ export class CreatorRelationsResolver { nullable: false }) async likes(@TypeGraphQL.Root() creator: Creator, @TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreatorLikesArgs): Promise { - return ctx.prisma.creator.findUnique({ + return getPrismaFromContext(ctx).creator.findUnique({ where: { id: creator.id, }, @@ -21,7 +22,7 @@ export class CreatorRelationsResolver { nullable: false }) async problems(@TypeGraphQL.Root() creator: Creator, @TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreatorProblemsArgs): Promise { - return ctx.prisma.creator.findUnique({ + return getPrismaFromContext(ctx).creator.findUnique({ where: { id: creator.id, }, diff --git a/experiments/prisma/generated/type-graphql/resolvers/relations/Director/DirectorRelationsResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/relations/Director/DirectorRelationsResolver.ts index fcd66302..32aba66c 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/relations/Director/DirectorRelationsResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/relations/Director/DirectorRelationsResolver.ts @@ -2,6 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { Director } from "../../../models/Director"; import { Movie } from "../../../models/Movie"; import { DirectorMoviesArgs } from "./args/DirectorMoviesArgs"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Director) export class DirectorRelationsResolver { @@ -9,7 +10,7 @@ export class DirectorRelationsResolver { nullable: false }) async movies(@TypeGraphQL.Root() director: Director, @TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DirectorMoviesArgs): Promise { - return ctx.prisma.director.findUnique({ + return getPrismaFromContext(ctx).director.findUnique({ where: { firstName_lastName: { firstName: director.firstName, diff --git a/experiments/prisma/generated/type-graphql/resolvers/relations/Movie/MovieRelationsResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/relations/Movie/MovieRelationsResolver.ts index f4196b2f..a91f8341 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/relations/Movie/MovieRelationsResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/relations/Movie/MovieRelationsResolver.ts @@ -1,6 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { Director } from "../../../models/Director"; import { Movie } from "../../../models/Movie"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Movie) export class MovieRelationsResolver { @@ -8,7 +9,7 @@ export class MovieRelationsResolver { nullable: false }) async director(@TypeGraphQL.Root() movie: Movie, @TypeGraphQL.Ctx() ctx: any): Promise { - return ctx.prisma.movie.findUnique({ + return getPrismaFromContext(ctx).movie.findUnique({ where: { directorFirstName_directorLastName_title: { directorFirstName: movie.directorFirstName, diff --git a/experiments/prisma/generated/type-graphql/resolvers/relations/Post/PostRelationsResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/relations/Post/PostRelationsResolver.ts index 53f8b0e5..9d9f904b 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/relations/Post/PostRelationsResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/relations/Post/PostRelationsResolver.ts @@ -1,6 +1,7 @@ import * as TypeGraphQL from "type-graphql"; import { Client } from "../../../models/Client"; import { Post } from "../../../models/Post"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Post) export class PostRelationsResolver { @@ -8,7 +9,7 @@ export class PostRelationsResolver { nullable: false }) async author(@TypeGraphQL.Root() post: Post, @TypeGraphQL.Ctx() ctx: any): Promise { - return ctx.prisma.post.findUnique({ + return getPrismaFromContext(ctx).post.findUnique({ where: { uuid: post.uuid, }, diff --git a/experiments/prisma/generated/type-graphql/resolvers/relations/Problem/ProblemRelationsResolver.ts b/experiments/prisma/generated/type-graphql/resolvers/relations/Problem/ProblemRelationsResolver.ts index e3720a39..306cb4ad 100644 --- a/experiments/prisma/generated/type-graphql/resolvers/relations/Problem/ProblemRelationsResolver.ts +++ b/experiments/prisma/generated/type-graphql/resolvers/relations/Problem/ProblemRelationsResolver.ts @@ -2,6 +2,7 @@ import * as TypeGraphQL from "type-graphql"; import { Creator } from "../../../models/Creator"; import { Problem } from "../../../models/Problem"; import { ProblemLikedByArgs } from "./args/ProblemLikedByArgs"; +import { transformFields, getPrismaFromContext } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Problem) export class ProblemRelationsResolver { @@ -9,7 +10,7 @@ export class ProblemRelationsResolver { nullable: false }) async likedBy(@TypeGraphQL.Root() problem: Problem, @TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: ProblemLikedByArgs): Promise { - return ctx.prisma.problem.findUnique({ + return getPrismaFromContext(ctx).problem.findUnique({ where: { id: problem.id, }, @@ -20,7 +21,7 @@ export class ProblemRelationsResolver { nullable: true }) async creator(@TypeGraphQL.Root() problem: Problem, @TypeGraphQL.Ctx() ctx: any): Promise { - return ctx.prisma.problem.findUnique({ + return getPrismaFromContext(ctx).problem.findUnique({ where: { id: problem.id, }, diff --git a/src/generator/generate-helpers.ts b/src/generator/generate-helpers.ts index 0afbf626..f865d691 100644 --- a/src/generator/generate-helpers.ts +++ b/src/generator/generate-helpers.ts @@ -16,4 +16,14 @@ export function generateHelpersFile(sourceFile: SourceFile) { ); } `); + + sourceFile.addStatements(/* ts */ ` + export function getPrismaFromContext(context: any) { + const prismaClient = context.prisma; + if (!prismaClient) { + throw new Error("Unable to find Prisma Client in GraphQL context. Please provide it under the \`context.prisma\` key."); + } + return prismaClient; + } + `); } diff --git a/src/generator/imports.ts b/src/generator/imports.ts index 3014069e..9ee0c9b4 100644 --- a/src/generator/imports.ts +++ b/src/generator/imports.ts @@ -65,7 +65,7 @@ export function generateHelpersFileImport(sourceFile: SourceFile, level = 0) { moduleSpecifier: (level === 0 ? "./" : "") + path.posix.join(...Array(level).fill(".."), "helpers"), - namedImports: ["transformFields"], + namedImports: ["transformFields", "getPrismaFromContext"], }); } diff --git a/src/generator/resolvers/helpers.ts b/src/generator/resolvers/helpers.ts index a323ea32..29e4cb8e 100644 --- a/src/generator/resolvers/helpers.ts +++ b/src/generator/resolvers/helpers.ts @@ -53,7 +53,7 @@ export function generateCrudResolverClassMethodDeclaration( statements: action.kind === DMMF.ModelAction.aggregate ? [ - /* ts */ ` return ctx.prisma.${mapping.collectionName}.${action.kind}({ + /* ts */ ` return getPrismaFromContext(ctx).${mapping.collectionName}.${action.kind}({ ...args, ...transformFields(graphqlFields(info as any)), });`, @@ -63,7 +63,7 @@ export function generateCrudResolverClassMethodDeclaration( /* ts */ ` const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) );`, - /* ts */ ` return ctx.prisma.${mapping.collectionName}.${action.kind}({ + /* ts */ ` return getPrismaFromContext(ctx).${mapping.collectionName}.${action.kind}({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) @@ -71,9 +71,9 @@ export function generateCrudResolverClassMethodDeclaration( });`, ] : [ - /* ts */ ` return ctx.prisma.${mapping.collectionName}.${ - action.kind - }(${action.argsTypeName ? "args" : ""});`, + /* ts */ ` return getPrismaFromContext(ctx).${ + mapping.collectionName + }.${action.kind}(${action.argsTypeName ? "args" : ""});`, ], }; } diff --git a/src/generator/resolvers/relations.ts b/src/generator/resolvers/relations.ts index bcf78a22..26012244 100644 --- a/src/generator/resolvers/relations.ts +++ b/src/generator/resolvers/relations.ts @@ -12,6 +12,7 @@ import { generateTypeGraphQLImport, generateArgsImports, generateModelsImports, + generateHelpersFileImport, } from "../imports"; import { DmmfDocument } from "../dmmf/dmmf-document"; import { DMMF } from "../dmmf/types"; @@ -63,6 +64,7 @@ export default function generateRelationsResolverClassesFromModel( .filter(it => it.argsTypeName !== undefined) .map(it => it.argsTypeName!); generateArgsImports(sourceFile, argTypeNames, 0); + generateHelpersFileImport(sourceFile, 3); sourceFile.addClass({ name: resolverName, @@ -136,7 +138,9 @@ export default function generateRelationsResolverClassesFromModel( ], // TODO: refactor to AST statements: [ - `return ctx.prisma.${camelCase(model.name)}.findUnique({ + /* ts */ `return getPrismaFromContext(ctx).${camelCase( + model.name, + )}.findUnique({ where: {${whereConditionString}}, }).${field.name}(${field.argsTypeName ? "args" : "{}"});`, ], diff --git a/tests/functional/errors.ts b/tests/functional/errors.ts new file mode 100644 index 00000000..a5b6ac12 --- /dev/null +++ b/tests/functional/errors.ts @@ -0,0 +1,60 @@ +import "reflect-metadata"; +import { promises as fs } from "fs"; +import { buildSchema } from "type-graphql"; +import { graphql, GraphQLSchema } from "graphql"; + +import generateArtifactsDirPath from "../helpers/artifacts-dir"; +import { generateCodeFromSchema } from "../helpers/generate-code"; + +describe("errors", () => { + let outputDirPath: string; + let graphQLSchema: GraphQLSchema; + + describe("getPrismaFromContext", () => { + beforeAll(async () => { + outputDirPath = generateArtifactsDirPath("functional-crud"); + await fs.mkdir(outputDirPath, { recursive: true }); + const prismaSchema = /* prisma */ ` + datasource db { + provider = "postgresql" + url = env("DATABASE_URL") + } + model User { + intIdField Int @id @default(autoincrement()) + uniqueStringField String @unique + optionalStringField String? + dateField DateTime + } + `; + await generateCodeFromSchema(prismaSchema, { outputDirPath }); + const { UserCrudResolver } = require(outputDirPath + + "/resolvers/crud/User/UserCrudResolver.ts"); + + graphQLSchema = await buildSchema({ + resolvers: [UserCrudResolver], + validate: false, + }); + }); + + it("should throw error when prisma not provided in context", async () => { + const document = /* graphql */ ` + query { + user(where: { uniqueStringField: "uniqueValue" }) { + intIdField + dateField + } + } + `; + + const { errors } = await graphql(graphQLSchema, document, null, { + // prisma: undefined, + }); + + expect(errors).toMatchInlineSnapshot(` + Array [ + [GraphQLError: Unable to find Prisma Client in GraphQL context. Please provide it under the \`context.prisma\` key.], + ] + `); + }); + }); +}); diff --git a/tests/regression/__snapshots__/crud.ts.snap b/tests/regression/__snapshots__/crud.ts.snap index 2d1b387d..82e1d34c 100644 --- a/tests/regression/__snapshots__/crud.ts.snap +++ b/tests/regression/__snapshots__/crud.ts.snap @@ -4,7 +4,7 @@ exports[`crud should properly generate actions resolver classes for prisma model "import * as TypeGraphQL from \\"type-graphql\\"; import { CreateUserArgs } from \\"./args/CreateUserArgs\\"; import { User } from \\"../../../models/User\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class CreateUserResolver { @@ -12,7 +12,7 @@ export class CreateUserResolver { nullable: false }) async createUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateUserArgs): Promise { - return ctx.prisma.user.create(args); + return getPrismaFromContext(ctx).user.create(args); } } " @@ -23,7 +23,7 @@ exports[`crud should properly generate actions resolver classes for prisma model import { DeleteManyUserArgs } from \\"./args/DeleteManyUserArgs\\"; import { User } from \\"../../../models/User\\"; import { AffectedRowsOutput } from \\"../../outputs/AffectedRowsOutput\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class DeleteManyUserResolver { @@ -31,7 +31,7 @@ export class DeleteManyUserResolver { nullable: false }) async deleteManyUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyUserArgs): Promise { - return ctx.prisma.user.deleteMany(args); + return getPrismaFromContext(ctx).user.deleteMany(args); } } " @@ -41,7 +41,7 @@ exports[`crud should properly generate actions resolver classes for prisma model "import * as TypeGraphQL from \\"type-graphql\\"; import { DeleteUserArgs } from \\"./args/DeleteUserArgs\\"; import { User } from \\"../../../models/User\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class DeleteUserResolver { @@ -49,7 +49,7 @@ export class DeleteUserResolver { nullable: true }) async deleteUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteUserArgs): Promise { - return ctx.prisma.user.delete(args); + return getPrismaFromContext(ctx).user.delete(args); } } " @@ -59,7 +59,7 @@ exports[`crud should properly generate actions resolver classes for prisma model "import * as TypeGraphQL from \\"type-graphql\\"; import { FindFirstUserArgs } from \\"./args/FindFirstUserArgs\\"; import { User } from \\"../../../models/User\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class FindFirstUserResolver { @@ -67,7 +67,7 @@ export class FindFirstUserResolver { nullable: true }) async findFirstUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstUserArgs): Promise { - return ctx.prisma.user.findFirst(args); + return getPrismaFromContext(ctx).user.findFirst(args); } } " @@ -77,7 +77,7 @@ exports[`crud should properly generate actions resolver classes for prisma model "import * as TypeGraphQL from \\"type-graphql\\"; import { FindManyUserArgs } from \\"./args/FindManyUserArgs\\"; import { User } from \\"../../../models/User\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class FindManyUserResolver { @@ -85,7 +85,7 @@ export class FindManyUserResolver { nullable: false }) async users(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyUserArgs): Promise { - return ctx.prisma.user.findMany(args); + return getPrismaFromContext(ctx).user.findMany(args); } } " @@ -95,7 +95,7 @@ exports[`crud should properly generate actions resolver classes for prisma model "import * as TypeGraphQL from \\"type-graphql\\"; import { FindUniqueUserArgs } from \\"./args/FindUniqueUserArgs\\"; import { User } from \\"../../../models/User\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class FindUniqueUserResolver { @@ -103,7 +103,7 @@ export class FindUniqueUserResolver { nullable: true }) async user(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueUserArgs): Promise { - return ctx.prisma.user.findUnique(args); + return getPrismaFromContext(ctx).user.findUnique(args); } } " @@ -121,7 +121,7 @@ exports[`crud should properly generate actions resolver classes for prisma model import { UpdateManyUserArgs } from \\"./args/UpdateManyUserArgs\\"; import { User } from \\"../../../models/User\\"; import { AffectedRowsOutput } from \\"../../outputs/AffectedRowsOutput\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class UpdateManyUserResolver { @@ -129,7 +129,7 @@ export class UpdateManyUserResolver { nullable: false }) async updateManyUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyUserArgs): Promise { - return ctx.prisma.user.updateMany(args); + return getPrismaFromContext(ctx).user.updateMany(args); } } " @@ -139,7 +139,7 @@ exports[`crud should properly generate actions resolver classes for prisma model "import * as TypeGraphQL from \\"type-graphql\\"; import { UpdateUserArgs } from \\"./args/UpdateUserArgs\\"; import { User } from \\"../../../models/User\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class UpdateUserResolver { @@ -147,7 +147,7 @@ export class UpdateUserResolver { nullable: true }) async updateUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateUserArgs): Promise { - return ctx.prisma.user.update(args); + return getPrismaFromContext(ctx).user.update(args); } } " @@ -157,7 +157,7 @@ exports[`crud should properly generate actions resolver classes for prisma model "import * as TypeGraphQL from \\"type-graphql\\"; import { UpsertUserArgs } from \\"./args/UpsertUserArgs\\"; import { User } from \\"../../../models/User\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class UpsertUserResolver { @@ -165,7 +165,7 @@ export class UpsertUserResolver { nullable: false }) async upsertUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertUserArgs): Promise { - return ctx.prisma.user.upsert(args); + return getPrismaFromContext(ctx).user.upsert(args); } } " @@ -482,7 +482,7 @@ import { FindUniqueUserArgs } from \\"./args/FindUniqueUserArgs\\"; import { UpdateManyUserArgs } from \\"./args/UpdateManyUserArgs\\"; import { UpdateUserArgs } from \\"./args/UpdateUserArgs\\"; import { UpsertUserArgs } from \\"./args/UpsertUserArgs\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; import { User } from \\"../../../models/User\\"; import { AffectedRowsOutput } from \\"../../outputs/AffectedRowsOutput\\"; import { AggregateUser } from \\"../../outputs/AggregateUser\\"; @@ -493,70 +493,70 @@ export class UserCrudResolver { nullable: true }) async user(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueUserArgs): Promise { - return ctx.prisma.user.findUnique(args); + return getPrismaFromContext(ctx).user.findUnique(args); } @TypeGraphQL.Query(_returns => User, { nullable: true }) async findFirstUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstUserArgs): Promise { - return ctx.prisma.user.findFirst(args); + return getPrismaFromContext(ctx).user.findFirst(args); } @TypeGraphQL.Query(_returns => [User], { nullable: false }) async users(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyUserArgs): Promise { - return ctx.prisma.user.findMany(args); + return getPrismaFromContext(ctx).user.findMany(args); } @TypeGraphQL.Mutation(_returns => User, { nullable: false }) async createUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateUserArgs): Promise { - return ctx.prisma.user.create(args); + return getPrismaFromContext(ctx).user.create(args); } @TypeGraphQL.Mutation(_returns => User, { nullable: true }) async deleteUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteUserArgs): Promise { - return ctx.prisma.user.delete(args); + return getPrismaFromContext(ctx).user.delete(args); } @TypeGraphQL.Mutation(_returns => User, { nullable: true }) async updateUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateUserArgs): Promise { - return ctx.prisma.user.update(args); + return getPrismaFromContext(ctx).user.update(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async deleteManyUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyUserArgs): Promise { - return ctx.prisma.user.deleteMany(args); + return getPrismaFromContext(ctx).user.deleteMany(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async updateManyUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyUserArgs): Promise { - return ctx.prisma.user.updateMany(args); + return getPrismaFromContext(ctx).user.updateMany(args); } @TypeGraphQL.Mutation(_returns => User, { nullable: false }) async upsertUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertUserArgs): Promise { - return ctx.prisma.user.upsert(args); + return getPrismaFromContext(ctx).user.upsert(args); } @TypeGraphQL.Query(_returns => AggregateUser, { nullable: false }) async aggregateUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateUserArgs): Promise { - return ctx.prisma.user.aggregate({ + return getPrismaFromContext(ctx).user.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); @@ -620,7 +620,7 @@ import { FindUniqueStaffArgs } from \\"./args/FindUniqueStaffArgs\\"; import { UpdateManyStaffArgs } from \\"./args/UpdateManyStaffArgs\\"; import { UpdateStaffArgs } from \\"./args/UpdateStaffArgs\\"; import { UpsertStaffArgs } from \\"./args/UpsertStaffArgs\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; import { Staff } from \\"../../../models/Staff\\"; import { AffectedRowsOutput } from \\"../../outputs/AffectedRowsOutput\\"; import { AggregateStaff } from \\"../../outputs/AggregateStaff\\"; @@ -631,70 +631,70 @@ export class StaffCrudResolver { nullable: true }) async findUniqueStaff(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueStaffArgs): Promise { - return ctx.prisma.staff.findUnique(args); + return getPrismaFromContext(ctx).staff.findUnique(args); } @TypeGraphQL.Query(_returns => Staff, { nullable: true }) async findFirstStaff(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstStaffArgs): Promise { - return ctx.prisma.staff.findFirst(args); + return getPrismaFromContext(ctx).staff.findFirst(args); } @TypeGraphQL.Query(_returns => [Staff], { nullable: false }) async findManyStaff(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyStaffArgs): Promise { - return ctx.prisma.staff.findMany(args); + return getPrismaFromContext(ctx).staff.findMany(args); } @TypeGraphQL.Mutation(_returns => Staff, { nullable: false }) async createStaff(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateStaffArgs): Promise { - return ctx.prisma.staff.create(args); + return getPrismaFromContext(ctx).staff.create(args); } @TypeGraphQL.Mutation(_returns => Staff, { nullable: true }) async deleteStaff(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteStaffArgs): Promise { - return ctx.prisma.staff.delete(args); + return getPrismaFromContext(ctx).staff.delete(args); } @TypeGraphQL.Mutation(_returns => Staff, { nullable: true }) async updateStaff(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateStaffArgs): Promise { - return ctx.prisma.staff.update(args); + return getPrismaFromContext(ctx).staff.update(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async deleteManyStaff(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyStaffArgs): Promise { - return ctx.prisma.staff.deleteMany(args); + return getPrismaFromContext(ctx).staff.deleteMany(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async updateManyStaff(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyStaffArgs): Promise { - return ctx.prisma.staff.updateMany(args); + return getPrismaFromContext(ctx).staff.updateMany(args); } @TypeGraphQL.Mutation(_returns => Staff, { nullable: false }) async upsertStaff(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertStaffArgs): Promise { - return ctx.prisma.staff.upsert(args); + return getPrismaFromContext(ctx).staff.upsert(args); } @TypeGraphQL.Query(_returns => AggregateStaff, { nullable: false }) async aggregateStaff(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateStaffArgs): Promise { - return ctx.prisma.staff.aggregate({ + return getPrismaFromContext(ctx).staff.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); @@ -707,7 +707,7 @@ exports[`crud should properly generate resolver class when useOriginalMapping is "import * as TypeGraphQL from \\"type-graphql\\"; import { FindUniqueUserArgs } from \\"./args/FindUniqueUserArgs\\"; import { User } from \\"../../../models/User\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class FindUniqueUserResolver { @@ -715,7 +715,7 @@ export class FindUniqueUserResolver { nullable: true }) async findUniqueUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueUserArgs): Promise { - return ctx.prisma.user.findUnique(args); + return getPrismaFromContext(ctx).user.findUnique(args); } } " @@ -735,7 +735,7 @@ import { FindUniqueUserArgs } from \\"./args/FindUniqueUserArgs\\"; import { UpdateManyUserArgs } from \\"./args/UpdateManyUserArgs\\"; import { UpdateUserArgs } from \\"./args/UpdateUserArgs\\"; import { UpsertUserArgs } from \\"./args/UpsertUserArgs\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; import { User } from \\"../../../models/User\\"; import { AffectedRowsOutput } from \\"../../outputs/AffectedRowsOutput\\"; import { AggregateUser } from \\"../../outputs/AggregateUser\\"; @@ -746,70 +746,70 @@ export class UserCrudResolver { nullable: true }) async findUniqueUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueUserArgs): Promise { - return ctx.prisma.user.findUnique(args); + return getPrismaFromContext(ctx).user.findUnique(args); } @TypeGraphQL.Query(_returns => User, { nullable: true }) async findFirstUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstUserArgs): Promise { - return ctx.prisma.user.findFirst(args); + return getPrismaFromContext(ctx).user.findFirst(args); } @TypeGraphQL.Query(_returns => [User], { nullable: false }) async findManyUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyUserArgs): Promise { - return ctx.prisma.user.findMany(args); + return getPrismaFromContext(ctx).user.findMany(args); } @TypeGraphQL.Mutation(_returns => User, { nullable: false }) async createUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateUserArgs): Promise { - return ctx.prisma.user.create(args); + return getPrismaFromContext(ctx).user.create(args); } @TypeGraphQL.Mutation(_returns => User, { nullable: true }) async deleteUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteUserArgs): Promise { - return ctx.prisma.user.delete(args); + return getPrismaFromContext(ctx).user.delete(args); } @TypeGraphQL.Mutation(_returns => User, { nullable: true }) async updateUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateUserArgs): Promise { - return ctx.prisma.user.update(args); + return getPrismaFromContext(ctx).user.update(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async deleteManyUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyUserArgs): Promise { - return ctx.prisma.user.deleteMany(args); + return getPrismaFromContext(ctx).user.deleteMany(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async updateManyUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyUserArgs): Promise { - return ctx.prisma.user.updateMany(args); + return getPrismaFromContext(ctx).user.updateMany(args); } @TypeGraphQL.Mutation(_returns => User, { nullable: false }) async upsertUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertUserArgs): Promise { - return ctx.prisma.user.upsert(args); + return getPrismaFromContext(ctx).user.upsert(args); } @TypeGraphQL.Query(_returns => AggregateUser, { nullable: false }) async aggregateUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateUserArgs): Promise { - return ctx.prisma.user.aggregate({ + return getPrismaFromContext(ctx).user.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); @@ -843,7 +843,7 @@ exports[`crud when \`createMany\` preview feature is enabled should properly gen import { CreateManyUserArgs } from \\"./args/CreateManyUserArgs\\"; import { User } from \\"../../../models/User\\"; import { AffectedRowsOutput } from \\"../../outputs/AffectedRowsOutput\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class CreateManyUserResolver { @@ -851,7 +851,7 @@ export class CreateManyUserResolver { nullable: false }) async createManyUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyUserArgs): Promise { - return ctx.prisma.user.createMany(args); + return getPrismaFromContext(ctx).user.createMany(args); } } " @@ -872,7 +872,7 @@ import { FindUniqueUserArgs } from \\"./args/FindUniqueUserArgs\\"; import { UpdateManyUserArgs } from \\"./args/UpdateManyUserArgs\\"; import { UpdateUserArgs } from \\"./args/UpdateUserArgs\\"; import { UpsertUserArgs } from \\"./args/UpsertUserArgs\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; import { User } from \\"../../../models/User\\"; import { AffectedRowsOutput } from \\"../../outputs/AffectedRowsOutput\\"; import { AggregateUser } from \\"../../outputs/AggregateUser\\"; @@ -883,77 +883,77 @@ export class UserCrudResolver { nullable: true }) async user(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueUserArgs): Promise { - return ctx.prisma.user.findUnique(args); + return getPrismaFromContext(ctx).user.findUnique(args); } @TypeGraphQL.Query(_returns => User, { nullable: true }) async findFirstUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstUserArgs): Promise { - return ctx.prisma.user.findFirst(args); + return getPrismaFromContext(ctx).user.findFirst(args); } @TypeGraphQL.Query(_returns => [User], { nullable: false }) async users(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyUserArgs): Promise { - return ctx.prisma.user.findMany(args); + return getPrismaFromContext(ctx).user.findMany(args); } @TypeGraphQL.Mutation(_returns => User, { nullable: false }) async createUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateUserArgs): Promise { - return ctx.prisma.user.create(args); + return getPrismaFromContext(ctx).user.create(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async createManyUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateManyUserArgs): Promise { - return ctx.prisma.user.createMany(args); + return getPrismaFromContext(ctx).user.createMany(args); } @TypeGraphQL.Mutation(_returns => User, { nullable: true }) async deleteUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteUserArgs): Promise { - return ctx.prisma.user.delete(args); + return getPrismaFromContext(ctx).user.delete(args); } @TypeGraphQL.Mutation(_returns => User, { nullable: true }) async updateUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateUserArgs): Promise { - return ctx.prisma.user.update(args); + return getPrismaFromContext(ctx).user.update(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async deleteManyUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyUserArgs): Promise { - return ctx.prisma.user.deleteMany(args); + return getPrismaFromContext(ctx).user.deleteMany(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async updateManyUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyUserArgs): Promise { - return ctx.prisma.user.updateMany(args); + return getPrismaFromContext(ctx).user.updateMany(args); } @TypeGraphQL.Mutation(_returns => User, { nullable: false }) async upsertUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertUserArgs): Promise { - return ctx.prisma.user.upsert(args); + return getPrismaFromContext(ctx).user.upsert(args); } @TypeGraphQL.Query(_returns => AggregateUser, { nullable: false }) async aggregateUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateUserArgs): Promise { - return ctx.prisma.user.aggregate({ + return getPrismaFromContext(ctx).user.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); @@ -1048,34 +1048,34 @@ const AffectedRowsOutput_1 = require(\\"../../outputs/AffectedRowsOutput\\"); const AggregateUser_1 = require(\\"../../outputs/AggregateUser\\"); let UserCrudResolver = class UserCrudResolver { async user(ctx, args) { - return ctx.prisma.user.findUnique(args); + return helpers_1.getPrismaFromContext(ctx).user.findUnique(args); } async findFirstUser(ctx, args) { - return ctx.prisma.user.findFirst(args); + return helpers_1.getPrismaFromContext(ctx).user.findFirst(args); } async users(ctx, args) { - return ctx.prisma.user.findMany(args); + return helpers_1.getPrismaFromContext(ctx).user.findMany(args); } async createUser(ctx, args) { - return ctx.prisma.user.create(args); + return helpers_1.getPrismaFromContext(ctx).user.create(args); } async deleteUser(ctx, args) { - return ctx.prisma.user.delete(args); + return helpers_1.getPrismaFromContext(ctx).user.delete(args); } async updateUser(ctx, args) { - return ctx.prisma.user.update(args); + return helpers_1.getPrismaFromContext(ctx).user.update(args); } async deleteManyUser(ctx, args) { - return ctx.prisma.user.deleteMany(args); + return helpers_1.getPrismaFromContext(ctx).user.deleteMany(args); } async updateManyUser(ctx, args) { - return ctx.prisma.user.updateMany(args); + return helpers_1.getPrismaFromContext(ctx).user.updateMany(args); } async upsertUser(ctx, args) { - return ctx.prisma.user.upsert(args); + return helpers_1.getPrismaFromContext(ctx).user.upsert(args); } async aggregateUser(ctx, info, args) { - return ctx.prisma.user.aggregate({ + return helpers_1.getPrismaFromContext(ctx).user.aggregate({ ...args, ...helpers_1.transformFields(graphql_fields_1.default(info)), }); @@ -1182,7 +1182,7 @@ exports[`crud when model is renamed should properly generate actions resolver cl "import * as TypeGraphQL from \\"type-graphql\\"; import { CreateClientArgs } from \\"./args/CreateClientArgs\\"; import { Client } from \\"../../../models/Client\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => Client) export class CreateClientResolver { @@ -1190,7 +1190,7 @@ export class CreateClientResolver { nullable: false }) async createClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateClientArgs): Promise { - return ctx.prisma.user.create(args); + return getPrismaFromContext(ctx).user.create(args); } } " @@ -1200,7 +1200,7 @@ exports[`crud when model is renamed should properly generate actions resolver cl "import * as TypeGraphQL from \\"type-graphql\\"; import { DeleteClientArgs } from \\"./args/DeleteClientArgs\\"; import { Client } from \\"../../../models/Client\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => Client) export class DeleteClientResolver { @@ -1208,7 +1208,7 @@ export class DeleteClientResolver { nullable: true }) async deleteClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteClientArgs): Promise { - return ctx.prisma.user.delete(args); + return getPrismaFromContext(ctx).user.delete(args); } } " @@ -1219,7 +1219,7 @@ exports[`crud when model is renamed should properly generate actions resolver cl import { DeleteManyClientArgs } from \\"./args/DeleteManyClientArgs\\"; import { Client } from \\"../../../models/Client\\"; import { AffectedRowsOutput } from \\"../../outputs/AffectedRowsOutput\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => Client) export class DeleteManyClientResolver { @@ -1227,7 +1227,7 @@ export class DeleteManyClientResolver { nullable: false }) async deleteManyClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyClientArgs): Promise { - return ctx.prisma.user.deleteMany(args); + return getPrismaFromContext(ctx).user.deleteMany(args); } } " @@ -1237,7 +1237,7 @@ exports[`crud when model is renamed should properly generate actions resolver cl "import * as TypeGraphQL from \\"type-graphql\\"; import { FindFirstClientArgs } from \\"./args/FindFirstClientArgs\\"; import { Client } from \\"../../../models/Client\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => Client) export class FindFirstClientResolver { @@ -1245,7 +1245,7 @@ export class FindFirstClientResolver { nullable: true }) async findFirstClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstClientArgs): Promise { - return ctx.prisma.user.findFirst(args); + return getPrismaFromContext(ctx).user.findFirst(args); } } " @@ -1255,7 +1255,7 @@ exports[`crud when model is renamed should properly generate actions resolver cl "import * as TypeGraphQL from \\"type-graphql\\"; import { FindManyClientArgs } from \\"./args/FindManyClientArgs\\"; import { Client } from \\"../../../models/Client\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => Client) export class FindManyClientResolver { @@ -1263,7 +1263,7 @@ export class FindManyClientResolver { nullable: false }) async clients(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyClientArgs): Promise { - return ctx.prisma.user.findMany(args); + return getPrismaFromContext(ctx).user.findMany(args); } } " @@ -1273,7 +1273,7 @@ exports[`crud when model is renamed should properly generate actions resolver cl "import * as TypeGraphQL from \\"type-graphql\\"; import { FindUniqueClientArgs } from \\"./args/FindUniqueClientArgs\\"; import { Client } from \\"../../../models/Client\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => Client) export class FindUniqueClientResolver { @@ -1281,7 +1281,7 @@ export class FindUniqueClientResolver { nullable: true }) async client(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueClientArgs): Promise { - return ctx.prisma.user.findUnique(args); + return getPrismaFromContext(ctx).user.findUnique(args); } } " @@ -1291,7 +1291,7 @@ exports[`crud when model is renamed should properly generate actions resolver cl "import * as TypeGraphQL from \\"type-graphql\\"; import { UpdateClientArgs } from \\"./args/UpdateClientArgs\\"; import { Client } from \\"../../../models/Client\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => Client) export class UpdateClientResolver { @@ -1299,7 +1299,7 @@ export class UpdateClientResolver { nullable: true }) async updateClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateClientArgs): Promise { - return ctx.prisma.user.update(args); + return getPrismaFromContext(ctx).user.update(args); } } " @@ -1310,7 +1310,7 @@ exports[`crud when model is renamed should properly generate actions resolver cl import { UpdateManyClientArgs } from \\"./args/UpdateManyClientArgs\\"; import { Client } from \\"../../../models/Client\\"; import { AffectedRowsOutput } from \\"../../outputs/AffectedRowsOutput\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => Client) export class UpdateManyClientResolver { @@ -1318,7 +1318,7 @@ export class UpdateManyClientResolver { nullable: false }) async updateManyClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyClientArgs): Promise { - return ctx.prisma.user.updateMany(args); + return getPrismaFromContext(ctx).user.updateMany(args); } } " @@ -1328,7 +1328,7 @@ exports[`crud when model is renamed should properly generate actions resolver cl "import * as TypeGraphQL from \\"type-graphql\\"; import { UpsertClientArgs } from \\"./args/UpsertClientArgs\\"; import { Client } from \\"../../../models/Client\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => Client) export class UpsertClientResolver { @@ -1336,7 +1336,7 @@ export class UpsertClientResolver { nullable: false }) async upsertClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertClientArgs): Promise { - return ctx.prisma.user.upsert(args); + return getPrismaFromContext(ctx).user.upsert(args); } } " @@ -1622,7 +1622,7 @@ import { FindUniqueClientArgs } from \\"./args/FindUniqueClientArgs\\"; import { UpdateClientArgs } from \\"./args/UpdateClientArgs\\"; import { UpdateManyClientArgs } from \\"./args/UpdateManyClientArgs\\"; import { UpsertClientArgs } from \\"./args/UpsertClientArgs\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; import { Client } from \\"../../../models/Client\\"; import { AffectedRowsOutput } from \\"../../outputs/AffectedRowsOutput\\"; import { AggregateClient } from \\"../../outputs/AggregateClient\\"; @@ -1633,70 +1633,70 @@ export class ClientCrudResolver { nullable: true }) async findUniqueClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueClientArgs): Promise { - return ctx.prisma.user.findUnique(args); + return getPrismaFromContext(ctx).user.findUnique(args); } @TypeGraphQL.Query(_returns => Client, { nullable: true }) async findFirstClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstClientArgs): Promise { - return ctx.prisma.user.findFirst(args); + return getPrismaFromContext(ctx).user.findFirst(args); } @TypeGraphQL.Query(_returns => [Client], { nullable: false }) async findManyClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyClientArgs): Promise { - return ctx.prisma.user.findMany(args); + return getPrismaFromContext(ctx).user.findMany(args); } @TypeGraphQL.Mutation(_returns => Client, { nullable: false }) async createClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateClientArgs): Promise { - return ctx.prisma.user.create(args); + return getPrismaFromContext(ctx).user.create(args); } @TypeGraphQL.Mutation(_returns => Client, { nullable: true }) async deleteClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteClientArgs): Promise { - return ctx.prisma.user.delete(args); + return getPrismaFromContext(ctx).user.delete(args); } @TypeGraphQL.Mutation(_returns => Client, { nullable: true }) async updateClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateClientArgs): Promise { - return ctx.prisma.user.update(args); + return getPrismaFromContext(ctx).user.update(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async deleteManyClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyClientArgs): Promise { - return ctx.prisma.user.deleteMany(args); + return getPrismaFromContext(ctx).user.deleteMany(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async updateManyClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyClientArgs): Promise { - return ctx.prisma.user.updateMany(args); + return getPrismaFromContext(ctx).user.updateMany(args); } @TypeGraphQL.Mutation(_returns => Client, { nullable: false }) async upsertClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertClientArgs): Promise { - return ctx.prisma.user.upsert(args); + return getPrismaFromContext(ctx).user.upsert(args); } @TypeGraphQL.Query(_returns => AggregateClient, { nullable: false }) async aggregateClient(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateClientArgs): Promise { - return ctx.prisma.user.aggregate({ + return getPrismaFromContext(ctx).user.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); @@ -1770,7 +1770,7 @@ import { GraphQLResolveInfo } from \\"graphql\\"; import { GroupByUserArgs } from \\"./args/GroupByUserArgs\\"; import { User } from \\"../../../models/User\\"; import { UserGroupBy } from \\"../../outputs/UserGroupBy\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class GroupByUserResolver { @@ -1781,7 +1781,7 @@ export class GroupByUserResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.user.groupBy({ + return getPrismaFromContext(ctx).user.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) @@ -1807,7 +1807,7 @@ import { GroupByUserArgs } from \\"./args/GroupByUserArgs\\"; import { UpdateManyUserArgs } from \\"./args/UpdateManyUserArgs\\"; import { UpdateUserArgs } from \\"./args/UpdateUserArgs\\"; import { UpsertUserArgs } from \\"./args/UpsertUserArgs\\"; -import { transformFields } from \\"../../../helpers\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; import { User } from \\"../../../models/User\\"; import { AffectedRowsOutput } from \\"../../outputs/AffectedRowsOutput\\"; import { AggregateUser } from \\"../../outputs/AggregateUser\\"; @@ -1819,70 +1819,70 @@ export class UserCrudResolver { nullable: true }) async user(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueUserArgs): Promise { - return ctx.prisma.user.findUnique(args); + return getPrismaFromContext(ctx).user.findUnique(args); } @TypeGraphQL.Query(_returns => User, { nullable: true }) async findFirstUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstUserArgs): Promise { - return ctx.prisma.user.findFirst(args); + return getPrismaFromContext(ctx).user.findFirst(args); } @TypeGraphQL.Query(_returns => [User], { nullable: false }) async users(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyUserArgs): Promise { - return ctx.prisma.user.findMany(args); + return getPrismaFromContext(ctx).user.findMany(args); } @TypeGraphQL.Mutation(_returns => User, { nullable: false }) async createUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateUserArgs): Promise { - return ctx.prisma.user.create(args); + return getPrismaFromContext(ctx).user.create(args); } @TypeGraphQL.Mutation(_returns => User, { nullable: true }) async deleteUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteUserArgs): Promise { - return ctx.prisma.user.delete(args); + return getPrismaFromContext(ctx).user.delete(args); } @TypeGraphQL.Mutation(_returns => User, { nullable: true }) async updateUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateUserArgs): Promise { - return ctx.prisma.user.update(args); + return getPrismaFromContext(ctx).user.update(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async deleteManyUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteManyUserArgs): Promise { - return ctx.prisma.user.deleteMany(args); + return getPrismaFromContext(ctx).user.deleteMany(args); } @TypeGraphQL.Mutation(_returns => AffectedRowsOutput, { nullable: false }) async updateManyUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateManyUserArgs): Promise { - return ctx.prisma.user.updateMany(args); + return getPrismaFromContext(ctx).user.updateMany(args); } @TypeGraphQL.Mutation(_returns => User, { nullable: false }) async upsertUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertUserArgs): Promise { - return ctx.prisma.user.upsert(args); + return getPrismaFromContext(ctx).user.upsert(args); } @TypeGraphQL.Query(_returns => AggregateUser, { nullable: false }) async aggregateUser(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: AggregateUserArgs): Promise { - return ctx.prisma.user.aggregate({ + return getPrismaFromContext(ctx).user.aggregate({ ...args, ...transformFields(graphqlFields(info as any)), }); @@ -1895,7 +1895,7 @@ export class UserCrudResolver { const { count, avg, sum, min, max } = transformFields( graphqlFields(info as any) ); - return ctx.prisma.user.groupBy({ + return getPrismaFromContext(ctx).user.groupBy({ ...args, ...Object.fromEntries( Object.entries({ count, avg, sum, min, max }).filter(([_, v]) => v != null) diff --git a/tests/regression/__snapshots__/generate-helpers.ts.snap b/tests/regression/__snapshots__/generate-helpers.ts.snap index 3e3f34e7..8d14bea4 100644 --- a/tests/regression/__snapshots__/generate-helpers.ts.snap +++ b/tests/regression/__snapshots__/generate-helpers.ts.snap @@ -16,5 +16,14 @@ export function transformFields(fields: Record): Record UsersOnProjects) export class UsersOnProjectsRelationsResolver { @@ -12,7 +13,7 @@ export class UsersOnProjectsRelationsResolver { nullable: false }) async project(@TypeGraphQL.Root() usersOnProjects: UsersOnProjects, @TypeGraphQL.Ctx() ctx: any): Promise { - return ctx.prisma.usersOnProjects.findUnique({ + return getPrismaFromContext(ctx).usersOnProjects.findUnique({ where: { userId_projectId: { userId: usersOnProjects.userId, @@ -26,7 +27,7 @@ export class UsersOnProjectsRelationsResolver { nullable: false }) async user(@TypeGraphQL.Root() usersOnProjects: UsersOnProjects, @TypeGraphQL.Ctx() ctx: any): Promise { - return ctx.prisma.usersOnProjects.findUnique({ + return getPrismaFromContext(ctx).usersOnProjects.findUnique({ where: { userId_projectId: { userId: usersOnProjects.userId, @@ -111,6 +112,7 @@ exports[`relations resolvers generation should properly generate relation resolv "import * as TypeGraphQL from \\"type-graphql\\"; import { Director } from \\"../../../models/Director\\"; import { Movie } from \\"../../../models/Movie\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => Movie) export class MovieRelationsResolver { @@ -118,7 +120,7 @@ export class MovieRelationsResolver { nullable: false }) async director(@TypeGraphQL.Root() movie: Movie, @TypeGraphQL.Ctx() ctx: any): Promise { - return ctx.prisma.movie.findUnique({ + return getPrismaFromContext(ctx).movie.findUnique({ where: { directorFirstName_directorLastName_title: { directorFirstName: movie.directorFirstName, @@ -137,6 +139,7 @@ exports[`relations resolvers generation should properly generate relation resolv import { Director } from \\"../../../models/Director\\"; import { Movie } from \\"../../../models/Movie\\"; import { DirectorMoviesArgs } from \\"./args/DirectorMoviesArgs\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => Director) export class DirectorRelationsResolver { @@ -144,7 +147,7 @@ export class DirectorRelationsResolver { nullable: false }) async movies(@TypeGraphQL.Root() director: Director, @TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DirectorMoviesArgs): Promise { - return ctx.prisma.director.findUnique({ + return getPrismaFromContext(ctx).director.findUnique({ where: { firstName_lastName: { firstName: director.firstName, @@ -161,6 +164,7 @@ exports[`relations resolvers generation should properly generate relation resolv "import * as TypeGraphQL from \\"type-graphql\\"; import { Post } from \\"../../../models/Post\\"; import { User } from \\"../../../models/User\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => Post) export class PostRelationsResolver { @@ -168,7 +172,7 @@ export class PostRelationsResolver { nullable: true }) async author(@TypeGraphQL.Root() post: Post, @TypeGraphQL.Ctx() ctx: any): Promise { - return ctx.prisma.post.findUnique({ + return getPrismaFromContext(ctx).post.findUnique({ where: { uuid: post.uuid, }, @@ -183,6 +187,7 @@ exports[`relations resolvers generation should properly generate relation resolv import { Post } from \\"../../../models/Post\\"; import { User } from \\"../../../models/User\\"; import { UserPostsArgs } from \\"./args/UserPostsArgs\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class UserRelationsResolver { @@ -190,7 +195,7 @@ export class UserRelationsResolver { nullable: false }) async posts(@TypeGraphQL.Root() user: User, @TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UserPostsArgs): Promise { - return ctx.prisma.user.findUnique({ + return getPrismaFromContext(ctx).user.findUnique({ where: { id: user.id, }, @@ -204,6 +209,7 @@ exports[`relations resolvers generation should properly generate relation resolv "import * as TypeGraphQL from \\"type-graphql\\"; import { Post } from \\"../../../models/Post\\"; import { User } from \\"../../../models/User\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => Post) export class PostRelationsResolver { @@ -212,7 +218,7 @@ export class PostRelationsResolver { description: \\"author field doc\\" }) async postAuthor(@TypeGraphQL.Root() post: Post, @TypeGraphQL.Ctx() ctx: any): Promise { - return ctx.prisma.post.findUnique({ + return getPrismaFromContext(ctx).post.findUnique({ where: { uuid: post.uuid, }, @@ -227,6 +233,7 @@ exports[`relations resolvers generation should properly generate relation resolv import { Post } from \\"../../../models/Post\\"; import { User } from \\"../../../models/User\\"; import { UserPostsArgs } from \\"./args/UserPostsArgs\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class UserRelationsResolver { @@ -234,7 +241,7 @@ export class UserRelationsResolver { nullable: false }) async userPosts(@TypeGraphQL.Root() user: User, @TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UserPostsArgs): Promise { - return ctx.prisma.user.findUnique({ + return getPrismaFromContext(ctx).user.findUnique({ where: { id: user.id, }, @@ -292,6 +299,7 @@ exports[`relations resolvers generation should properly generate resolver and ar import { Post } from \\"../../../models/Post\\"; import { User } from \\"../../../models/User\\"; import { UserPostsArgs } from \\"./args/UserPostsArgs\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class UserRelationsResolver { @@ -299,7 +307,7 @@ export class UserRelationsResolver { nullable: false }) async posts(@TypeGraphQL.Root() user: User, @TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UserPostsArgs): Promise { - return ctx.prisma.user.findUnique({ + return getPrismaFromContext(ctx).user.findUnique({ where: { id: user.id, }, @@ -313,6 +321,7 @@ exports[`relations resolvers generation should properly generate resolver class "import * as TypeGraphQL from \\"type-graphql\\"; import { Address } from \\"../../../models/Address\\"; import { User } from \\"../../../models/User\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class UserRelationsResolver { @@ -320,7 +329,7 @@ export class UserRelationsResolver { nullable: true }) async address(@TypeGraphQL.Root() user: User, @TypeGraphQL.Ctx() ctx: any): Promise
{ - return ctx.prisma.user.findUnique({ + return getPrismaFromContext(ctx).user.findUnique({ where: { id: user.id, }, @@ -334,6 +343,7 @@ exports[`relations resolvers generation should properly generate resolvers class "import * as TypeGraphQL from \\"type-graphql\\"; import { Post } from \\"../../../models/Post\\"; import { User } from \\"../../../models/User\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => Post) export class PostRelationsResolver { @@ -342,7 +352,7 @@ export class PostRelationsResolver { description: \\"author field doc\\" }) async author(@TypeGraphQL.Root() post: Post, @TypeGraphQL.Ctx() ctx: any): Promise { - return ctx.prisma.post.findUnique({ + return getPrismaFromContext(ctx).post.findUnique({ where: { uuid: post.uuid, }, @@ -357,6 +367,7 @@ exports[`relations resolvers generation should properly generate resolvers class import { Post } from \\"../../../models/Post\\"; import { User } from \\"../../../models/User\\"; import { UserPostsArgs } from \\"./args/UserPostsArgs\\"; +import { transformFields, getPrismaFromContext } from \\"../../../helpers\\"; @TypeGraphQL.Resolver(_of => User) export class UserRelationsResolver { @@ -364,7 +375,7 @@ export class UserRelationsResolver { nullable: false }) async posts(@TypeGraphQL.Root() user: User, @TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UserPostsArgs): Promise { - return ctx.prisma.user.findUnique({ + return getPrismaFromContext(ctx).user.findUnique({ where: { id: user.id, },