forked from mrbandler/cds2types
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.cds
77 lines (66 loc) · 1.79 KB
/
schema.cds
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using {
Currency,
managed,
sap,
cuid
} from '@sap/cds/common';
namespace sap.capire.bookshop;
entity ArrayUsingEntity : cuid {
inlineArray : array of {
id : String;
quantity : Integer
};
adressArray : array of Address;
compositoinField : Composition of many {
idComposition : String;
quantityComposition : Integer;
}
}
entity Books : managed {
key ID : Integer;
title : localized String(111);
descr : localized String(1111);
author : Association to Authors;
genre : Association to Genres;
stock : Integer;
price : Decimal(9, 2);
currency : Currency;
}
type Gender : Integer enum {
NonBinary = 1;
Male = 2;
Female = 3;
}
type NameStr : String(111);
type Name {
firstname : NameStr;
lastname : NameStr;
}
type Address {
street : String;
houseNo : String;
town : String;
country : String;
}
type Addresses : many Address;
entity Authors : managed {
key ID : Integer;
name : Name;
gender : Gender;
addresses : Addresses;
dateOfBirth : Date;
dateOfDeath : Date;
placeOfBirth : String;
placeOfDeath : String;
books : Association to many Books
on books.author = $self;
}
/**
* Hierarchically organized Code List for Genres
*/
entity Genres : sap.common.CodeList {
key ID : Integer;
parent : Association to Genres;
children : Composition of many Genres
on children.parent = $self;
}