u
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user