I’m a Newbie Backend Developer of Nodejs
I Have questions when using Backend Programming with nestjs and prisma
Most of books, lectures(videos), people related to programming says “Business logic should be placed on the entity” but prisma’s model generate interface
Then How can i write business logic on entity? it’s not Class
When i use typeorm, entity is class. and i write business logic on entity class
There are my thoughts
1
use implments with prisma’s type
export default class Tag extends BaseEntity implements tags {
constructor(data: Tag) {
super();
this.id = data.id;
this.name = data.name;
}
id: number;
name: string;
}
but it’s not best way, cuz if when i use another orm, i need to modify all entities
i think it’s anti pattern
I need to advice of backend programming
Please share your advice on the matter