@opengis/fastify-table
Version:
core-plugins
11 lines (10 loc) • 404 B
JavaScript
import pgClients from '../../../plugins/pg/pgClients.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]);
}
return null;
}