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