-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.cds
130 lines (109 loc) · 3.65 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
using { Currency, custom.managed, sap.common.CodeList } from './common';
using {
master.data.travel.Airline,
master.data.travel.Passenger,
master.data.travel.TravelAgency,
master.data.travel.Supplement,
master.data.travel.Flight
} from './master-data';
namespace master.data.travel;
entity Travel : managed {
key TravelUUID : String(30);
TravelID : Integer @readonly default 0 @Common.Text: Description;
BeginDate: Date;
EndDate : Date;
BookingFee : Decimal(16, 3);
TotalPrice : Decimal(16, 3) @readonly;
CurrencyCode : Currency;
Description : String(1024);
TravelStatus : Association to TravelStatus @readonly @Common.ValueListWithFixedValues;
GoGreen : Boolean default false;
GreenFee : Decimal(16, 3) @Core.Computed @readonly;
TreesPlanted : Integer @Core.Computed @readonly;
to_Agency : Association to TravelAgency;
to_Customer : Association to Passenger;
to_Booking : Composition of many Booking on to_Booking.to_Travel = $self;
}
entity Booking : managed {
key BookingUUID : String(30);
BookingID : Integer @Core.Computed;
BookingDate : Date;
ConnectionID : String(4);
FlightDate : Date;
FlightPrice : Decimal(16, 3);
CurrencyCode : Currency;
BookingStatus : Association to BookingStatus;
to_BookSupplement : Composition of many BookingSupplement on to_BookSupplement.to_Booking = $self;
to_Carrier : Association to Airline;
to_Customer : Association to Passenger;
to_Travel : Association to Travel;
to_Flight : Association to Flight on to_Flight.AirlineID = to_Carrier.AirlineID
and to_Flight.FlightDate = FlightDate
and to_Flight.ConnectionID = ConnectionID;
}
entity BookingSupplement : managed {
key BookSupplUUID : UUID;
BookingSupplementID : Integer @Core.Computed;
Price : Decimal(16, 3);
CurrencyCode : Currency;
to_Booking : Association to Booking;
to_Travel : Association to Travel;
to_Supplement : Association to Supplement;
}
entity BookingStatus : CodeList {
key code : String enum {
New = 'N';
Booked = 'B';
Canceled = 'X';
}
}
entity TravelStatus : CodeList {
key code : String enum {
Open = 'O';
Accepted = 'A';
Canceled = 'X';
} default '0';
criticality : Integer;
fieldControl : Integer @odata.Type:'Edm.Byte';
createDeleteHidden : Boolean;
}
extend Booking with {
criticality : Integer default 0 @Core.Computed @UI.Hidden;
BookedFlights : Integer @Core.Computed;
EligibleForPrime : Integer @Core.Computed @UI.Hidden;
}
extend Airline with {
VIPCustomerBookings : Integer;
}
define view BookedFlights as select from Booking left join Airline on Airline.AirlineID = Booking.to_Carrier.AirlineID {
key to_Customer.CustomerID as to_Customer_CustomerID,
key AirlineID, to_Customer.LastName as LastName,
BookingUUID,
Name,
VIPCustomerBookings,
to_Travel
};
extend Travel with {
to_BookedFlights : Association to many BookedFlights on to_BookedFlights.to_Travel = $self @readonly;
}
entity Authors {
key ID : String(10);
AuthorName : String(50);
Age : String(3);
Address : String(50);
to_Books : Association to many Books on to_Books.to_Authors = $self;
}
entity Books {
key ID : String(10);
Name : String(10);
PageNumber : String(10);
Category : String(50);
to_Authors : Association to Authors;
}
define view AuthorsAndBooks as select from Books left join Authors on Authors.ID = Books.to_Authors.ID {
key Books.ID,
Name,
PageNumber,
AuthorName,
to_Authors
};