@@ -4,6 +4,7 @@ import { createBrandedValue } from '@unocha/hpc-api-core/src/util/types';
4
4
import { groupBy } from 'lodash' ;
5
5
import { Service } from 'typedi' ;
6
6
import Context from '../Context' ;
7
+ import { EmergencyService } from '../emergency/emergency-service' ;
7
8
import { GlobalClusterService } from '../global-cluster/global-cluster-service' ;
8
9
import { GoverningEntityService } from '../governing-entity/governing-entity-service' ;
9
10
import { LocationService } from '../location/location-service' ;
@@ -15,6 +16,7 @@ import { UsageYearService } from '../usage-year/usage-year-service';
15
16
@Service ( )
16
17
export class FlowObjectService {
17
18
constructor (
19
+ private emergencyService : EmergencyService ,
18
20
private globalClusterService : GlobalClusterService ,
19
21
private governingEntityService : GoverningEntityService ,
20
22
private locationService : LocationService ,
@@ -42,6 +44,15 @@ export class FlowObjectService {
42
44
const typedObjects = await Promise . all (
43
45
Object . entries ( groupBy ( flowObjects , 'objectType' ) ) . map (
44
46
async ( [ type , flowObjects ] ) => {
47
+ if ( type === 'emergency' ) {
48
+ return [
49
+ 'emergencies' ,
50
+ await this . emergencyService . findByIds (
51
+ context . models ,
52
+ flowObjects . map ( ( fo ) => fo . objectID )
53
+ ) ,
54
+ ] ;
55
+ }
45
56
if ( type === 'globalCluster' ) {
46
57
return [
47
58
'globalClusters' ,
0 commit comments