import { Body, Controller, Post, Route, Security, SuccessResponse } from 'tsoa'; import { getCustomRepository } from 'typeorm'; import { RawGoogleShoppingOffersRepository } from '@/repositories'; import { UserRole } from '@/types'; import { GoogleProductsInput, GoogleProductsPayload } from './types'; @Route('google-products') @Security('basic', [UserRole.ADMIN]) export class GoogleProductsController extends Controller { @Post() @SuccessResponse('201', 'Created') async googleProducts( @Body() requestBody: GoogleProductsInput ): Promise { const { data, shoppingId, ingestionID, productIds } = requestBody; await getCustomRepository(RawGoogleShoppingOffersRepository).create({ googleShoppingId: shoppingId, data, ingestionID, productIds, }); return { status: 'success' }; } }