I have a function which add me to queue a job like this:
async addJob(someParameters: SomeParameters): Promise<void> {
await this.saveToDb(someParameters);
try {
await this.jobQueue.add('job', {
someParameters
})
} catch (error) {
}
}
but before adding to queue I save my data in database. My entity have a enum field "Status" with some parameters.
In my job.process.ts
i have my queue processor:
@Process('job')
async runJob(job: Job<{param: SomeParameters}>): Promise<any> {
try {
await this.launchMyFunction(param);
}
}
}
and another function to monitoring a job in the queue:
@OnQueueCompleted()
async onCompleted(job: Job): Promise<void> {
await this.updateJobStatus(here must be ID from DB); //HERE IS PROBLEM
}
and right now i have a problem, how to get and ID from my databse of the current job in queue and set a status to this record in database?