Improved files to distinguish subtypes (allows multiple different files tabs at a entity)
Attachments via the improved files Block thumbnails at mosaico templates as a separate files tab Some fixes All not tested yet
This commit is contained in:
parent
ade0fc87f2
commit
32cad03f4f
32 changed files with 683 additions and 346 deletions
|
@ -15,17 +15,21 @@ function hash(entity) {
|
|||
return hasher.hash(filterObject(entity, allowedKeys));
|
||||
}
|
||||
|
||||
async function getByIdTx(tx, context, id, withPermissions = true) {
|
||||
await shares.enforceEntityPermissionTx(tx, context, 'template', id, 'view');
|
||||
const entity = await tx('templates').where('id', id).first();
|
||||
entity.data = JSON.parse(entity.data);
|
||||
|
||||
if (withPermissions) {
|
||||
entity.permissions = await shares.getPermissionsTx(tx, context, 'template', id);
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
async function getById(context, id, withPermissions = true) {
|
||||
return await knex.transaction(async tx => {
|
||||
await shares.enforceEntityPermissionTx(tx, context, 'template', id, 'view');
|
||||
const entity = await tx('templates').where('id', id).first();
|
||||
entity.data = JSON.parse(entity.data);
|
||||
|
||||
if (withPermissions) {
|
||||
entity.permissions = await shares.getPermissionsTx(tx, context, 'template', id);
|
||||
}
|
||||
|
||||
return entity;
|
||||
return await getByIdTx(tx, context, id, withPermissions);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -100,6 +104,7 @@ async function remove(context, id) {
|
|||
|
||||
module.exports = {
|
||||
hash,
|
||||
getByIdTx,
|
||||
getById,
|
||||
listDTAjax,
|
||||
create,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue