feat: add label preview functionality to barcode templates with backend rendering and UI modal
Build and Push Multi-Platform Images / build-and-push (push) Successful in 33s
Build and Push Multi-Platform Images / build-and-push (push) Successful in 33s
This commit is contained in:
@@ -24,6 +24,19 @@ import { LabelPrintAgentService } from './label-print-agent.service';
|
||||
export class LabelPrintAgentController {
|
||||
constructor(private readonly service: LabelPrintAgentService) {}
|
||||
|
||||
@Post('preview')
|
||||
@HttpCode(HttpStatus.OK)
|
||||
@RequirePermissions(Permission.VIEW_SCANNER)
|
||||
async preview(
|
||||
@Body() body: { templateId: number; fieldValues?: Record<string, string> },
|
||||
@Res({ passthrough: true }) res: Response,
|
||||
): Promise<StreamableFile> {
|
||||
const buf = await this.service.renderPreview(body.templateId, body.fieldValues ?? {});
|
||||
const { Readable } = await import('stream');
|
||||
res.setHeader('Content-Type', 'image/png');
|
||||
return new StreamableFile(Readable.from(buf));
|
||||
}
|
||||
|
||||
// Manuell einen Job anlegen (Frontend → Backend)
|
||||
@Post('jobs')
|
||||
@HttpCode(HttpStatus.CREATED)
|
||||
|
||||
Reference in New Issue
Block a user