Spaces:
Runtime error
Runtime error
Bansari Akhani commited on
Commit ·
28d50d6
1
Parent(s): 4b763ff
api to get PM for buildings, rename billNumber to refNo
Browse files
src/controllers/invoice/invoice.controller.ts
CHANGED
|
@@ -68,7 +68,7 @@ export const createInvoice = async (req: Request, res: Response) => {
|
|
| 68 |
const dueDate = new Date(aiServiceData.dueDate);
|
| 69 |
let invoiceRecord = {
|
| 70 |
reference_number: aiServiceData.refNo,
|
| 71 |
-
invoice_number: aiServiceData.
|
| 72 |
vendor_name: aiServiceData.vendor_name,
|
| 73 |
pw_vendor_id: aiServiceData.vendor_id,
|
| 74 |
invoice_date: invoiceDate,
|
|
@@ -137,6 +137,7 @@ export const createInvoice = async (req: Request, res: Response) => {
|
|
| 137 |
await logInvoiceAction({ invoice_id: invoice.id as number, user_id: invoice.uploaded_by, activity_type: 'create', field_name: 'invoice', old_value: '', new_value: JSON.stringify(invoice) });
|
| 138 |
|
| 139 |
} catch (error) {
|
|
|
|
| 140 |
if (error instanceof Error) {
|
| 141 |
logger.error(`Error creating invoice for file ${file.originalname}: ${error}`);
|
| 142 |
// Add entry to error log
|
|
@@ -331,10 +332,6 @@ export const getAllInvoices = async (req: Request, res: Response): Promise<Respo
|
|
| 331 |
data: invoices
|
| 332 |
};
|
| 333 |
|
| 334 |
-
// if (invoices.length === 0) {
|
| 335 |
-
// return res.status(404).json({ error: "No invoices found" });
|
| 336 |
-
// }
|
| 337 |
-
|
| 338 |
return res.status(200).json(responseData);
|
| 339 |
} catch (error) {
|
| 340 |
logger.error("Error fetching invoices:", error);
|
|
|
|
| 68 |
const dueDate = new Date(aiServiceData.dueDate);
|
| 69 |
let invoiceRecord = {
|
| 70 |
reference_number: aiServiceData.refNo,
|
| 71 |
+
invoice_number: aiServiceData.refNo,
|
| 72 |
vendor_name: aiServiceData.vendor_name,
|
| 73 |
pw_vendor_id: aiServiceData.vendor_id,
|
| 74 |
invoice_date: invoiceDate,
|
|
|
|
| 137 |
await logInvoiceAction({ invoice_id: invoice.id as number, user_id: invoice.uploaded_by, activity_type: 'create', field_name: 'invoice', old_value: '', new_value: JSON.stringify(invoice) });
|
| 138 |
|
| 139 |
} catch (error) {
|
| 140 |
+
console.log(error);
|
| 141 |
if (error instanceof Error) {
|
| 142 |
logger.error(`Error creating invoice for file ${file.originalname}: ${error}`);
|
| 143 |
// Add entry to error log
|
|
|
|
| 332 |
data: invoices
|
| 333 |
};
|
| 334 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 335 |
return res.status(200).json(responseData);
|
| 336 |
} catch (error) {
|
| 337 |
logger.error("Error fetching invoices:", error);
|
src/controllers/propertyware/buildings.controller.ts
CHANGED
|
@@ -31,3 +31,4 @@ export const syncBuildingsData = async (req: Request, res: Response) => {
|
|
| 31 |
logger.error('Error fetching Buildings:', error);
|
| 32 |
}
|
| 33 |
};
|
|
|
|
|
|
| 31 |
logger.error('Error fetching Buildings:', error);
|
| 32 |
}
|
| 33 |
};
|
| 34 |
+
|
src/shared/services/propertyware.service.ts
CHANGED
|
@@ -30,6 +30,11 @@ export const fetchBuildings = async (params: Record<string, string> = {} ) => {
|
|
| 30 |
return response.data;
|
| 31 |
};
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
export const fetchBuildingsById = async (buildingId: number) => {
|
| 34 |
const response = await apiClientPW.get(`/portfolios/${buildingId}`);
|
| 35 |
return response.data;
|
|
|
|
| 30 |
return response.data;
|
| 31 |
};
|
| 32 |
|
| 33 |
+
export const fetchBuildingPropertyManager = async (buildingId: number ) => {
|
| 34 |
+
const response = await apiClientPW.get(`/buildings/${buildingId}/managers`);
|
| 35 |
+
return response.data;
|
| 36 |
+
};
|
| 37 |
+
|
| 38 |
export const fetchBuildingsById = async (buildingId: number) => {
|
| 39 |
const response = await apiClientPW.get(`/portfolios/${buildingId}`);
|
| 40 |
return response.data;
|