CAA160 exercise 3 final state
This commit is contained in:
30
bookstore/db/schema.cds
Normal file
30
bookstore/db/schema.cds
Normal file
@@ -0,0 +1,30 @@
|
||||
namespace sap.capire.bookstore;
|
||||
|
||||
using { Currency, cuid, managed } from '@sap/cds/common';
|
||||
using { sap.capire.products.Products } from '@sap/capire-products';
|
||||
|
||||
entity Books as projection on Products; extend Products with {
|
||||
// Note: we map Books to Products to allow reusing AdminService as is
|
||||
author : Association to Authors;
|
||||
}
|
||||
|
||||
entity Authors : cuid {
|
||||
firstname : String(111);
|
||||
lastname : String(111);
|
||||
books : Association to many Books on books.author = $self;
|
||||
}
|
||||
|
||||
@Capabilities.Updatable: false
|
||||
entity Orders : cuid, managed {
|
||||
items : Composition of many OrderItems on items.parent = $self;
|
||||
total : Decimal(9,2) @readonly;
|
||||
currency : Currency;
|
||||
}
|
||||
|
||||
@Capabilities.Updatable: false
|
||||
entity OrderItems : cuid {
|
||||
parent : Association to Orders not null;
|
||||
book_ID : UUID;
|
||||
amount : Integer;
|
||||
netAmount : Decimal(9,2) @readonly;
|
||||
}
|
||||
Reference in New Issue
Block a user