Spaces:
Runtime error
Runtime error
abhishek-akbari01
commited on
Commit
·
87fd70d
1
Parent(s):
6e41924
fix bug for create invoice using private server
Browse files
src/controllers/invoice/invoice.controller.ts
CHANGED
|
@@ -91,7 +91,7 @@ export const createInvoice = async (req: AuthenticatedRequest, res: Response) =>
|
|
| 91 |
pw_work_order_id: aiServiceData.workOrderID,
|
| 92 |
filename: file.originalname,
|
| 93 |
pdf_url: (await uploadResults[index]).url,
|
| 94 |
-
uploaded_by: req.user?.id as number
|
| 95 |
};
|
| 96 |
|
| 97 |
const invoice = await Invoice.create(invoiceRecord);
|
|
@@ -147,7 +147,6 @@ export const createInvoice = async (req: AuthenticatedRequest, res: Response) =>
|
|
| 147 |
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) });
|
| 148 |
|
| 149 |
} catch (error) {
|
| 150 |
-
console.log(error);
|
| 151 |
if (error instanceof Error) {
|
| 152 |
let errorMessage = error.message;
|
| 153 |
|
|
|
|
| 91 |
pw_work_order_id: aiServiceData.workOrderID,
|
| 92 |
filename: file.originalname,
|
| 93 |
pdf_url: (await uploadResults[index]).url,
|
| 94 |
+
uploaded_by: req.baseUrl === "/private" ? 1 : req.user?.id as number
|
| 95 |
};
|
| 96 |
|
| 97 |
const invoice = await Invoice.create(invoiceRecord);
|
|
|
|
| 147 |
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) });
|
| 148 |
|
| 149 |
} catch (error) {
|
|
|
|
| 150 |
if (error instanceof Error) {
|
| 151 |
let errorMessage = error.message;
|
| 152 |
|