This commit is contained in:
seb
2026-09-28 06:50:10 +02:00
parent 87da854de4
commit 5d2c8fdfed
3 changed files with 27 additions and 12 deletions

View File

@@ -4,6 +4,16 @@ import resolveSelectedCompanyAccess from '../companyuser/resolveSelectedCompanyA
import makeRunner from '../runner.js';
function shape(row) {
let content = typeof row.content === 'string' ? JSON.parse(row.content) : row.content;
if (content && typeof content === 'object') {
if (Array.isArray(content)) {
content = [];
} else {
const { objects: _objects, ...rest } = content;
content = rest;
}
}
return {
id: row.id,
company_id: row.company_id ?? row.companyId,
@@ -12,7 +22,7 @@ function shape(row) {
height: row.height,
dpi: row.dpi,
type: row.type,
content: typeof row.content === 'string' ? JSON.parse(row.content) : row.content,
content,
thumb: row.thumb ?? null,
};
}
@@ -26,6 +36,7 @@ export default function list(provider) {
/**
* Lists all label templates for the user's selected company.
* `content.objects` is omitted to reduce payload size.
*
* @param {number} googleAuthId - The id of the Google auth user.
* @param {object} [tx] - Optional transaction to run within.