-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdata-service.cds
More file actions
40 lines (31 loc) · 1.64 KB
/
data-service.cds
File metadata and controls
40 lines (31 loc) · 1.64 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
using sap.capire.flights as x from '../db/schema';
/**
* Master data service providing flight-related data, e.g. Flights, Airlines,
* Airports, and Supplements (e.g. extra luggage, meals, etc.).
* Served as SAP data product, and protocols supported by CAP.
*/
@data.product @hcql @rest @odata @graphql
service sap.capire.flights.data {
// Serve Flights data via denormalized view with flattened FlightConnections
@readonly entity Flights as select from x.Flights left join x.FlightConnections on ID = flight.ID {
key ID, key date, *
} excluding { flight, createdAt, createdBy, modifiedBy } // as flight details are flattened
// Serve Airlines with redirected association to Flights view
@readonly entity Airlines as projection on x.Airlines { *,
flights : redirected to Flights
} excluding { createdAt, createdBy, modifiedBy };
// Serve Airports with redirected associations to Flights view
@readonly entity Airports as projection on x.Airports { *,
departures : redirected to Flights,
arrivals : redirected to Flights
} excluding { createdAt, createdBy, modifiedBy };
// Serve Supplements data as is
@readonly entity Supplements as projection on x.Supplements
excluding { createdAt, createdBy, modifiedBy };
// Custom actions and events to sync with consumers about flight seat availability
action BookingCreated ( flight: Flights:ID, date: Flights:date, seats: array of Integer);
action BookingDeleted ( flight: Flights:ID, date: Flights:date, seats: array of Integer);
event FlightsUpdated { flight: Flights:ID; date: Flights:date; free_seats: Integer; }
}
// Temporary workarounds
using from './workaround';