@opengis/admin
Version:
This project Softpro Admin
13 lines (11 loc) • 390 B
JavaScript
import { pgClients } from '@opengis/fastify-table/utils.js';
export default async function onWidgetSet({
pg = pgClients.client, id, objectid, type, payload = {},
}) {
if (!id || !objectid || type !== 'gallery') {
return null;
}
if (payload?.ismain) {
await pg.query('update crm.files set ismain=false where entity_id=$1 and file_id<>$2', [objectid, id]);
}
}