Skip to content

Commit 084c998

Browse files
authored
Align with Node.js variant (#20)
1 parent 1ce5de3 commit 084c998

4 files changed

Lines changed: 35 additions & 24 deletions

File tree

File renamed without changes.

db/schema.cds

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,23 @@ using { Currency, Country, cuid, sap.common.CodeList } from '@sap/cds/common';
22

33
namespace sap.capire.flights;
44

5-
entity Airlines : cuid {
6-
name : String;
7-
icon : String;
8-
currency : Currency;
9-
}
10-
11-
entity Airports : cuid {
12-
name : String;
13-
city : String;
14-
country : Country;
5+
/**
6+
* A scheduled flight on a specific date with a specific aircraft and price.
7+
*/
8+
entity Flights {
9+
key flight : Association to FlightConnections;
10+
key date : Date;
11+
aircraft : String;
12+
price : Price;
13+
currency : Currency;
14+
maximum_seats : Integer;
15+
occupied_seats : Integer; // partly transactional
1516
}
1617

17-
entity Connections {
18+
/**
19+
* A flight connection between two airports operated by an airline.
20+
*/
21+
entity FlightConnections {
1822
key ID : String(11); // e.g. LH4711
1923
airline : Association to Airlines;
2024
origin : Association to Airports;
@@ -24,15 +28,17 @@ entity Connections {
2428
distance : Integer; // in kilometers
2529
}
2630

27-
entity Flights {
28-
key flight : Association to Connections;
29-
key date : Date;
30-
aircraft : String;
31-
price : Price;
32-
currency : Currency;
33-
maximum_seats : Integer;
34-
occupied_seats : Integer; // partly transactional
35-
};
31+
entity Airlines : cuid {
32+
name : String;
33+
icon : String;
34+
currency : Currency;
35+
}
36+
37+
entity Airports : cuid {
38+
name : String;
39+
city : String;
40+
country : Country;
41+
}
3642

3743
entity Supplements : cuid {
3844
type : Association to SupplementTypes;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using { sap.capire.flights as my } from '../db/schema';
22

3-
@fiori service FlightsService {
4-
entity Connections as projection on my.Connections;
3+
@fiori service AdminService {
4+
entity FlightConnections as projection on my.FlightConnections;
55
entity Flights as projection on my.Flights;
66
entity Airlines as projection on my.Airlines;
77
entity Airports as projection on my.Airports;

srv/data-service.cds

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ using { sap, sap.capire.flights as my } from '../db/schema';
2020
}
2121

2222

23-
// Additionally serve via @hcql, @rest, and @odata, and add events
24-
@hcql @rest @odata extend service sap.capire.flights.data {
23+
// Alternative protocols to serve the data
24+
annotate sap.capire.flights.data
25+
with @hcql @rest @odata;
26+
27+
28+
// Add custom events
29+
extend service sap.capire.flights.data {
2530

2631
// inbound and outbound events
2732
aspect FlightKeys {

0 commit comments

Comments
 (0)