Restore simple bookshop - no workarounds

Signed-off-by: Daniel <daniel.hutzel@sap.com>
This commit is contained in:
Daniel
2021-11-24 19:29:27 +01:00
committed by Daniel Hutzel
parent 0d5b65d93f
commit 33380c0792
2 changed files with 12 additions and 42 deletions

View File

@@ -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; }

View File

@@ -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 };
}