add content for openSAP course week1 unit4

This commit is contained in:
d045778
2020-01-30 17:30:03 +01:00
parent 21265e1138
commit d612b7bc0c
9 changed files with 1029 additions and 80 deletions

View File

@@ -1,35 +1,30 @@
namespace sap.capire.bookshop;
using { Currency, managed, cuid } from '@sap/cds/common';
using { Currency, managed } from '@sap/cds/common';
entity Books : managed {
key ID : Integer;
title : localized String(111);
descr : localized String(1111);
author : Association to Authors;
stock : Integer;
price : Decimal(9,2);
key ID : Integer;
title : localized String(111);
descr : localized String(1111);
author : Association to Authors;
stock : Integer;
price : Decimal(9,2);
currency : Currency;
}
entity Authors : managed {
key ID : Integer;
name : String(111);
dateOfBirth : Date;
dateOfDeath : Date;
placeOfBirth : String;
placeOfDeath : String;
books : Association to many Books on books.author = $self;
key ID : Integer;
name : String(111);
books : Association to many Books on books.author = $self;
}
entity Orders : cuid, managed {
entity Orders : managed {
key ID : UUID;
OrderNo : String @title:'Order Number'; //> readable key
Items : Composition of many OrderItems on Items.parent = $self;
total : Decimal(9,2) @readonly;
currency : Currency;
}
entity OrderItems : cuid {
parent : Association to Orders;
book : Association to Books;
amount : Integer;
netAmount : Decimal(9,2);
}
entity OrderItems {
key ID : UUID;
parent : Association to Orders;
book : Association to Books;
amount : Integer;
}