-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.cds
More file actions
46 lines (39 loc) · 1.25 KB
/
schema.cds
File metadata and controls
46 lines (39 loc) · 1.25 KB
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
using {
Currency,
cuid,
managed,
sap
} from '@sap/cds/common';
namespace sap.capire.bookshop;
entity Books : managed {
key ID : Integer;
author : Association to Authors @mandatory;
title : localized String @mandatory;
descr : localized String;
genre : Association to Genres;
stock : Integer;
price : Price;
currency : Currency;
}
entity Authors : managed {
key ID : Integer;
name : String @mandatory;
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 : cuid, sap.common.CodeList {
parent : Association to Genres;
children : Composition of many Genres
on children.parent = $self;
}
type Price : Decimal(9, 2);
// --------------------------------------------------------------------------------
// Temporary workaround for this situation:
// - Fiori apps in bookstore annotate Books with @fiori.draft.enabled.
// - Because of that .csv data has to eagerly fill in ID_texts column.
annotate Books with @fiori.draft.enabled;