Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 26 additions & 20 deletions db/schema.cds
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@ using { Currency, Country, cuid, sap.common.CodeList } from '@sap/cds/common';

namespace sap.capire.flights;

entity Airlines : cuid {
name : String;
icon : String;
currency : Currency;
}

entity Airports : cuid {
name : String;
city : String;
country : Country;
/**
* A scheduled flight on a specific date with a specific aircraft and price.
*/
entity Flights {
key flight : Association to FlightConnections;
key date : Date;
aircraft : String;
price : Price;
currency : Currency;
maximum_seats : Integer;
occupied_seats : Integer; // partly transactional
}

entity Connections {
/**
* 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;
Expand All @@ -24,15 +28,17 @@ entity Connections {
distance : Integer; // in kilometers
}

entity Flights {
key flight : Association to Connections;
key date : Date;
aircraft : String;
price : Price;
currency : Currency;
maximum_seats : Integer;
occupied_seats : Integer; // partly transactional
};
entity Airlines : cuid {
name : String;
icon : String;
currency : Currency;
}

entity Airports : cuid {
name : String;
city : String;
country : Country;
}

entity Supplements : cuid {
type : Association to SupplementTypes;
Expand Down
4 changes: 2 additions & 2 deletions srv/fiori-service.cds → srv/admin-service.cds
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using { sap.capire.flights as my } from '../db/schema';

@fiori service FlightsService {
entity Connections as projection on my.Connections;
@fiori service AdminService {
entity FlightConnections as projection on my.FlightConnections;
entity Flights as projection on my.Flights;
entity Airlines as projection on my.Airlines;
entity Airports as projection on my.Airports;
Expand Down
9 changes: 7 additions & 2 deletions srv/data-service.cds
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@ using { sap, sap.capire.flights as my } from '../db/schema';
}


// Additionally serve via @hcql, @rest, and @odata, and add events
@hcql @rest @odata extend service sap.capire.flights.data {
// Alternative protocols to serve the data
annotate sap.capire.flights.data
with @hcql @rest @odata;


// Add custom events
extend service sap.capire.flights.data {

// inbound and outbound events
aspect FlightKeys {
Expand Down