Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | 4x 4x 4x 4x 4x 1x 1x 4x 1x 1x 4x 1x 1x | import { Handler, Context } from 'aws-lambda';
import {
withMiddlewares,
bootstrapNestJSMiddleware,
} from '@npco/component-core';
import { AppContext } from '@npco/component-core/dist/types';
import { DepositQueryInput, AppAccessContext } from '../types.d';
import { DepositService } from '../deposits/depositService';
import {
logMiddleware,
accessTokenMiddleware,
checkDeviceStatusMiddleware,
} from '../middlewares';
import { AppModule } from '../appModule';
export const getDepositsHandler: Handler = withMiddlewares(
(event: { args: DepositQueryInput }, context: Context) => {
const { app, accessToken } = context as AppAccessContext;
return app.get(DepositService).getDeposits(event.args, accessToken);
},
[
logMiddleware,
bootstrapNestJSMiddleware(AppModule),
accessTokenMiddleware,
checkDeviceStatusMiddleware,
],
);
export const getDepositHandler: Handler = withMiddlewares(
(event: { args: { depositUuid: string } }, context: Context) => {
const app = (context as AppContext).app;
return app.get(DepositService).getDeposit(event.args.depositUuid);
},
[
logMiddleware,
bootstrapNestJSMiddleware(AppModule),
accessTokenMiddleware,
checkDeviceStatusMiddleware,
],
);
export const onDepositUpdateHandler: Handler = withMiddlewares(
(event: any, context: Context) => {
const { app, accessToken } = context as AppAccessContext;
return app.get(DepositService).onDepositUpdate(accessToken);
},
[
logMiddleware,
bootstrapNestJSMiddleware(AppModule),
accessTokenMiddleware,
checkDeviceStatusMiddleware,
],
);
|