fix: missed send_to_email column in sale estimate.

This commit is contained in:
Ahmed Bouhuolia
2020-10-26 12:48:26 +02:00
parent 4d3cd250fd
commit 92ddc1bf38
5 changed files with 11 additions and 6 deletions

View File

@@ -23,8 +23,9 @@ export default class SalesEstimatesController extends BaseController {
const router = Router();
router.post(
'/',
this.estimateValidationSchema,
'/', [
...this.estimateValidationSchema,
],
this.validationResult,
asyncMiddleware(this.newEstimate.bind(this)),
this.handleServiceErrors,
@@ -85,6 +86,7 @@ export default class SalesEstimatesController extends BaseController {
check('note').optional().trim().escape(),
check('terms_conditions').optional().trim().escape(),
check('send_to_email').optional().trim().escape(),
];
}

View File

@@ -10,7 +10,7 @@ exports.up = function(knex) {
table.string('estimate_number').index();
table.text('note');
table.text('terms_conditions');
table.text('send_to_email');
table.integer('user_id').unsigned().index();
table.timestamps();
});

View File

@@ -11,7 +11,7 @@ export interface ISaleEstimate {
termsConditions: string,
userId: number,
entries: IItemEntry[],
sendToEmail: string,
createdAt?: Date,
};
export interface ISaleEstimateDTO {
@@ -22,6 +22,7 @@ export interface ISaleEstimateDTO {
entries: IItemEntry[],
note: string,
termsConditions: string,
sendToEmail: string,
};
export interface ISalesEstimatesFilter extends IDynamicListFilterDTO {

View File

@@ -120,7 +120,9 @@ export default class SaleEstimateService {
});
this.logger.info('[sale_estimate] insert sale estimated success.');
await this.eventDispatcher.dispatch(events.saleEstimate.onCreated);
await this.eventDispatcher.dispatch(events.saleEstimate.onCreated, {
tenantId, saleEstimate, saleEstimateId: saleEstimate.id,
});
return saleEstimate;
}

View File

@@ -43,7 +43,7 @@ export default class PaymentReceivesSubscriber {
}
/**
* Handle
* Handle revert invoices payment amount once payment receive deleted.
*/
@On(events.paymentReceive.onDeleted)
async handleInvoiceDecrementPaymentAmount({ tenantId, paymentReceiveId, oldPaymentReceive }) {