From 33380c07920a82bf8f377c5f81b8e0ee736c62f0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 24 Nov 2021 19:29:27 +0100 Subject: [PATCH] Restore simple bookshop - no workarounds Signed-off-by: Daniel --- bookshop/srv/admin-service.cds | 4 --- bookshop/srv/cat-service.cds | 50 ++++++++-------------------------- 2 files changed, 12 insertions(+), 42 deletions(-) diff --git a/bookshop/srv/admin-service.cds b/bookshop/srv/admin-service.cds index abbdeaf5..ea9b0731 100644 --- a/bookshop/srv/admin-service.cds +++ b/bookshop/srv/admin-service.cds @@ -3,7 +3,3 @@ service AdminService @(requires:'admin') { entity Books as projection on my.Books; entity Authors as projection on my.Authors; } - -//Since ID is computed, we can hide the popup for ID on Create -annotate AdminService.Books with { ID @Core.Computed; } -annotate AdminService.Authors with { ID @Core.Computed; } \ No newline at end of file diff --git a/bookshop/srv/cat-service.cds b/bookshop/srv/cat-service.cds index 223b045a..4cc44dff 100644 --- a/bookshop/srv/cat-service.cds +++ b/bookshop/srv/cat-service.cds @@ -1,42 +1,16 @@ -using {sap.capire.bookshop as my} from '../db/schema'; +using { sap.capire.bookshop as my } from '../db/schema'; +service CatalogService @(path:'/browse') { -service CatalogService @(path : '/browse') { + /** For displaying lists of Books */ + @readonly entity ListOfBooks as projection on Books + excluding { descr }; - /** - * For displaying lists of Books - */ - @readonly - entity ListOfBooks as projection on Books excluding { - descr - }; + /** For display in details pages */ + @readonly entity Books as projection on my.Books { *, + author.name as author + } excluding { createdBy, modifiedBy }; - /** - * For display in details pages - */ - @readonly - entity Books as projection on my.Books { - * , author.name as authorName - } excluding { - createdBy, - modifiedBy - }; - - @readonly - entity Authors as projection on my.Authors { - * , books : redirected to Books - } excluding { - createdBy, - modifiedBy - }; - - @requires : 'authenticated-user' - action submitOrder(book : Books:ID, quantity : Integer) returns { - stock : Integer - }; - - event OrderedBook : { - book : Books:ID; - quantity : Integer; - buyer : String - }; + @requires: 'authenticated-user' + action submitOrder ( book: Books:ID, amount: Integer ) returns { stock: Integer }; + event OrderedBook : { book: Books:ID; amount: Integer; buyer: String }; }