-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add checking if prisma is provided in context
- Loading branch information
1 parent
3b4c3b8
commit 4311dce
Showing
132 changed files
with
589 additions
and
480 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
experiments/prisma/generated/type-graphql/resolvers/crud/Category/CreateCategoryResolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
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 { | ||
@TypeGraphQL.Mutation(_returns => Category, { | ||
nullable: false | ||
}) | ||
async createCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: CreateCategoryArgs): Promise<Category> { | ||
return ctx.prisma.category.create(args); | ||
return getPrismaFromContext(ctx).category.create(args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
experiments/prisma/generated/type-graphql/resolvers/crud/Category/DeleteCategoryResolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
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 { | ||
@TypeGraphQL.Mutation(_returns => Category, { | ||
nullable: true | ||
}) | ||
async deleteCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: DeleteCategoryArgs): Promise<Category | null> { | ||
return ctx.prisma.category.delete(args); | ||
return getPrismaFromContext(ctx).category.delete(args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...iments/prisma/generated/type-graphql/resolvers/crud/Category/FindFirstCategoryResolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
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 { | ||
@TypeGraphQL.Query(_returns => Category, { | ||
nullable: true | ||
}) | ||
async findFirstCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindFirstCategoryArgs): Promise<Category | null> { | ||
return ctx.prisma.category.findFirst(args); | ||
return getPrismaFromContext(ctx).category.findFirst(args); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...riments/prisma/generated/type-graphql/resolvers/crud/Category/FindManyCategoryResolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
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 { | ||
@TypeGraphQL.Query(_returns => [Category], { | ||
nullable: false | ||
}) | ||
async categories(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindManyCategoryArgs): Promise<Category[]> { | ||
return ctx.prisma.category.findMany(args); | ||
return getPrismaFromContext(ctx).category.findMany(args); | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
...ments/prisma/generated/type-graphql/resolvers/crud/Category/FindUniqueCategoryResolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
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 { | ||
@TypeGraphQL.Query(_returns => Category, { | ||
nullable: true | ||
}) | ||
async category(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: FindUniqueCategoryArgs): Promise<Category | null> { | ||
return ctx.prisma.category.findUnique(args); | ||
return getPrismaFromContext(ctx).category.findUnique(args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
experiments/prisma/generated/type-graphql/resolvers/crud/Category/UpdateCategoryResolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
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 { | ||
@TypeGraphQL.Mutation(_returns => Category, { | ||
nullable: true | ||
}) | ||
async updateCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpdateCategoryArgs): Promise<Category | null> { | ||
return ctx.prisma.category.update(args); | ||
return getPrismaFromContext(ctx).category.update(args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
experiments/prisma/generated/type-graphql/resolvers/crud/Category/UpsertCategoryResolver.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
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 { | ||
@TypeGraphQL.Mutation(_returns => Category, { | ||
nullable: false | ||
}) | ||
async upsertCategory(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Args() args: UpsertCategoryArgs): Promise<Category> { | ||
return ctx.prisma.category.upsert(args); | ||
return getPrismaFromContext(ctx).category.upsert(args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.