Skip to content

Commit

Permalink
feat(graphql): update to Prisma v5.5.2
Browse files Browse the repository at this point in the history
undefined
  • Loading branch information
ZenSoftware committed Nov 5, 2023
1 parent e2f09a8 commit d2183cf
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 121 deletions.
33 changes: 10 additions & 23 deletions apps/api/src/app/graphql/resolvers/prisma/User.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { UseGuards } from '@nestjs/common';
import { Args, Info, Mutation, Parent, Query, ResolveField, Resolver } from '@nestjs/graphql';
import type { NonNullableFields } from '@zen/common';
import { RolesGuard } from '@zen/nest-auth';
import { GraphQLResolveInfo } from 'graphql';
import gql from 'graphql-tag';
Expand Down Expand Up @@ -47,18 +46,12 @@ export class UserResolver {
}

@Query()
async findUniqueUser(
@Args() args: NonNullableFields<FindUniqueUserArgs>,
@Info() info: GraphQLResolveInfo
) {
async findUniqueUser(@Args() args: FindUniqueUserArgs, @Info() info: GraphQLResolveInfo) {
return this.prisma.user.findUnique(this.prismaSelect.getArgs(info, args));
}

@Query()
async findFirstUser(
@Args() args: NonNullableFields<FindFirstUserArgs>,
@Info() info: GraphQLResolveInfo
) {
async findFirstUser(@Args() args: FindFirstUserArgs, @Info() info: GraphQLResolveInfo) {
return this.prisma.user.findFirst(this.prismaSelect.getArgs(info, args));
}

Expand All @@ -69,7 +62,7 @@ export class UserResolver {

@Query()
async findManyUserCount(@Args() args: FindManyUserArgs, @Info() info: GraphQLResolveInfo) {
return this.prisma.user.count(this.prismaSelect.getArgs(info, args));
return this.prisma.user.count(this.prismaSelect.getArgs(info, args) as any);
}

@Query()
Expand All @@ -83,16 +76,13 @@ export class UserResolver {
}

@Mutation()
async updateOneUser(
@Args() args: NonNullableFields<UpdateOneUserArgs>,
@Info() info: GraphQLResolveInfo
) {
async updateOneUser(@Args() args: UpdateOneUserArgs, @Info() info: GraphQLResolveInfo) {
return this.prisma.user.update(this.prismaSelect.getArgs(info, args));
}

@Mutation()
async updateManyUser(@Args() args: UpdateManyUserArgs, @Info() info: GraphQLResolveInfo) {
return this.prisma.user.updateMany(this.prismaSelect.getArgs(info, args));
async deleteOneUser(@Args() args: DeleteOneUserArgs, @Info() info: GraphQLResolveInfo) {
return this.prisma.user.delete(this.prismaSelect.getArgs(info, args));
}

@Mutation()
Expand All @@ -101,15 +91,12 @@ export class UserResolver {
}

@Mutation()
async deleteOneUser(
@Args() args: NonNullableFields<DeleteOneUserArgs>,
@Info() info: GraphQLResolveInfo
) {
return this.prisma.user.delete(this.prismaSelect.getArgs(info, args));
async deleteManyUser(@Args() args: DeleteManyUserArgs, @Info() info: GraphQLResolveInfo) {
return this.prisma.user.deleteMany(this.prismaSelect.getArgs(info, args));
}

@Mutation()
async deleteManyUser(@Args() args: DeleteManyUserArgs, @Info() info: GraphQLResolveInfo) {
return this.prisma.user.deleteMany(this.prismaSelect.getArgs(info, args));
async updateManyUser(@Args() args: UpdateManyUserArgs, @Info() info: GraphQLResolveInfo) {
return this.prisma.user.updateMany(this.prismaSelect.getArgs(info, args));
}
}
52 changes: 26 additions & 26 deletions libs/graphql/src/lib/apollo-angular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -914,13 +914,12 @@ export type UpdateOneUserVariables = Exact<{

export type UpdateOneUser = { __typename?: 'Mutation', updateOneUser: { __typename?: 'User', id: string, username?: string | null, email: string } };

export type UpdateManyUserVariables = Exact<{
data: UserUpdateManyMutationInput;
where: UserWhereInput;
export type DeleteOneUserVariables = Exact<{
where: UserWhereUniqueInput;
}>;


export type UpdateManyUser = { __typename?: 'Mutation', updateManyUser?: { __typename?: 'BatchPayload', count: number } | null };
export type DeleteOneUser = { __typename?: 'Mutation', deleteOneUser?: { __typename?: 'User', id: string } | null };

export type UpsertOneUserVariables = Exact<{
where: UserWhereUniqueInput;
Expand All @@ -931,19 +930,20 @@ export type UpsertOneUserVariables = Exact<{

export type UpsertOneUser = { __typename?: 'Mutation', upsertOneUser?: { __typename?: 'User', id: string, username?: string | null, email: string } | null };

export type DeleteOneUserVariables = Exact<{
where: UserWhereUniqueInput;
export type DeleteManyUserVariables = Exact<{
where: UserWhereInput;
}>;


export type DeleteOneUser = { __typename?: 'Mutation', deleteOneUser?: { __typename?: 'User', id: string } | null };
export type DeleteManyUser = { __typename?: 'Mutation', deleteManyUser?: { __typename?: 'BatchPayload', count: number } | null };

export type DeleteManyUserVariables = Exact<{
export type UpdateManyUserVariables = Exact<{
data: UserUpdateManyMutationInput;
where: UserWhereInput;
}>;


export type DeleteManyUser = { __typename?: 'Mutation', deleteManyUser?: { __typename?: 'BatchPayload', count: number } | null };
export type UpdateManyUser = { __typename?: 'Mutation', updateManyUser?: { __typename?: 'BatchPayload', count: number } | null };

export type SampleSubscriptionVariables = Exact<{ [key: string]: never; }>;

Expand Down Expand Up @@ -1254,19 +1254,19 @@ export const UpdateOneUserDocument = /*#__PURE__*/ gql`
super(apollo);
}
}
export const UpdateManyUserDocument = /*#__PURE__*/ gql`
mutation UpdateManyUser($data: UserUpdateManyMutationInput!, $where: UserWhereInput!) {
updateManyUser(data: $data, where: $where) {
count
export const DeleteOneUserDocument = /*#__PURE__*/ gql`
mutation DeleteOneUser($where: UserWhereUniqueInput!) {
deleteOneUser(where: $where) {
id
}
}
`;

@Injectable({
providedIn: ZenGraphQLModule
})
export class UpdateManyUserGQL extends Apollo.Mutation<UpdateManyUser, UpdateManyUserVariables> {
override document = UpdateManyUserDocument;
export class DeleteOneUserGQL extends Apollo.Mutation<DeleteOneUser, DeleteOneUserVariables> {
override document = DeleteOneUserDocument;

constructor(apollo: Apollo.Apollo) {
super(apollo);
Expand All @@ -1290,27 +1290,27 @@ export const UpsertOneUserDocument = /*#__PURE__*/ gql`
super(apollo);
}
}
export const DeleteOneUserDocument = /*#__PURE__*/ gql`
mutation DeleteOneUser($where: UserWhereUniqueInput!) {
deleteOneUser(where: $where) {
id
export const DeleteManyUserDocument = /*#__PURE__*/ gql`
mutation DeleteManyUser($where: UserWhereInput!) {
deleteManyUser(where: $where) {
count
}
}
`;

@Injectable({
providedIn: ZenGraphQLModule
})
export class DeleteOneUserGQL extends Apollo.Mutation<DeleteOneUser, DeleteOneUserVariables> {
override document = DeleteOneUserDocument;
export class DeleteManyUserGQL extends Apollo.Mutation<DeleteManyUser, DeleteManyUserVariables> {
override document = DeleteManyUserDocument;

constructor(apollo: Apollo.Apollo) {
super(apollo);
}
}
export const DeleteManyUserDocument = /*#__PURE__*/ gql`
mutation DeleteManyUser($where: UserWhereInput!) {
deleteManyUser(where: $where) {
export const UpdateManyUserDocument = /*#__PURE__*/ gql`
mutation UpdateManyUser($data: UserUpdateManyMutationInput!, $where: UserWhereInput!) {
updateManyUser(data: $data, where: $where) {
count
}
}
Expand All @@ -1319,8 +1319,8 @@ export const DeleteManyUserDocument = /*#__PURE__*/ gql`
@Injectable({
providedIn: ZenGraphQLModule
})
export class DeleteManyUserGQL extends Apollo.Mutation<DeleteManyUser, DeleteManyUserVariables> {
override document = DeleteManyUserDocument;
export class UpdateManyUserGQL extends Apollo.Mutation<UpdateManyUser, UpdateManyUserVariables> {
override document = UpdateManyUserDocument;

constructor(apollo: Apollo.Apollo) {
super(apollo);
Expand Down
16 changes: 8 additions & 8 deletions libs/graphql/src/lib/prisma/User.gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ export default gql`
}
}
mutation UpdateManyUser($data: UserUpdateManyMutationInput!, $where: UserWhereInput!) {
updateManyUser(data: $data, where: $where) {
count
mutation DeleteOneUser($where: UserWhereUniqueInput!) {
deleteOneUser(where: $where) {
id
}
}
Expand All @@ -95,14 +95,14 @@ export default gql`
}
}
mutation DeleteOneUser($where: UserWhereUniqueInput!) {
deleteOneUser(where: $where) {
id
mutation DeleteManyUser($where: UserWhereInput!) {
deleteManyUser(where: $where) {
count
}
}
mutation DeleteManyUser($where: UserWhereInput!) {
deleteManyUser(where: $where) {
mutation UpdateManyUser($data: UserUpdateManyMutationInput!, $where: UserWhereInput!) {
updateManyUser(data: $data, where: $where) {
count
}
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@nestjs/platform-express": "^10.2.8",
"@nestjs/throttler": "^5.0.1",
"@paljs/plugins": "6.0.7",
"@prisma/client": "~5.4.2",
"@prisma/client": "~5.5.2",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"dotenv": "^16.3.1",
Expand All @@ -50,7 +50,7 @@
"passport": "^0.6.0",
"passport-google-oauth20": "^2.0.0",
"passport-jwt": "^4.0.1",
"prisma": "~5.4.2",
"prisma": "~5.5.2",
"reflect-metadata": "^0.1.13",
"rxjs": "~7.8.1",
"tslib": "^2.6.2"
Expand Down
49 changes: 22 additions & 27 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d2183cf

Please sign in to comment.