@opengis/admin 0.3.60 → 0.3.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/admin",
3
- "version": "0.3.60",
3
+ "version": "0.3.61",
4
4
  "description": "This project Softpro Admin",
5
5
  "main": "dist/admin.js",
6
6
  "type": "module",
@@ -48,7 +48,6 @@ export default async function widgetSet(req, reply) {
48
48
  file_status: 1,
49
49
  uid: user?.uid || 1,
50
50
  entity_id: objectid,
51
- ismain: type === 'gallery' ? (Object.hasOwn(body, 'ismain') ? body.ismain : true) : undefined,
52
51
  };
53
52
 
54
53
  if (type === 'gallery' && !galleryExtList.includes(extName.toLowerCase())) {
@@ -60,7 +59,10 @@ export default async function widgetSet(req, reply) {
60
59
  });
61
60
 
62
61
  if (type === 'gallery') {
63
- await pg.query('update crm.files set ismain=false where entity_id=$1 and file_id<>$2', [objectid, rows[0]?.file_id]);
62
+ await pg.query(`update crm.files set ismain=true
63
+ where entity_id=$1
64
+ and file_id=$2
65
+ and (select count(*) = 0 from crm.files where entity_id=$1 and ismain)`, [objectid, rows[0]?.file_id]);
64
66
  }
65
67
 
66
68
  return {