21 lines
982 B
TypeScript
21 lines
982 B
TypeScript
import * as TypeGraphQL from "type-graphql";
|
|
import type { GraphQLResolveInfo } from "graphql";
|
|
import { CreateManyCompanyArgs } from "./args/CreateManyCompanyArgs";
|
|
import { Company } from "../../../models/Company";
|
|
import { AffectedRowsOutput } from "../../outputs/AffectedRowsOutput";
|
|
import { transformInfoIntoPrismaArgs, getPrismaFromContext, transformCountFieldIntoSelectRelationsCount } from "../../../helpers";
|
|
|
|
@TypeGraphQL.Resolver(_of => Company)
|
|
export class CreateManyCompanyResolver {
|
|
@TypeGraphQL.Mutation(_returns => AffectedRowsOutput, {
|
|
nullable: false
|
|
})
|
|
async createManyCompany(@TypeGraphQL.Ctx() ctx: any, @TypeGraphQL.Info() info: GraphQLResolveInfo, @TypeGraphQL.Args() args: CreateManyCompanyArgs): Promise<AffectedRowsOutput> {
|
|
const { _count } = transformInfoIntoPrismaArgs(info);
|
|
return getPrismaFromContext(ctx).company.createMany({
|
|
...args,
|
|
...(_count && transformCountFieldIntoSelectRelationsCount(_count)),
|
|
});
|
|
}
|
|
}
|