feat: add SSE event stream for print jobs, implement batch printing in frontend, and update API documentation.
Build and Push Multi-Platform Images / build-and-push (push) Successful in 36s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 36s
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { Injectable, Logger, NotFoundException, BadRequestException } from '@nestjs/common';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { Repository, LessThan, IsNull, Or } from 'typeorm';
|
||||
import { Repository, LessThan, IsNull } from 'typeorm';
|
||||
import { Subject, Observable } from 'rxjs';
|
||||
import { LabelPrintJob } from '../database/entities/label-print-job.entity';
|
||||
import { BarcodeTemplate } from '../database/entities/barcode-template.entity';
|
||||
import { LabelRendererService } from './label-renderer.service';
|
||||
@@ -28,6 +29,11 @@ function lockExpiry(): Date {
|
||||
@Injectable()
|
||||
export class LabelPrintAgentService {
|
||||
private readonly logger = new Logger(LabelPrintAgentService.name);
|
||||
private readonly jobCreated$ = new Subject<void>();
|
||||
|
||||
get newJob$(): Observable<void> {
|
||||
return this.jobCreated$.asObservable();
|
||||
}
|
||||
|
||||
constructor(
|
||||
@InjectRepository(LabelPrintJob)
|
||||
@@ -85,7 +91,9 @@ export class LabelPrintAgentService {
|
||||
LockedByAgent: null,
|
||||
});
|
||||
|
||||
return this.jobRepo.save(job);
|
||||
const saved = await this.jobRepo.save(job);
|
||||
this.jobCreated$.next();
|
||||
return saved;
|
||||
}
|
||||
|
||||
async claimNextJob(agentId: string): Promise<LabelPrintJob | null> {
|
||||
|
||||
Reference in New Issue
Block a user