@opengis/admin 0.1.85 → 0.1.86

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/admin",
3
- "version": "0.1.85",
3
+ "version": "0.1.86",
4
4
  "description": "This project Softpro Admin",
5
5
  "main": "dist/admin.js",
6
6
  "type": "module",
@@ -82,9 +82,12 @@ export default async function plugin(fastify) {
82
82
  if (type === 'select') {
83
83
  clsQuery.push(`insert into admin.cls(name,type,data,module) values('${name}','sql','${(loadTemplate?.sql || loadTemplate)?.replace(/'/g, "''")}', '${module?.replace(/'/g, "''")}')`);
84
84
  } else if (type === 'cls' && loadTemplate?.length) {
85
+ if (name === 'appeal_type') {
86
+ console.log('hit');
87
+ }
85
88
  clsQuery.push(`insert into admin.cls(name,type, module) values('${name}','json', '${module?.replace(/'/g, "''")}');
86
- insert into admin.cls(code,name,parent,icon)
87
- select value->>'id',value->>'text','${name}',value->>'icon'
89
+ insert into admin.cls(code,name,parent,icon,data)
90
+ select value->>'id',value->>'text','${name}',value->>'icon',value->>'data'
88
91
  from json_array_elements('${JSON.stringify(loadTemplate).replace(/'/g, "''")}'::json)`);
89
92
  } else {
90
93
  console.log(name, type, 'empty');
@@ -70,7 +70,7 @@ export default async function notification({
70
70
  if (provider.includes('email')) {
71
71
  const files = Array.isArray(file) ? file : [file];
72
72
  const attachments = files?.length && false ? await Promise.all(files?.filter((el) => el).map(async (el) => {
73
- /* const content = await downloadFile(el, { funcs, buffer: true }); // ?
73
+ /* const content = await downloadFile(el, { buffer: true }); // ?
74
74
  return {
75
75
  filename: el.split('/').pop(),
76
76
  encoding: 'base64',
@@ -5,7 +5,7 @@ import { config, getRedis } from '@opengis/fastify-table/utils.js';
5
5
  import { getSettings } from '../../../../utils.js';
6
6
 
7
7
  export default async function getSettingsAPI({
8
- pg = {}, funcs = {}, params = {}, query = {},
8
+ pg = {}, params = {}, query = {},
9
9
  }) {
10
10
  if (!pg.pk?.[table]) {
11
11
  return { message: 'table not found', status: 404 };
@@ -3,7 +3,7 @@ const table = 'admin.properties';
3
3
  import { setSettings } from '../../../../utils.js';
4
4
 
5
5
  export default async function postSettingsAPI({
6
- pg, session = {}, funcs, body = {},
6
+ pg, session = {}, body = {},
7
7
  }) {
8
8
  if (session.passport?.user?.user_type !== 'superadmin') {
9
9
  return { message: 'access restricted', status: 403 };
@@ -18,7 +18,7 @@ export default async function postSettingsAPI({
18
18
  }
19
19
 
20
20
  const res = await setSettings({
21
- pg, funcs, key, val, body,
21
+ pg, key, val, body,
22
22
  });
23
23
  if (res?.error) return res;
24
24
 
@@ -1,9 +1,9 @@
1
- import { applyHook, getTemplate, getToken } from "@opengis/fastify-table/utils.js";
1
+ import { config, applyHook, getTemplate, getToken } from "@opengis/fastify-table/utils.js";
2
2
  // import { getToken } from "../../../../../fastify-table/utils.js";
3
3
 
4
4
  export default async function getTemplateApi(req) {
5
5
  const { user } = req?.session?.passport || {};
6
- const { funcs, params = {}, session = {} } = req;
6
+ const { params = {}, session = {} } = req;
7
7
  const { type, name } = params;
8
8
 
9
9
  const tokenData = await getToken({ token: name, uid: user?.uid, json: 1 }) || {};
@@ -16,7 +16,7 @@ export default async function getTemplateApi(req) {
16
16
  const data = await getTemplate(type, hookData?.name || tokenData.form || name);
17
17
  if (!['interface', 'table'].includes(type)
18
18
  && (!data?.public || !data?.ispublic)
19
- && !funcs?.config?.auth?.disable
19
+ && !config?.auth?.disable
20
20
  && !session.passport?.user?.uid
21
21
  && false
22
22
  ) {