Bansari Akhani commited on
Commit
b851eb2
·
1 Parent(s): c1cc5d1

set default invoice status to approved for sync functionality to work directly from swagger

Browse files
src/controllers/invoice/invoice.controller.ts CHANGED
@@ -62,7 +62,7 @@ export const createInvoice = async (req: Request, res: Response) => {
62
  due_date: dueDate,
63
  total: totalAmount,
64
  description: aiServiceData.description,
65
- status: "Pending",
66
  amount_paid: 0,
67
  term: aiServiceData.terms,
68
  pw_work_order_id: aiServiceData.workOrderID,
 
62
  due_date: dueDate,
63
  total: totalAmount,
64
  description: aiServiceData.description,
65
+ status: "Approved", // TODO: set default status to pending once approval module has been implemented
66
  amount_paid: 0,
67
  term: aiServiceData.terms,
68
  pw_work_order_id: aiServiceData.workOrderID,
src/controllers/propertyware/bills.controller.ts CHANGED
@@ -21,7 +21,7 @@ interface ErrorResponse {
21
  export const syncInvoices = async (req: Request, res: Response): Promise<void> => {
22
  try {
23
  const invoices = await Invoice.findAll({
24
- where: { status: 'approved' },
25
  include: [{ model: InvoiceDetail }]
26
  });
27
 
@@ -44,7 +44,6 @@ export const syncInvoices = async (req: Request, res: Response): Promise<void> =
44
  })),
45
  dueDate: invoice.due_date ? formatDate(invoice.due_date) : null,
46
  vendorID: invoice.pw_vendor_id?.toString(),
47
- billNumber: invoice.invoice_number,
48
  comments: invoice.description,
49
  refNo: invoice.reference_number,
50
  terms: invoice.term,
 
21
  export const syncInvoices = async (req: Request, res: Response): Promise<void> => {
22
  try {
23
  const invoices = await Invoice.findAll({
24
+ where: { status: 'Approved' },
25
  include: [{ model: InvoiceDetail }]
26
  });
27
 
 
44
  })),
45
  dueDate: invoice.due_date ? formatDate(invoice.due_date) : null,
46
  vendorID: invoice.pw_vendor_id?.toString(),
 
47
  comments: invoice.description,
48
  refNo: invoice.reference_number,
49
  terms: invoice.term,
src/db/seeders/20240719075837-seed-roles.js CHANGED
@@ -6,14 +6,14 @@ module.exports = {
6
  await queryInterface.bulkInsert('roles', [
7
  { name: 'Admin', created_at: new Date(), updated_at: new Date() },
8
  { name: 'Property Manager', created_at: new Date(), updated_at: new Date() },
9
- { name: 'Accounting User', created_at: new Date(), updated_at: new Date() },
10
  { name: 'Accounting Supervisor', created_at: new Date(), updated_at: new Date() }
11
  ]);
12
  },
13
 
14
  async down (queryInterface, Sequelize) {
15
  await queryInterface.bulkDelete('roles', {
16
- name: ['Admin', 'Property Manager', 'Accounting User', 'Accounting Supervisor']
17
  });
18
  }
19
  };
 
6
  await queryInterface.bulkInsert('roles', [
7
  { name: 'Admin', created_at: new Date(), updated_at: new Date() },
8
  { name: 'Property Manager', created_at: new Date(), updated_at: new Date() },
9
+ { name: 'Accountant', created_at: new Date(), updated_at: new Date() },
10
  { name: 'Accounting Supervisor', created_at: new Date(), updated_at: new Date() }
11
  ]);
12
  },
13
 
14
  async down (queryInterface, Sequelize) {
15
  await queryInterface.bulkDelete('roles', {
16
+ name: ['Admin', 'Property Manager', 'Accountant', 'Accounting Supervisor']
17
  });
18
  }
19
  };