product-sync.ts

mail@pastecode.io avatar
unknown
typescript
5 months ago
680 B
2
Indexable
import { AppModule } from '@/app.module';
import constants from '@/constants';
import { SentryFilter } from '@/shared/sentry.filter';
import { SheetsService } from '@/sheets/sheets.service';
import { HttpAdapterHost, NestFactory } from '@nestjs/core';
import { Context } from 'aws-lambda';

export const handler = async (event: any, context: Context) => {

  const nestApp = await NestFactory.create(AppModule);
  const { httpAdapter } = nestApp.get(HttpAdapterHost);
  nestApp.useGlobalFilters(new SentryFilter(httpAdapter));

  const sheetsService = nestApp.get<SheetsService>(SheetsService);
  await sheetsService.readSpreadsheet(constants.productsSheetId);
};
Leave a Comment