All files / src lambdaSite.ts

0% Statements 0/8
100% Branches 0/0
0% Functions 0/1
0% Lines 0/8

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                                     
import {
  withMiddlewares,
  bootstrapNestJSMiddleware,
} from '@npco/component-core';
import { Handler, Context } from 'aws-lambda';
import { AppModule } from './appModule';
import { SiteService } from './site';
import { SiteQueryInput, AppAccessContext } from './types.d';
import { logMiddleware, accessTokenMiddleware } from './middlewares';
 
export const getSitesHandler: Handler = withMiddlewares(
  (event: SiteQueryInput, context: Context) => {
    const { app, accessToken } = context as AppAccessContext;
    const { limit, nextToken } = event;
    return app.get(SiteService).getSites(accessToken, limit, nextToken);
  },
  [logMiddleware, bootstrapNestJSMiddleware(AppModule), accessTokenMiddleware],
);