From 2ec42641b975c904e2baa98950309c3aa8d6642a Mon Sep 17 00:00:00 2001 From: Daniel Hutzel Date: Thu, 29 Jun 2023 09:43:02 +0200 Subject: [PATCH] [PARKED:] Enhancements for analytics demo @d-com --- app/analytics.cds | 34 ++++++++++++++++++++++++++++++++++ db/master-data.cds | 4 ---- db/schema.cds | 2 ++ 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 app/analytics.cds diff --git a/app/analytics.cds b/app/analytics.cds new file mode 100644 index 00000000..db55e7cc --- /dev/null +++ b/app/analytics.cds @@ -0,0 +1,34 @@ + +using { sap.fe.cap.travel as my } from '../db/schema'; +namespace sap.fe.cap.travel; + +entity TravelAnalytics as projection on my.Travel { + *, TreesPlanted @(AnalyticsDetails.measureType: #BASE) +}; + +annotate my.TravelAnalytics with @ObjectModel.supportedCapabilities: [ + #ANALYTICAL_PROVIDER +]; + +annotate my.TravelStatus with @ObjectModel.supportedCapabilities: [ + #ANALYTICAL_DIMENSION +]; + +annotate my.TravelAgency with @ObjectModel.supportedCapabilities: [ + #ANALYTICAL_DIMENSION +]; + +annotate my.Travel with @ObjectModel.supportedCapabilities: [ + #ANALYTICAL_FACT +]{ + BookingFee @Aggregation.default: #SUM; + TotalPrice @Aggregation.default: #SUM; + GreenFee @Aggregation.default: #SUM; + TreesPlanted @Aggregation.default: #SUM; +}; + +annotate my.Travel with { + BookingFee @Semantics.amount.CurrencyCode: Currency; + TotalPrice @Semantics.amount.CurrencyCode: Currency; + GreenFee @Semantics.amount.CurrencyCode: Currency; +}; diff --git a/db/master-data.cds b/db/master-data.cds index 3c47bedd..104e8be9 100644 --- a/db/master-data.cds +++ b/db/master-data.cds @@ -31,10 +31,6 @@ entity Supplement : managed, MasterData { }; entity Flight : MasterData { - // TODO: - // when cuid is added, the to_Airline & to_Connection can be made managed association, - // furthermore the AirlineID and ConnectionID can be removed, - // they will be replaced by the generate FKs for to_Airline & to_Connection key AirlineID : String(3); key FlightDate : Date; key ConnectionID : String(4); diff --git a/db/schema.cds b/db/schema.cds index 5c508f94..d7969ecb 100644 --- a/db/schema.cds +++ b/db/schema.cds @@ -22,6 +22,8 @@ entity Travel : managed { to_Agency : Association to TravelAgency; to_Customer : Association to Passenger; to_Booking : Composition of many Booking on to_Booking.to_Travel = $self; + GreenFee : Integer; + TreesPlanted : Integer; }; annotate Travel with @(