-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaudit.ts
34 lines (31 loc) · 854 Bytes
/
audit.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
import HTTP from '../http';
export enum AuditAction {
MEMBER_SUBSCRIPTION_UPDATE = 'MEMBER_SUBSCRIPTION_UPDATE',
MEMBER_TICKET_UPDATE = 'MEMBER_TICKET_UPDATE',
MEMBER_DEVICE_UPDATE = 'MEMBER_DEVICE_UPDATE',
MEMBER_CAPABILITIES_UPDATE = 'MEMBER_CAPABILITIES_UPDATE',
KEYS_ACCESS = 'KEYS_ACCESS',
UNLOCK_DECK_DOOR = 'UNLOCK_DECK_DOOR',
UNLOCK_GATE = 'UNLOCK_GATE',
PARKING_ACCESS = 'PARKING_ACCESS',
}
export interface AuditEvent {
_id: string;
author?: {
_id?: string;
wpUserId: number;
name: string;
email: string;
};
action: AuditAction;
context?: any;
occurred: string;
}
export const getAllAuditEvents = (from?: string, to?: string): Promise<AuditEvent[]> => {
return HTTP.get('/api/audit', {
params: {
...(from && { from }),
...(to && { to }),
},
}).then(({ data }) => data);
};