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(); const router = Router();
router.post( router.post(
'/', '/', [
this.estimateValidationSchema, ...this.estimateValidationSchema,
],
this.validationResult, this.validationResult,
asyncMiddleware(this.newEstimate.bind(this)), asyncMiddleware(this.newEstimate.bind(this)),
this.handleServiceErrors, this.handleServiceErrors,
@@ -85,6 +86,7 @@ export default class SalesEstimatesController extends BaseController {
check('note').optional().trim().escape(), check('note').optional().trim().escape(),
check('terms_conditions').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.string('estimate_number').index();
table.text('note'); table.text('note');
table.text('terms_conditions'); table.text('terms_conditions');
table.text('send_to_email');
table.integer('user_id').unsigned().index(); table.integer('user_id').unsigned().index();
table.timestamps(); table.timestamps();
}); });

View File

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

View File

@@ -120,7 +120,9 @@ export default class SaleEstimateService {
}); });
this.logger.info('[sale_estimate] insert sale estimated success.'); 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; 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) @On(events.paymentReceive.onDeleted)
async handleInvoiceDecrementPaymentAmount({ tenantId, paymentReceiveId, oldPaymentReceive }) { async handleInvoiceDecrementPaymentAmount({ tenantId, paymentReceiveId, oldPaymentReceive }) {