-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathstations.flow.ts
36 lines (34 loc) · 1.14 KB
/
stations.flow.ts
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
import { IDerivation, Document, SourceRidesAndMoves } from 'flow/examples/citi-bike/stations.ts';
// Implementation for derivation examples/citi-bike/stations.
export class Derivation extends IDerivation {
ridesAndMoves(read: { doc: SourceRidesAndMoves }): Document[] {
const source = read.doc;
if (source.relocation) {
return [
{
departure: { move: 1 },
stable: { remove: [source.bike_id] },
...source.begin.station,
},
{
arrival: { move: 1 },
stable: { add: [source.bike_id] },
...source.end.station,
},
];
} else {
return [
{
departure: { ride: 1 },
stable: { remove: [source.bike_id] },
...source.begin.station,
},
{
arrival: { ride: 1 },
stable: { add: [source.bike_id] },
...source.end.station,
},
];
}
}
}