小编Chr*_*les的帖子

无法确定名为 的参数的 GraphQL 输入类型

我有两个相关模型:

1.- 角色实体

import { Column, Entity, BaseEntity, OneToMany, PrimaryColumn } from "typeorm";
import { Field, ObjectType } from "type-graphql";

import { UserEntity } from "./user.entity";


@ObjectType()
@Entity({
    name: "tb_roles"
})
export class RoleEntity extends BaseEntity {

    @Field()
    @PrimaryColumn({
        name: "id",
        type: "character varying",
        length: 5
    })
    id!: string;

    @Field()
    @Column({
        name: "description",
        type: "character varying",
        nullable: true
    })
    description!: string

    @Field(() => [UserEntity])
    @OneToMany(() => UserEntity, user => user.role)
    users!: UserEntity[];
}
Run Code Online (Sandbox Code Playgroud)

2.- 用户实体

import {Field, ObjectType} from "type-graphql"; …
Run Code Online (Sandbox Code Playgroud)

typescript graphql typeorm typegraphql

8
推荐指数
2
解决办法
1万
查看次数

标签 统计

graphql ×1

typegraphql ×1

typeorm ×1

typescript ×1