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

This commit is contained in:
2026-05-09 09:04:20 +02:00
parent 3683fe9487
commit f4428afb9b
4 changed files with 181 additions and 100 deletions
@@ -4,16 +4,20 @@ import {
Get,
HttpCode,
HttpStatus,
MessageEvent,
NotFoundException,
Param,
ParseIntPipe,
Post,
Query,
Res,
Sse,
StreamableFile,
UseGuards,
} from '@nestjs/common';
import type { Response } from 'express';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { JwtOrApiKeyGuard } from '../auth/jwt-or-apikey.guard';
import { RequirePermissions } from '../auth/permissions.decorator';
import { Permission } from '../auth/permissions.enum';
@@ -48,6 +52,14 @@ export class LabelPrintAgentController {
return { jobId: String(job.Id) };
}
// Agent: SSE-Stream für neue Druckaufträge
@Sse('events')
sseEvents(): Observable<MessageEvent> {
return this.service.newJob$.pipe(
map(() => ({ data: { type: 'label-job-available' } } as MessageEvent)),
);
}
// Agent: nächsten Job abholen (Polling)
@Get('jobs/next')
async getNextJob(@Query('agentId') agentId: string, @Res({ passthrough: true }) res: Response) {