fix(api): importer job was always importing first user

We did read the actual user id from the job data, which caused us
to always import the first user returned by the database.
This commit is contained in:
Julian Tölle 2023-03-12 21:33:13 +01:00
parent 27a7c7faf6
commit 821b91defe

View file

@ -1,3 +1,4 @@
import type { Job } from "pg-boss";
import { Injectable, Logger } from "@nestjs/common";
import { Span } from "nestjs-otel";
import { ListensService } from "../../listens/listens.service";
@ -60,7 +61,9 @@ export class SpotifyService {
}
@ImportSpotifyJob.Handle()
async importSpotifyJobHandler({ userID }: IImportSpotifyJob): Promise<void> {
async importSpotifyJobHandler({
data: { userID },
}: Job<IImportSpotifyJob>): Promise<void> {
const user = await this.usersService.findById(userID);
if (!user) {
this.logger.warn("User for import job not found", { userID });