Depending on the business logic by model will have the expanded entity or just the ids in the model.Example,
class Order{ id:string; product:Product } class Product{ id:string; name:string; price:number: }
Now in the order response the product will be either expanded object or id if i havent requested the complete data. So how can i handle these in my ts model ? is using union on the order model good practice or should i have two different models ?
Then make the product like
product: string | Product;
Hope I understood your question!
1.4m articles
1.4m replys
5 comments
57.0k users