작성
·
294
0
nestjs를 리용하여 microservice를 만들고 있는데 gateway를 통하여 하위앱들에 접근하고 있습니다.
applications- app에서 정의한 스키마 schoolyear.entity.ts를 users-app, students-app등 다른 여러 app 들에서 사용하려고 합니다.
//application-app
@ObjectType()
@Directive(
'@key(fields: "school_year_id, date_begin, date_end")',
)
@Entity({ name: 'mth_schoolyear' })
export class SchoolYear extends BaseEntity {
@Column()
@Field(() => ID, { nullable: true })
@PrimaryGeneratedColumn()
school_year_id?: number;
@Column()
@Field(() => Date, { nullable: true })
date_begin: Date;
@Column()
@Field(() => Date, { nullable: true })
date_end: Date;
}
//users-app
@ObjectType()
@Directive('@extends')
@Directive(
'@key(fields: "school_year_id , date_begin, date_end")',
)
@Entity({ name: 'mth_schoolyear' })
export class SchoolYear extends BaseEntity {
@Column()
@Field(() => ID, { nullable: true })
@PrimaryGeneratedColumn()
@Directive('@external')
school_year_id?: number;
@Column()
@Field(() => Date, { nullable: true })
@Directive('@external')
date_begin: Date;
@Column()
@Field(() => Date, { nullable: true })
@Directive('@external')
date_end: Date;
}
//students-app
@ObjectType()
@Directive('@extends')
@Directive(
'@key(fields: "school_year_id , date_begin, date_end")',
)
@Entity({ name: 'mth_schoolyear' })
export class SchoolYear extends BaseEntity {
@Column()
@Field(() => ID, { nullable: true })
@PrimaryGeneratedColumn()
@Directive('@external')
school_year_id?: number;
@Column()
@Field(() => Date, { nullable: true })
@Directive('@external')
date_begin: Date;
@Column()
@Field(() => Date, { nullable: true })
@Directive('@external')
date_end: Date;
}
1. @Directive(@key(fields)) 와 @Directive('@external') 사이에 어떤 관계가 있는지?
@Directive('@external')가 정의된 모든 field를 @Directive(@key(fields))에 정의해야 합니까?
2. Users-app에서 정의한 external field "date_begin", "date_end"가 stuents-app에도 중복존재하는데 오유가 아닙니까?