I created a custom DTO named UploadedInvestmentDocumentInput
and linked it to the expectedInvestmentSupportInfo
property, but an error is occurring:
uncaughtException: Cannot determine a GraphQL output type for the "expectedInvestmentSupportInfo".
Make sure your class is decorated with an appropriate decorator.
Error: Cannot determine a GraphQL output type for the "expectedInvestmentSupportInfo".
Make sure your class is decorated with an appropriate decorator.
opportunity-account.input.ts
import { UploadedDocumentInput } from '@app/dto/common.input';
import {
Field,
InputType, OmitType, PickType, registerEnumType,
} from '@nestjs/graphql';
import { Type } from 'class-transformer';
import { IsEnum, ValidateNested } from 'class-validator';
import {
ExpectedInvestmentSupportInfoType,
SourceOfFundsType,
} from '@/generated-cbms-api-client';
import { OpportunityAccount } from './opportunity-account.response';
registerEnumType(SourceOfFundsType, { name: 'SourceOfFundsType' });
registerEnumType(ExpectedInvestmentSupportInfoType, { name: 'ExpectedInvestmentSupportInfoType' });
@InputType()
export class UploadedInvestmentDocumentInput extends OmitType(UploadedDocumentInput, ['documentType'], InputType) {
@IsEnum(ExpectedInvestmentSupportInfoType)
@Field(() => ExpectedInvestmentSupportInfoType)
documentType: ExpectedInvestmentSupportInfoType;
}
@InputType()
export class UpsertAnticipatedInvestmentActivitiesInput extends PickType(
OpportunityAccount,
[
'isPlanningInvestIn12Months',
'anticipatedInvestmentOpportunitiesCountRange',
'investmentDescription',
],
InputType,
) {
@ValidateNested({ each: true })
@Type(() => UploadedInvestmentDocumentInput)
@Field(() => [UploadedInvestmentDocumentInput], { description: 'Expected investment support info' })
expectedInvestmentSupportInfo: UploadedInvestmentDocumentInput[];
}
UploadedDocumentInput ( common DTO )
import { Field, InputType } from '@nestjs/graphql';
import { FileUpload, GraphQLUpload } from 'graphql-upload';
@InputType()
export class UploadedDocumentInput {
@Field(() => Number)
documentType: number;
@Field(() => GraphQLUpload)
frontSideDoc: FileUpload;
@Field(() => GraphQLUpload, { nullable: true })
backSideDoc?: FileUpload;
}
opportunity-account.output.ts
class UploadedInvestmentDocumentResponse extends OmitType(UploadedDocumentResponse, ['documentType'], InputType) {
@IsEnum(ExpectedInvestmentSupportInfoType)
@Field(() => ExpectedInvestmentSupportInfoType)
documentType: ExpectedInvestmentSupportInfoType;
}
@ObjectType()
export class OpportunityAccount extends AccountsCommonDetails {
@IsMongoId()
@Field(() => String, { description: 'Customer id' })
customerId: string;
// I believe issue is here ( when I commented out the field below, this error vanished !)
@IsEnum(UploadedInvestmentDocumentResponse)
@ValidateNested({ each: true })
@Type(() => UploadedInvestmentDocumentResponse)
@Field(() => [UploadedInvestmentDocumentResponse], { description: 'Expected investment support info' })
expectedInvestmentSupportInfo: UploadedInvestmentDocumentResponse[];
}
What decorator or property am I missing that is causing the above error to appear?