Initial Product release

This commit is contained in:
2026-07-13 21:44:49 +01:00
parent 2d3ff69c6e
commit 0837f4f529
84 changed files with 13174 additions and 36 deletions
+33
View File
@@ -0,0 +1,33 @@
async function fetchCanvasSizesData(pool) {
const [canvasSizes] = await pool.query('SELECT * FROM canvas_sizes ORDER BY width ASC, height ASC, name ASC');
return { canvasSizes };
}
async function fetchCanvasSizeById(pool, id) {
const [rows] = await pool.query('SELECT * FROM canvas_sizes WHERE id = ?', [id]);
return rows[0] || null;
}
function buildCanvasSizePayload(req, existingCanvasSize) {
const name = String(req.body.name || '').trim();
const width = Math.max(1, Number(req.body.width || (existingCanvasSize && existingCanvasSize.width) || 0));
const height = Math.max(1, Number(req.body.height || (existingCanvasSize && existingCanvasSize.height) || 0));
if (!name) {
const error = new Error('Canvas size name is required.');
error.statusCode = 400;
throw error;
}
return {
name,
width,
height
};
}
module.exports = {
fetchCanvasSizesData,
fetchCanvasSizeById,
buildCanvasSizePayload
};