Spaces:
Runtime error
Runtime error
import { Request, Response } from 'express'; | |
import { syncInvoicesService } from '../../shared/services/bills.service'; | |
import { logger } from '../../utils/logger'; | |
interface ErrorResponse { | |
response: { | |
data: { | |
userMessage: string; | |
errorCode: string; | |
errors?: Array<{ key: string; message: string }>; | |
} | |
} | |
} | |
export const syncInvoices = async (req: Request, res: Response): Promise<void> => { | |
try { | |
const result = await syncInvoicesService(); | |
res.status(200).send(result); | |
} catch (error) { | |
logger.error('Error syncing Invoices'); | |
logger.error(error); | |
res.status(500).send((error as Error).message); | |
} | |
}; | |