diff --git a/srv/travel-flow.cds b/srv/travel-flow.cds new file mode 100644 index 00000000..fc12236c --- /dev/null +++ b/srv/travel-flow.cds @@ -0,0 +1,15 @@ +using { sap.fe.cap.travel as my } from '../db/schema'; + +@microflow service TravelFlow { + entity Travel as projection on my.Travel { + key TravelID, + TravelStatus.code as status + } actions { + action new @( to: Draft ) (); + action edit @( from:[ Open, Approved, Rejected ], to: Draft ) (); + action save @( from:[ Draft ], to: Open ) (); + action approve @( from:[ Open ], to: Approved ) (); + action cancel @( from:[ Open, Approved ], to: Cancelled ) (); + action reject @( from:[ Open ], to: Rejected ) (); + }; +} diff --git a/srv/travel-flow.drawio.svg b/srv/travel-flow.drawio.svg new file mode 100644 index 00000000..da8f1f3d --- /dev/null +++ b/srv/travel-flow.drawio.svg @@ -0,0 +1,298 @@ + + + + + + + + + + +
+
+
+ approve +
+
+
+
+ + approve + +
+
+ + + + + +
+
+
+ reject +
+
+
+
+ + reject + +
+
+ + + + +
+
+
+ Open +
+
+
+
+ + Open + +
+
+ + + + + +
+
+
+ cancel +
+
+
+
+ + cancel + +
+
+ + + + + +
+
+
+ close +
+
+
+
+ + close + +
+
+ + + + +
+
+
+ Approved +
+
+
+
+ + Approved + +
+
+ + + + +
+
+
+ Rejected +
+
+
+
+ + Rejected + +
+
+ + + + +
+
+
+ Cancelled +
+
+
+
+ + Cancelled + +
+
+ + + + +
+
+
+ Closed +
+
+
+
+ + Closed + +
+
+ + + + + +
+
+
+ cancel +
+
+
+
+ + cancel + +
+
+ + + + + +
+
+
+ save +
+
+
+
+ + save + +
+
+ + + + +
+
+
+ Draft +
+
+
+
+ + Draft + +
+
+ + + + + +
+
+
+ new +
+
+
+
+ + new + +
+
+ + + + + + +
+
+
+ edit +
+
+
+
+ + edit + +
+
+ + + + + +
+
+
+ edit +
+
+
+
+ + edit + +
+
+ + + + + +
+
+
+ edit +
+
+
+
+ + edit + +
+
+
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file diff --git a/srv/travel-service.cds b/srv/travel-service.cds index cdb00c57..40320095 100644 --- a/srv/travel-service.cds +++ b/srv/travel-service.cds @@ -18,3 +18,13 @@ service TravelService @(path:'/processor') { } type Percentage : Integer @assert.range: [1,100]; + +using { TravelFlow } from './travel-flow'; +annotate TravelService.Travel with actions { + createTravelByTemplate @emits: TravelFlow.Travel.new; + rejectTravel @emits: TravelFlow.Travel.reject; + acceptTravel @emits: TravelFlow.Travel.approve; + NEW @emits: TravelFlow.Travel.new; + EDIT @emits: TravelFlow.Travel.edit; + SAVE @emits: TravelFlow.Travel.save; +};