File size: 716 Bytes
fa3491c
9c63b5a
d747060
fa3491c
464e8df
 
 
 
 
 
 
 
 
 
 
185ec1f
 
 
 
d747060
 
185ec1f
 
 
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
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);
    }
};