-
Notifications
You must be signed in to change notification settings - Fork 4
/
handler.ts
25 lines (23 loc) · 1 KB
/
handler.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
import { APIGatewayEvent, Context, Callback } from 'aws-lambda';
import { _executeService, getAllBlips, getBlipsForEvent, getBlipsForRevote } from './api-service';
import { logDebug } from './src/lib/utils';
export const executeService = (event: APIGatewayEvent, context: Context, callback: Callback<any>) => {
logDebug('path to execute: ' + event.path);
if (event.path === '/executeService/votes/blips.csv') {
getAllBlips(event, context, callback);
} else if (
event.pathParameters &&
event.pathParameters['id'] &&
event.path === '/executeService/votes/' + event.pathParameters['id'] + '/blips.csv'
) {
getBlipsForEvent(event, context, callback);
} else if (
event.pathParameters &&
event.pathParameters['id'] &&
event.path === '/executeService/votes/' + event.pathParameters['id'] + '/revote/blips.csv'
) {
getBlipsForRevote(event, context, callback);
} else {
_executeService(event, context, callback);
}
};