-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathplugins.api.events.ts
More file actions
36 lines (32 loc) · 1.25 KB
/
plugins.api.events.ts
File metadata and controls
36 lines (32 loc) · 1.25 KB
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 { Feature, Point } from 'geojson'
import { InjectionToken } from '.'
import { MageEventAttrs, MageEventRepository } from '../entities/events/entities.events'
import { User } from '../entities/users/entities.users'
export interface UserLocation extends Feature<Point> {
properties: Feature['properties'] & {
timestamp: Date
}
// TODO: evaluate the rest of the properties for locations including
// teamIds and deviceId
}
export interface MageEventsPluginHooks {
mageEvent?: {
/**
* MAGE calls this hook after persisting a user's reported location.
*
* TODO: Evaluate whether this goes here to associate with MAGE events
* along with observations or somewhere else. The reason for this
* placement intially is that user locations and observations only exist in
* the context of an event.
*/
onUserLocations?: (locations: UserLocation[], user: User, event: MageEventAttrs) => any
/**
* MAGE calls this hook after persisting a valid observation, new or
* updated.
*
* TODO: make it so
*/
// onObservation?: (event: MageEvent, observation: Observation) => any
}
}
export const MageEventRepositoryToken: InjectionToken<MageEventRepository> = Symbol('InjectMageEventRepository')