Skip to content

Commit

Permalink
fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
bahram1249 committed May 1, 2024
1 parent 1fadc77 commit 3e8f0e2
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export class SnapPayService implements PayInterface {
const frontUrl = this.config.get('BASE_FRONT_URL');
return res.redirect(
301,
frontUrl + `/payment/transaction?transaction=${payment.id}`,
frontUrl + `/payment/transaction?transactionId=${payment.id}`,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export class ZarinPalService implements PayInterface {
const frontUrl = this.config.get('BASE_FRONT_URL');
return res.redirect(
301,
frontUrl + `/payment/transaction?transaction=${payment.id}`,
frontUrl + `/payment/transaction?transactionId=${payment.id}`,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,56 +14,23 @@ export class StockInventoryRemoveProcessor extends WorkerHost {
}

async process(job: Job<any, any, any>, token?: string): Promise<any> {
let progress: number = 0;
job.updateProgress(progress);
progress = 20;
if (!job.data.stockId) {
progress = 100;
job.updateProgress(progress);
return Promise.reject('stockId not provided!');
}

try {
progress = 50;
job.updateProgress(progress);
const result = await this.service.remove(job.data.stockId);
progress = 100;
job.updateProgress(progress);
return Promise.resolve(result);
} catch (e) {
return Promise.reject(e);
}
}

@OnWorkerEvent('completed')
onCompleted(job: Job) {
const { id, name, queueName, finishedOn, returnvalue } = job;
const completionTime = finishedOn ? new Date(finishedOn).toISOString() : '';
this.logger.log(
`Job id: ${id}, name: ${name} completed in queue ${queueName} on ${completionTime}. Result: ${returnvalue}`,
);
}

@OnWorkerEvent('progress')
onProgress(job: Job) {
const { id, name, progress } = job;
this.logger.log(`Job id: ${id}, name: ${name} completes ${progress}%`);
}

@OnWorkerEvent('failed')
onFailed(job: Job) {
const { id, name, queueName, failedReason } = job;
this.logger.error(
`Job id: ${id}, name: ${name} failed in queue ${queueName}. Failed reason: ${failedReason}`,
);
}

@OnWorkerEvent('active')
onActive(job: Job) {
const { id, name, queueName, timestamp } = job;
const startTime = timestamp ? new Date(timestamp).toISOString() : '';
this.logger.log(
`Job id: ${id}, name: ${name} starts in queue ${queueName} on ${startTime}.`,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ export class StockAvailabilityInventoryService {
async remove(stockId: bigint) {
let item = await this.repository.findOne(
new QueryOptionsBuilder()
.attributes(['id', 'inventoryId', 'productId', 'qty'])
.filter({ id: stockId })
.filter(
Sequelize.where(
Expand Down

0 comments on commit 3e8f0e2

Please sign in to comment.