Friday
13 hours ago
Given this schema:
entity Books {
key ID : UUID;
title : String;
description : String;
stock : Integer;
reorderPoint : Integer;
statusCode : String;
price : Integer;
to_Chapters : Composition of many Chapters
on to_Chapters.to_Books = $self
}
entity Chapters {
key ID : UUID;
title : String;
to_Books : Association to Books
}
Some code like:
const payload = {
title: "201",
stock: 1,
description: "capval 3",
price: 3,
statusCode: "A",
reorderPoint: 6,
to_Chapters: [
{
title: "Introduction",
},
],
};
await cds.tx(req).run(INSERT.into(Books).entries(payload))