import { Field } from '@nestjs/graphql'; import { InputType } from '@nestjs/graphql'; import * as Scalars from 'graphql-scalars'; import * as Validator from 'class-validator'; import { Int } from '@nestjs/graphql'; import { Float } from '@nestjs/graphql'; import { Decimal } from '@prisma/client/runtime'; import { GraphQLDecimal } from 'prisma-graphql-type-decimal'; import { transformToDecimal } from 'prisma-graphql-type-decimal'; import { Transform } from 'class-transformer'; import { Type } from 'class-transformer'; import { Role } from '../prisma/role.enum'; @InputType() export class UserCreateManyInput { @Field(() => String, {nullable:true}) id?: string; @Field(() => Scalars.GraphQLEmailAddress, {nullable:false}) email!: string; @Field(() => String, {nullable:false}) @Validator.MinLength(3) @Validator.MaxLength(50) name!: string; @Field(() => String, {nullable:false}) password!: string; @Field(() => String, {nullable:true}) bio?: string; @Field(() => String, {nullable:true}) image?: string; @Field(() => Int, {nullable:true}) countComments?: number; @Field(() => Float, {nullable:true}) rating?: number; @Field(() => GraphQLDecimal, {nullable:true}) @Type(() => Object) @Transform(transformToDecimal) money?: Decimal; @Field(() => Role, {nullable:true}) role?: keyof typeof Role; }