@opengis/fastify-table 1.1.148 → 1.1.150

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/fastify-table",
3
- "version": "1.1.148",
3
+ "version": "1.1.150",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [
@@ -21,6 +21,8 @@ ALTER TABLE admin.users add column if not exists last_activity_date timestamp wi
21
21
  ALTER TABLE admin.users add column if not exists user_type text DEFAULT 'regular'::text;
22
22
  ALTER TABLE admin.users add column if not exists user_rnokpp text;
23
23
  ALTER TABLE admin.users alter column user_rnokpp drop not null;
24
+ ALTER TABLE admin.users add column if not exists social_auth_id text;
25
+ ALTER TABLE admin.users add column if not exists social_auth_type text;
24
26
  ALTER TABLE admin.users add column if not exists salt text;
25
27
  ALTER TABLE admin.users add column if not exists cdate timestamp without time zone DEFAULT date_trunc('seconds'::text, now());
26
28
  ALTER TABLE admin.users add column if not exists editor_id text;
@@ -1,5 +1,9 @@
1
- const dateTypeList = ['date', 'timestamp', 'timestamp without time zone'];
1
+ const dateTypeList = ['date', 'timestamp', 'timestamp without time zone', 'timestamp with time zone'];
2
2
  const numberTypeList = ['float8', 'int4', 'int8', 'numeric', 'double precision', 'integer'];
3
+ const isValidDate = (dateStr) => {
4
+ const [dd, mm, yyyy] = dateStr.split('.');
5
+ return new Date(mm + '/' + dd + '/' + yyyy).toString() !== 'Invalid Date';
6
+ };
3
7
 
4
8
  function dt(y, m, d) {
5
9
  return new Date(Date.UTC(y, m, d)).toISOString().slice(0, 10);
@@ -53,6 +57,10 @@ function formatValue({
53
57
  const [startDate, endDate] = value.split('-');
54
58
  const min = formatDateISOString(startDate);
55
59
  const max = formatDateISOString(endDate);
60
+
61
+ if (!isValidDate(startDate) || !isValidDate(endDate)) {
62
+ return { op: 'between', query: 'false', extra };
63
+ }
56
64
  const query = extra && pk
57
65
  ? `${pk} in (select object_id from crm.extra_data where property_key='${name}' and value_date::date >= '${min}'::date and value_date::date <= '${max}'::date)`
58
66
  : `${name}::date >= '${min}'::date and ${name}::date <= '${max}'::date`;
@@ -1,3 +1,4 @@
1
+ import config from '../../../../config.js';
1
2
  import pgClients from '../../pg/pgClients.js';
2
3
  import getTemplate from './getTemplate.js';
3
4
 
@@ -10,7 +11,7 @@ const sqls = {
10
11
  };
11
12
 
12
13
  export default async function getSelect(name, pg = pgClients.client) {
13
- if (loadCls[name] && false) return loadCls[name];
14
+ if (loadCls[name] && !config.local) return loadCls[name];
14
15
 
15
16
  const clsDataGIT = await getTemplate(['cls', 'select'], name);
16
17
  const { type } = !clsDataGIT && pg.pk?.['admin.user_cls'] ? await pg.query('select type from admin.user_cls where parent is null and name=$1 union all select type from admin.cls where parent is null and name=$1 limit 1', [name]).then(el => el.rows?.[0] || {}) : {};