import * as TypeGraphQL from "type-graphql" ; import graphqlFields from "graphql-fields" ; import { GraphQLResolveInfo } from "graphql" ; import { AggregateMovieArgs } from "./args/AggregateMovieArgs" ; import { CreateManyMovieArgs } from "./args/CreateManyMovieArgs" ; import { CreateMovieArgs } from "./args/CreateMovieArgs" ; import { DeleteManyMovieArgs } from "./args/DeleteManyMovieArgs" ; import { DeleteMovieArgs } from "./args/DeleteMovieArgs" ; import { FindFirstMovieArgs } from "./args/FindFirstMovieArgs" ; import { FindManyMovieArgs } from "./args/FindManyMovieArgs" ; import { FindUniqueMovieArgs } from "./args/FindUniqueMovieArgs" ; import { GroupByMovieArgs } from "./args/GroupByMovieArgs" ; import { UpdateManyMovieArgs } from "./args/UpdateManyMovieArgs" ; import { UpdateMovieArgs } from "./args/UpdateMovieArgs" ; import { UpsertMovieArgs } from "./args/UpsertMovieArgs" ; import { transformFields , getPrismaFromContext , transformCountFieldIntoSelectRelationsCount } from "../../../helpers" ; import { Movie } from "../../../models/Movie" ; import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput" ; import { AggregateMovie } from "../../outputs/AggregateMovie" ; import { MovieGroupBy } from "../../outputs/MovieGroupBy" ; @ TypeGraphQL . Resolver ( _of => Movie ) export class MovieCrudResolver { @ TypeGraphQL . Query ( _returns => Movie , { nullable : true } ) async movie ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . movie . findUnique ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Query ( _returns => Movie , { nullable : true } ) async findFirstMovie ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . movie . findFirst ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Query ( _returns => [ Movie ] , { nullable : false } ) async movies ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . movie . findMany ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => Movie , { nullable : false } ) async createMovie ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . movie . create ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => AffectedRowsOutput , { nullable : false } ) async createManyMovie ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . movie . createMany ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => Movie , { nullable : true } ) async deleteMovie ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . movie . delete ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => Movie , { nullable : true } ) async updateMovie ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . movie . update ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => AffectedRowsOutput , { nullable : false } ) async deleteManyMovie ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . movie . deleteMany ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => AffectedRowsOutput , { nullable : false } ) async updateManyMovie ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . movie . updateMany ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Mutation ( _returns => Movie , { nullable : false } ) async upsertMovie ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . movie . upsert ( { ... args , ... ( _count && transformCountFieldIntoSelectRelationsCount ( _count ) ) , } ) ; } @ TypeGraphQL . Query ( _returns => AggregateMovie , { nullable : false } ) async aggregateMovie ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { return getPrismaFromContext ( ctx ) . movie . aggregate ( { ... args , ... transformFields ( graphqlFields ( info as any ) ) , } ) ; } @ TypeGraphQL . Query ( _returns => [ MovieGroupBy ] , { nullable : false } ) async groupByMovie ( @ TypeGraphQL . Ctx ( ) ctx , @ TypeGraphQL . Info ( ) info , @ TypeGraphQL . Args ( ) args ) { const { _count , _avg , _sum , _min , _max } = transformFields ( graphqlFields ( info as any ) ) ; return getPrismaFromContext ( ctx ) . movie . groupBy ( { ... args , ... Object . fromEntries ( Object . entries ( { _count , _avg , _sum , _min , _max } ) . filter ( ( [ _ , v ] ) => v != null ) ) , } ) ; } }