All files / src/modules/search listing-index.processor.ts

60% Statements 6/10
75% Branches 3/4
0% Functions 0/2
50% Lines 4/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 2111x   11x 11x               11x                  
import { Processor, WorkerHost } from '@nestjs/bullmq';
import { Job } from 'bullmq';
import { SearchService } from '@app/modules/search/search.service';
import { Injectable } from '@nestjs/common';
 
interface ListingIndexPayload {
  listingId: number;
}
 
@Processor('listingIndex')
@Injectable()
export class ListingIndexProcessor extends WorkerHost {
  constructor(private readonly searchService: SearchService) {
    super();
  }
 
  async process(job: Job<ListingIndexPayload>): Promise<void> {
    const { listingId } = job.data;
    await this.searchService.indexListing(listingId);
  }
}