Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 33380c0

Browse files
committed
Restore simple bookshop - no workarounds
Signed-off-by: Daniel <daniel.hutzel@sap.com>
1 parent 0d5b65d commit 33380c0

2 files changed

Lines changed: 12 additions & 42 deletions

File tree

bookshop/srv/admin-service.cds

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,3 @@ service AdminService @(requires:'admin') {
33
entity Books as projection on my.Books;
44
entity Authors as projection on my.Authors;
55
}
6-
7-
//Since ID is computed, we can hide the popup for ID on Create
8-
annotate AdminService.Books with { ID @Core.Computed; }
9-
annotate AdminService.Authors with { ID @Core.Computed; }

bookshop/srv/cat-service.cds

Lines changed: 12 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,16 @@
1-
using {sap.capire.bookshop as my} from '../db/schema';
1+
using { sap.capire.bookshop as my } from '../db/schema';
2+
service CatalogService @(path:'/browse') {
23

3-
service CatalogService @(path : '/browse') {
4+
/** For displaying lists of Books */
5+
@readonly entity ListOfBooks as projection on Books
6+
excluding { descr };
47

5-
/**
6-
* For displaying lists of Books
7-
*/
8-
@readonly
9-
entity ListOfBooks as projection on Books excluding {
10-
descr
11-
};
8+
/** For display in details pages */
9+
@readonly entity Books as projection on my.Books { *,
10+
author.name as author
11+
} excluding { createdBy, modifiedBy };
1212

13-
/**
14-
* For display in details pages
15-
*/
16-
@readonly
17-
entity Books as projection on my.Books {
18-
* , author.name as authorName
19-
} excluding {
20-
createdBy,
21-
modifiedBy
22-
};
23-
24-
@readonly
25-
entity Authors as projection on my.Authors {
26-
* , books : redirected to Books
27-
} excluding {
28-
createdBy,
29-
modifiedBy
30-
};
31-
32-
@requires : 'authenticated-user'
33-
action submitOrder(book : Books:ID, quantity : Integer) returns {
34-
stock : Integer
35-
};
36-
37-
event OrderedBook : {
38-
book : Books:ID;
39-
quantity : Integer;
40-
buyer : String
41-
};
13+
@requires: 'authenticated-user'
14+
action submitOrder ( book: Books:ID, amount: Integer ) returns { stock: Integer };
15+
event OrderedBook : { book: Books:ID; amount: Integer; buyer: String };
4216
}

0 commit comments

Comments
 (0)