Open MaxLiu0325 opened 1 year ago
@royib Yep, duplicated fields not looks good...
// books.entity.ts
export class Book {
title: string;
author: Author;
genre: Genre;
publishDate: Date;
}
// mongo schema with the same fields
@Schema()
export class Book {
@Prop({ required: true, unique: true })
title: string;
@Prop({ type: mongoose.Schema.Types.ObjectId, ref: 'Author', required: true })
author: Author;
@Prop({ type: mongoose.Schema.Types.ObjectId, ref: 'Genre', required: true })
genre: Genre;
@Prop()
publishDate: Date;
}
Hi, I have some questions src/core/entities/book.entity.ts
and
src/frameworks/data-services/mongo/model/book.model.ts
Is it possible to merge?
If use typeorm don't need implement IGenericRepository?
thanks