import { Injectable } from '@nestjs/common'; import type { DailyEvaluationStep } from '../jobs/daily-evaluation-steps'; import type { JobResult } from '../jobs/job'; import { SuggestionsService } from '../suggestions/suggestions.service'; /** * Step "suggestions-expiry": OPEN suggestions past their expiry day become * EXPIRED (one statement, which also frees their dedupe key). Running it * twice for one day changes nothing the second time. */ @Injectable() export class SuggestionsExpiryStep implements DailyEvaluationStep { readonly name = 'suggestions-expiry'; constructor(private readonly suggestions: SuggestionsService) {} async run(today: string): Promise { return { suggestionsExpired: await this.suggestions.expireDue(today) }; } }