无法确定statusCode的GraphQL输出类型

时间:2020-11-06 06:31:28

标签: node.js graphql graphql-js

我有一类对象类型

@ObjectType()
export class BusinessRule {
@Field(type => String)
public name: string;

@Field(type => String)
public description: string;

@Field(type => StatusCode)
public statusCode: StatusCode;
}

状态代码是枚举。

export enum StatusCode {
Draft = 1,
Activated = 2
}

这是我的映射文件。

  interface IBusinessRule {
  name: string;
  description: string;
  statusCode: StatusCode;
 }

  export const mapProfile: Partial<Record<keyof BusinessRule, string>> = {
  name: 'name',
  description: 'description',
  statusCode: 'statuscode',
 };

export function map(component: IBusinessRule): BusinessRule {
return Morphism(mapProfile, component, BusinessRule);
}

我在枚举领域面临问题,不知道如何实现。

获取错误“无法确定statusCode的GraphQL输出类型”

0 个答案:

没有答案