Compare commits
1 Commits
main
...
reproduce-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
73f438d3c0 |
@@ -10,12 +10,22 @@
|
||||
//
|
||||
using { sap.capire.bookshop.Books } from '@capire/bookshop';
|
||||
using { ReviewsService.Reviews } from '@capire/reviews';
|
||||
using { managed, cuid } from '@sap/cds/common';
|
||||
|
||||
extend Books with {
|
||||
reviews : Composition of many Reviews on reviews.subject = $self.ID;
|
||||
rating : type of Reviews:rating; // average rating
|
||||
numberOfReviews : Integer @title : '{i18n>NumberOfReviews}';
|
||||
Y_characteristics : Composition of many Y_Characteristic on Y_characteristics.parent = $self;
|
||||
}
|
||||
|
||||
entity Y_Characteristic : cuid, managed {
|
||||
parent : Association to one Books;
|
||||
characteristicId : String;
|
||||
name : String;
|
||||
value : String;
|
||||
uom : String;
|
||||
}
|
||||
|
||||
//
|
||||
// Extend Orders with Books as Products
|
||||
|
||||
@@ -79,3 +79,36 @@ Authorization: Basic alice:
|
||||
"dateOfBirth": "1564-04-26",
|
||||
"dateOfDeath": "1616-04-23"
|
||||
}
|
||||
|
||||
### Create book
|
||||
POST {{bookshop}}/admin/Books
|
||||
Content-Type: application/json
|
||||
Authorization: Basic alice:
|
||||
|
||||
{
|
||||
"ID": 291,
|
||||
"title": "Ttile1",
|
||||
"author_ID": 107,
|
||||
"numberOfReviews": 3,
|
||||
"Y_characteristics": [{
|
||||
"ID": "e326afd9-4688-4bf5-9664-783ff997cdf5",
|
||||
"characteristicId": "myid",
|
||||
"name": "myname"
|
||||
}]
|
||||
}
|
||||
|
||||
### Update book
|
||||
PUT {{bookshop}}/admin/Books(291)
|
||||
Content-Type: application/json
|
||||
Authorization: Basic alice:
|
||||
|
||||
{
|
||||
"title": "Ttile111111111",
|
||||
"author_ID": 107,
|
||||
"numberOfReviews": 4,
|
||||
"Y_characteristics": [{
|
||||
"ID": "e326afd9-4688-4bf5-9664-783ff997cdf5",
|
||||
"characteristicId": "myid123",
|
||||
"name": "myname123"
|
||||
}]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user