This commit is contained in:
seb
2026-11-01 21:16:07 +01:00
parent 833cee5040
commit 518106ede2
3 changed files with 41 additions and 13 deletions

View File

@@ -8,7 +8,7 @@ import { pngToZpl } from '../../services/zplService.js';
import { notifyAgentJob } from '../agent/index.js';
import { emit } from '../sse.js';
import { applyZplCopies } from './zpljob.js';
import { interpolateString, interpolateObjects } from './article/shared.js';
import { interpolateString, interpolateObjects, withMandatedOptionsPrice } from './article/shared.js';
// #region Helpers
@@ -102,7 +102,7 @@ export function register(app, basePath = '') {
const skuStr = String(req.query.sku).trim();
const result = await articleDb.getBySku(req.user.id, skuStr);
if (result?.article) {
article = result.article;
article = await withMandatedOptionsPrice(req.user.id, result.article);
}
}
@@ -220,7 +220,7 @@ export function register(app, basePath = '') {
: null;
if (objects && objects.length > 0) {
try {
const interpolated = interpolateObjects(objects, result.article);
const interpolated = interpolateObjects(objects, await withMandatedOptionsPrice(req.user.id, result.article));
const thumbBuffer = await renderThumb({
width: template.width,
height: template.height,
@@ -655,7 +655,7 @@ export function register(app, basePath = '') {
if (!result?.article) {
return res.status(404).json({ error: 'Article not found' });
}
article = result.article;
article = await withMandatedOptionsPrice(req.user.id, result.article);
} else {
article = {
name: template?.name || 'Musterartikel',