From 821b91defeceec55c7ae84a4722eda0b951732ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20T=C3=B6lle?= Date: Sun, 12 Mar 2023 21:33:13 +0100 Subject: [PATCH] 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. --- src/sources/spotify/spotify.service.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sources/spotify/spotify.service.ts b/src/sources/spotify/spotify.service.ts index 21dbb57..b83dda2 100644 --- a/src/sources/spotify/spotify.service.ts +++ b/src/sources/spotify/spotify.service.ts @@ -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 { + async importSpotifyJobHandler({ + data: { userID }, + }: Job): Promise { const user = await this.usersService.findById(userID); if (!user) { this.logger.warn("User for import job not found", { userID });