author.model.ts
539 字节
import { Field, Int, ObjectType } from '@nestjs/graphql';
import { Post } from './post.model';
@ObjectType({ description: 'Author model' })
export class Author {
@Field((type) => Int, {
description: '作者id',
})
id: number;
@Field({
nullable: true,
description: '作者姓氏',
})
firstName?: string;
@Field({
nullable: true,
description: '作者名字',
})
lastName?: string;
@Field((type) => [Post], {
nullable: 'items',
description: '作者发表的文章',
})
posts: Post[];
}