When it comes to the business logic of a model, there are different approaches depending on whether the entity should be expanded or just have IDs in the model. For instance:
class Order{
id:string;
product:Product
}
class Product{
id:string;
name:string;
price:number:
}
For the order response, the product can either be an expanded object or just the ID if complete data has not been requested. So how should one handle this in a TypeScript model? Is using a union on the order model considered good practice or should separate models be used?