import * as TypeGraphQL from "type-graphql"; import type { GraphQLResolveInfo } from "graphql"; import { FindFirstCompanyOrThrowArgs } from "./args/FindFirstCompanyOrThrowArgs"; import { Company } from "../../../models/Company"; import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers"; @TypeGraphQL.Resolver(_of => Company) export class FindFirstCompanyOrThrowResolver { @TypeGraphQL.Query(_returns => Company, { nullable: true }) async findFirstCompanyOrThrow(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: FindFirstCompanyOrThrowArgs): Promise { const { _count } = transformInfoIntoPrismaArgs(info); return getPrismaFromContext(ctx).company.findFirstOrThrow({ ...args, ...(_count && transformCountFieldIntoSelectRelationsCount(_count)), }); } }