-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathschema.cds
More file actions
64 lines (56 loc) · 1.72 KB
/
Copy pathschema.cds
File metadata and controls
64 lines (56 loc) · 1.72 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
using { Currency, Country, cuid, managed, sap.common.CodeList } from '@sap/cds/common';
namespace sap.capire.flights;
/**
* A scheduled flight on a specific date with a specific aircraft and price.
*/
entity Flights : managed {
key flight : Association to FlightConnections;
key date : Date;
aircraft : String;
price : Decimal(9,4);
currency : Currency;
maximum_seats : Integer;
occupied_seats : Integer; // partly transactional
free_seats : Integer = maximum_seats - occupied_seats;
}
/**
* A flight connection between two airports operated by an airline.
*/
entity FlightConnections {
key ID : String(11); // e.g. LH4711
airline : Association to Airlines;
origin : Association to Airports;
destination : Association to Airports;
departure : Time;
arrival : Time;
distance : Integer; // in kilometers
}
entity Airlines : cuid, managed {
name : String;
icon : String;
currency : Currency;
flights : Association to many FlightConnections on flights.airline = $self;
}
entity Airports : managed {
key ID : IATA /** IATA code, e.g. FRA */;
name : String;
city : String;
country : Country;
arrivals : Association to many FlightConnections on arrivals.destination = $self;
departures : Association to many FlightConnections on departures.origin = $self;
}
entity Supplements : cuid, managed {
type : Association to Supplements.Types;
descr : localized String(1111);
price : Decimal(9,4);
currency : Currency;
}
entity Supplements.Types : CodeList {
key code : String(2) enum {
Beverage = 'BV';
Meal = 'ML';
Luggage = 'LU';
Extra = 'EX';
}
}
type IATA : String(3); // e.g. FRA