/
schema.cds
58 lines (48 loc) · 1011 Bytes
/
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
using {
managed,
sap,
cuid
} from '@sap/cds/common';
using from '@sap/cds-common-content';
using {RemoteService as external} from '../srv/external/RemoteService';
namespace golf;
entity Rounds : cuid, managed {
title : String(111);
holes : Composition of many Holes;
players : Composition of many Round2People;
}
aspect Round2People : cuid {
people : Association to one external.Players;
}
aspect Holes : cuid {
holeNumber : Integer @assert.range: [
1,
18
];
shots : Composition of many Shots;
par : Integer @assert.range: [
3,
5
];
@Core.Computed
@readonly
score : Integer;
result : result;
}
aspect Shots : cuid {
quality : quality;
distance : Integer @assert.range: [
0,
800
];
}
entity Quality : sap.common.CodeList {
key code : String(10)
}
@assert.target
type quality : Association to Quality;
entity Result : sap.common.CodeList {
key code : Integer;
}
@assert.target
type result : Association to Result;