Adding code of OpenSAP week2 unit 1 demo

This commit is contained in:
Harini Gunabalan
2020-03-21 23:31:43 +01:00
parent 06755978b2
commit fa187be617
94 changed files with 3270 additions and 2614 deletions

View File

@@ -1,35 +1,40 @@
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);
entity Books : managed, additionalInfo {
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;
}
entity Movies: additionalInfo {
key ID : Integer;
name : String(111);
}
aspect additionalInfo{
genre: String(100);
language: String(200);
}