@opengis/fastify-table 1.1.6 → 1.1.7

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.
Files changed (47) hide show
  1. package/README.md +26 -26
  2. package/config.js +10 -10
  3. package/cron/controllers/cronApi.js +22 -22
  4. package/cron/controllers/utils/cronList.js +1 -1
  5. package/cron/funcs/addCron.js +131 -131
  6. package/cron/index.js +10 -10
  7. package/crud/controllers/utils/checkXSS.js +45 -45
  8. package/crud/controllers/utils/xssInjection.js +72 -72
  9. package/crud/funcs/dataUpdate.js +30 -30
  10. package/crud/funcs/getToken.js +27 -27
  11. package/crud/funcs/isFileExists.js +13 -13
  12. package/crud/funcs/setToken.js +53 -53
  13. package/notification/controllers/testEmail.js +49 -49
  14. package/notification/funcs/utils/sendEmail.js +39 -39
  15. package/notification/index.js +38 -38
  16. package/package.json +1 -1
  17. package/pg/funcs/getPG.js +30 -30
  18. package/redis/funcs/getRedis.js +23 -23
  19. package/server/migrations/crm.sql +150 -150
  20. package/server/migrations/log.sql +80 -80
  21. package/server/templates/select/test.storage.data.json +3 -3
  22. package/server/templates/select/test.suggest.ato_new.json +2 -2
  23. package/server/templates/select/test.suggest.ato_new.sql +25 -25
  24. package/server/templates/select/test.suggest.data.json +4 -4
  25. package/server/templates/select/test.suggest.parent.sql +2 -2
  26. package/server.js +14 -14
  27. package/table/controllers/card.js +44 -44
  28. package/table/controllers/form.js +28 -28
  29. package/table/controllers/utils/getSelect.js +6 -7
  30. package/test/api/crud.xss.test.js +72 -72
  31. package/test/api/notification.test.js +37 -37
  32. package/test/api/suggest.test.js +65 -65
  33. package/test/config.example +18 -18
  34. package/test/funcs/notification.test.js +31 -31
  35. package/test/funcs/pg.test.js +34 -34
  36. package/test/funcs/redis.test.js +19 -19
  37. package/test/templates/cls/test.json +9 -9
  38. package/test/templates/form/cp_building.form.json +32 -32
  39. package/test/templates/select/account_id.json +3 -3
  40. package/test/templates/select/storage.data.json +2 -2
  41. package/test/templates/table/gis.dataset.table.json +20 -20
  42. package/util/controllers/logger.file.js +90 -90
  43. package/util/controllers/next.id.js +4 -4
  44. package/util/controllers/properties.get.js +19 -19
  45. package/util/controllers/utils/checkUserAccess.js +19 -19
  46. package/util/controllers/utils/getRootDir.js +20 -20
  47. package/util/index.js +23 -23
@@ -1,44 +1,44 @@
1
- import getTemplate from './utils/getTemplate.js';
2
- import getMeta from '../../pg/funcs/getMeta.js';
3
- import metaFormat from '../funcs/metaFormat/index.js';
4
-
5
- export default async function card(req) {
6
- const time = Date.now();
7
- const {
8
- pg, params = {}, query = {}, opt = {},
9
- } = req;
10
-
11
- const loadTable = await getTemplate('table', params.table);
12
-
13
- if (!loadTable) { return { message: 'template not found', status: 404 }; }
14
-
15
- const {
16
- table, columns, meta, sql, cardSql,
17
- } = loadTable;
18
-
19
- const { pk, columns: dbColumns = [] } = await getMeta(table);
20
-
21
- if (!pk) return { message: `table not found: ${table}`, status: 404 };
22
-
23
- const cols = columns.map((el) => el.name || el).join(',');
24
- const columnList = dbColumns.map((el) => el.name || el).join(',');
25
- const sqlTable = sql?.filter?.((el) => !el?.disabled && el?.sql?.replace).map((el, i) => ` left join lateral (${el.sql}) ${el.name || `t${i}`} on 1=1 `)?.join('') || '';
26
- const cardSqlFiltered = opt.id || params.id ? cardSql?.filter?.((el) => !el?.disabled && el?.name && el?.sql?.replace) : [];
27
- const cardSqlTable = cardSqlFiltered?.length ? cardSqlFiltered.map((el, i) => ` left join lateral (select json_agg(row_to_json(q)) as ${el.name} from (${el.sql})q) ct${i} on 1=1 `).join('') || '' : '';
28
-
29
- const where = [`"${pk}" = $1`, loadTable.query].filter((el) => el);
30
- const cardColumns = cardSqlFiltered?.length ? `,${cardSqlFiltered.map((el) => el.name)}` : '';
31
- const q = `select ${pk ? `"${pk}" as id,` : ''} ${columnList.includes('geom') ? 'st_asgeojson(geom)::json as geom,' : ''} ${cols || '*'} ${cardColumns} from ${table} t ${sqlTable} ${cardSqlTable}
32
- where ${where.join(' and ') || 'true'} limit 1`;
33
-
34
- if (query.sql === '1') { return q; }
35
-
36
- const { rows } = await pg.query(q, [opt.id || params.id]);
37
-
38
- await metaFormat({ rows, table: params.table });
39
-
40
- const data = meta.card?.length ? meta.card.reduce((acc, curr) => Object.assign(acc, { [columns.find((col) => col.name === curr)?.ua || '']: rows[0][curr] }), {}) : {};
41
- return {
42
- time: Date.now() - time, data,
43
- };
44
- }
1
+ import getTemplate from './utils/getTemplate.js';
2
+ import getMeta from '../../pg/funcs/getMeta.js';
3
+ import metaFormat from '../funcs/metaFormat/index.js';
4
+
5
+ export default async function card(req) {
6
+ const time = Date.now();
7
+ const {
8
+ pg, params = {}, query = {}, opt = {},
9
+ } = req;
10
+
11
+ const loadTable = await getTemplate('table', params.table);
12
+
13
+ if (!loadTable) { return { message: 'template not found', status: 404 }; }
14
+
15
+ const {
16
+ table, columns, meta, sql, cardSql,
17
+ } = loadTable;
18
+
19
+ const { pk, columns: dbColumns = [] } = await getMeta(table);
20
+
21
+ if (!pk) return { message: `table not found: ${table}`, status: 404 };
22
+
23
+ const cols = columns.map((el) => el.name || el).join(',');
24
+ const columnList = dbColumns.map((el) => el.name || el).join(',');
25
+ const sqlTable = sql?.filter?.((el) => !el?.disabled && el?.sql?.replace).map((el, i) => ` left join lateral (${el.sql}) ${el.name || `t${i}`} on 1=1 `)?.join('') || '';
26
+ const cardSqlFiltered = opt.id || params.id ? cardSql?.filter?.((el) => !el?.disabled && el?.name && el?.sql?.replace) : [];
27
+ const cardSqlTable = cardSqlFiltered?.length ? cardSqlFiltered.map((el, i) => ` left join lateral (select json_agg(row_to_json(q)) as ${el.name} from (${el.sql})q) ct${i} on 1=1 `).join('') || '' : '';
28
+
29
+ const where = [`"${pk}" = $1`, loadTable.query].filter((el) => el);
30
+ const cardColumns = cardSqlFiltered?.length ? `,${cardSqlFiltered.map((el) => el.name)}` : '';
31
+ const q = `select ${pk ? `"${pk}" as id,` : ''} ${columnList.includes('geom') ? 'st_asgeojson(geom)::json as geom,' : ''} ${cols || '*'} ${cardColumns} from ${table} t ${sqlTable} ${cardSqlTable}
32
+ where ${where.join(' and ') || 'true'} limit 1`;
33
+
34
+ if (query.sql === '1') { return q; }
35
+
36
+ const { rows } = await pg.query(q, [opt.id || params.id]);
37
+
38
+ await metaFormat({ rows, table: params.table });
39
+
40
+ const data = meta.card?.length ? meta.card.reduce((acc, curr) => Object.assign(acc, { [columns.find((col) => col.name === curr)?.ua || '']: rows[0][curr] }), {}) : {};
41
+ return {
42
+ time: Date.now() - time, data,
43
+ };
44
+ }
@@ -1,28 +1,28 @@
1
- import getTemplate from './utils/getTemplate.js';
2
-
3
- const sql = `select property_key as key, property_json as json, property_int as int,
4
- property_text as text from admin.properties where 1=1`;
5
-
6
- async function getSettings({ pg }) {
7
- const { rows = [] } = await pg.query(sql);
8
- const data = rows.reduce((acc, curr) => Object.assign(acc, { [curr.key]: curr.json || curr.int || curr.text }), {});
9
- return data;
10
- }
11
-
12
- export default async function formFunction(req) {
13
- const time = Date.now();
14
- const { pg, params } = req;
15
- const form = await getTemplate('form', params.form);
16
- if (!form) { return { status: 404, message: 'not found' }; }
17
-
18
- // replace settings
19
- const arr = JSON.stringify(form).match(/{{settings.([^}]*)}}/g);
20
- if (arr?.length) {
21
- const string = JSON.stringify(form);
22
- const settings = await getSettings({ pg });
23
- const match = arr.reduce((acc, curr) => Object.assign(acc, { [curr]: settings[curr.replace(/^{{settings./g, '').replace(/}}$/, '')] }), {});
24
- const res = Object.keys(match).reduce((s, m) => s.replace(m, match[m]), string);
25
- return { time: Date.now() - time, form: JSON.parse(res) };
26
- }
27
- return { time: Date.now() - time, form };
28
- }
1
+ import getTemplate from './utils/getTemplate.js';
2
+
3
+ const sql = `select property_key as key, property_json as json, property_int as int,
4
+ property_text as text from admin.properties where 1=1`;
5
+
6
+ async function getSettings({ pg }) {
7
+ const { rows = [] } = await pg.query(sql);
8
+ const data = rows.reduce((acc, curr) => Object.assign(acc, { [curr.key]: curr.json || curr.int || curr.text }), {});
9
+ return data;
10
+ }
11
+
12
+ export default async function formFunction(req) {
13
+ const time = Date.now();
14
+ const { pg, params } = req;
15
+ const form = await getTemplate('form', params.form);
16
+ if (!form) { return { status: 404, message: 'not found' }; }
17
+
18
+ // replace settings
19
+ const arr = JSON.stringify(form).match(/{{settings.([^}]*)}}/g);
20
+ if (arr?.length) {
21
+ const string = JSON.stringify(form);
22
+ const settings = await getSettings({ pg });
23
+ const match = arr.reduce((acc, curr) => Object.assign(acc, { [curr]: settings[curr.replace(/^{{settings./g, '').replace(/}}$/, '')] }), {});
24
+ const res = Object.keys(match).reduce((s, m) => s.replace(m, match[m]), string);
25
+ return { time: Date.now() - time, form: JSON.parse(res) };
26
+ }
27
+ return { time: Date.now() - time, form };
28
+ }
@@ -5,16 +5,15 @@ const loadCls = {};
5
5
  export default async function getSelect(name) {
6
6
  if (loadCls[name]) return loadCls[name];
7
7
 
8
- const clsData = await getTemplate('cls', name);
9
- // console.log(clsData);
10
- if (clsData) {
8
+ const clsData = await getTemplate(['cls', 'select'], name);
9
+ if (!clsData) { return null; }
10
+
11
+ // console.log(clsData);
12
+ if (clsData && Array.isArray(clsData)) {
11
13
  loadCls[name] = { arr: clsData };
12
14
  return loadCls[name];
13
15
  }
14
16
 
15
- const selectData = await getTemplate('select', name);
16
- if (!selectData) { return null; }
17
-
18
- loadCls[name] = selectData;
17
+ loadCls[name] = clsData.sql ? clsData : { sql: clsData };
19
18
  return loadCls[name];
20
19
  }
@@ -1,72 +1,72 @@
1
- import { test } from 'node:test';
2
- import assert from 'node:assert';
3
-
4
- import build from '../../helper.js';
5
-
6
- import setToken from '../../crud/funcs/setToken.js';
7
- import config from '../config.js';
8
-
9
- test('api crud xss', async (t) => {
10
- const app = await build(t);
11
- const session = { passport: { user: { uid: '1' } } };
12
- app.addHook('onRequest', async (req) => {
13
- req.session = session;
14
- });
15
- // app.decorateRequest('session', session);
16
-
17
- const prefix = config.prefix || '/api';
18
-
19
- let addTokens;
20
- let editTokens;
21
-
22
- // before
23
- t.test('setToken', async () => {
24
- addTokens = setToken({
25
- ids: [JSON.stringify({ add: 'gis.dataset', form: 'test.dataset.form' })],
26
- mode: 'a',
27
- uid: 1,
28
- array: 1,
29
- });
30
- editTokens = setToken({
31
- ids: [JSON.stringify({ id: '5400000', table: 'gis.dataset', form: 'test.dataset.form' })],
32
- mode: 'w',
33
- uid: 1,
34
- array: 1,
35
- });
36
- assert.ok(addTokens.length === 1 && editTokens.length === 1, 'invalid token');
37
- });
38
-
39
- await t.test('POST /insert', async () => {
40
- const res = await app.inject({
41
- method: 'POST',
42
- url: `${prefix}/table/${addTokens[0]}`,
43
- body: { dataset_name: '<a onClick="alert("XSS Injection")">xss injection</a>', dataset_id: '5400000' },
44
- });
45
-
46
- const rep = JSON.parse(res?.body);
47
- console.log(rep)
48
- assert.ok(rep.status, 409);
49
- });
50
-
51
- await t.test('PUT /update', async () => {
52
- const res = await app.inject({
53
- method: 'PUT',
54
- url: `${prefix}/table/${editTokens[0]}/${editTokens[0]}`,
55
- body: { editor_id: '11', dataset_name: '<a onClick="alert("XSS Injection")">xss injection</a>' },
56
- });
57
-
58
- const rep = JSON.parse(res?.body);
59
- console.log(rep)
60
- assert.equal(rep.status, 409);
61
- });
62
- await t.test('DELETE /delete', async () => {
63
- const res = await app.inject({
64
- method: 'DELETE',
65
- url: `${prefix}/table/gis.dataset/5400000`,
66
- });
67
-
68
- const rep = JSON.parse(res?.body);
69
- console.log(rep)
70
- assert.ok(rep);
71
- });
72
- });
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert';
3
+
4
+ import build from '../../helper.js';
5
+
6
+ import setToken from '../../crud/funcs/setToken.js';
7
+ import config from '../config.js';
8
+
9
+ test('api crud xss', async (t) => {
10
+ const app = await build(t);
11
+ const session = { passport: { user: { uid: '1' } } };
12
+ app.addHook('onRequest', async (req) => {
13
+ req.session = session;
14
+ });
15
+ // app.decorateRequest('session', session);
16
+
17
+ const prefix = config.prefix || '/api';
18
+
19
+ let addTokens;
20
+ let editTokens;
21
+
22
+ // before
23
+ t.test('setToken', async () => {
24
+ addTokens = setToken({
25
+ ids: [JSON.stringify({ add: 'gis.dataset', form: 'test.dataset.form' })],
26
+ mode: 'a',
27
+ uid: 1,
28
+ array: 1,
29
+ });
30
+ editTokens = setToken({
31
+ ids: [JSON.stringify({ id: '5400000', table: 'gis.dataset', form: 'test.dataset.form' })],
32
+ mode: 'w',
33
+ uid: 1,
34
+ array: 1,
35
+ });
36
+ assert.ok(addTokens.length === 1 && editTokens.length === 1, 'invalid token');
37
+ });
38
+
39
+ await t.test('POST /insert', async () => {
40
+ const res = await app.inject({
41
+ method: 'POST',
42
+ url: `${prefix}/table/${addTokens[0]}`,
43
+ body: { dataset_name: '<a onClick="alert("XSS Injection")">xss injection</a>', dataset_id: '5400000' },
44
+ });
45
+
46
+ const rep = JSON.parse(res?.body);
47
+ console.log(rep)
48
+ assert.ok(rep.status, 409);
49
+ });
50
+
51
+ await t.test('PUT /update', async () => {
52
+ const res = await app.inject({
53
+ method: 'PUT',
54
+ url: `${prefix}/table/${editTokens[0]}/${editTokens[0]}`,
55
+ body: { editor_id: '11', dataset_name: '<a onClick="alert("XSS Injection")">xss injection</a>' },
56
+ });
57
+
58
+ const rep = JSON.parse(res?.body);
59
+ console.log(rep)
60
+ assert.equal(rep.status, 409);
61
+ });
62
+ await t.test('DELETE /delete', async () => {
63
+ const res = await app.inject({
64
+ method: 'DELETE',
65
+ url: `${prefix}/table/gis.dataset/5400000`,
66
+ });
67
+
68
+ const rep = JSON.parse(res?.body);
69
+ console.log(rep)
70
+ assert.ok(rep);
71
+ });
72
+ });
@@ -1,37 +1,37 @@
1
- import { test } from 'node:test';
2
- import assert from 'node:assert';
3
-
4
- import build from '../../helper.js';
5
- import config from '../config.js';
6
-
7
- const session = { passport: { user: { uid: config.testUser?.uid || '1' } } };
8
-
9
- import userNotifications from '../../notification/controllers/userNotifications.js';
10
-
11
- import pgClients from '../../pg/pgClients.js';
12
-
13
- test('api && funcs notification', async (t) => {
14
- const app = await build(t);
15
- const pg = pgClients.client;
16
- /*
17
- // require dependency
18
- await t.test('GET /auth', async () => {
19
- const res = await app.inject({
20
- method: 'GET',
21
- url: `/api/login?username=${config.testUser?.username}&password=${config.testUser?.password}`,
22
- });
23
- assert.ok(res.statusCode);
24
- });
25
- await t.test('GET /notification', async () => {
26
- const res = await app.inject({
27
- method: 'GET',
28
- url: '/api/notification',
29
- });
30
- const rep = JSON.parse(res?.body);
31
- assert.ok(rep.time);
32
- }); */
33
- /* await t.test('GET /notification', async () => {
34
- const rep = await userNotifications({ pg, session });
35
- assert.ok(rep.time);
36
- }); */
37
- });
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert';
3
+
4
+ import build from '../../helper.js';
5
+ import config from '../config.js';
6
+
7
+ const session = { passport: { user: { uid: config.testUser?.uid || '1' } } };
8
+
9
+ import userNotifications from '../../notification/controllers/userNotifications.js';
10
+
11
+ import pgClients from '../../pg/pgClients.js';
12
+
13
+ test('api && funcs notification', async (t) => {
14
+ const app = await build(t);
15
+ const pg = pgClients.client;
16
+ /*
17
+ // require dependency
18
+ await t.test('GET /auth', async () => {
19
+ const res = await app.inject({
20
+ method: 'GET',
21
+ url: `/api/login?username=${config.testUser?.username}&password=${config.testUser?.password}`,
22
+ });
23
+ assert.ok(res.statusCode);
24
+ });
25
+ await t.test('GET /notification', async () => {
26
+ const res = await app.inject({
27
+ method: 'GET',
28
+ url: '/api/notification',
29
+ });
30
+ const rep = JSON.parse(res?.body);
31
+ assert.ok(rep.time);
32
+ }); */
33
+ /* await t.test('GET /notification', async () => {
34
+ const rep = await userNotifications({ pg, session });
35
+ assert.ok(rep.time);
36
+ }); */
37
+ });
@@ -1,66 +1,66 @@
1
- import { test } from 'node:test';
2
- import assert from 'node:assert';
3
-
4
- import build from '../../helper.js';
5
-
6
- test('api suggest', async (t) => {
7
- const app = await build(t);
8
-
9
- await t.test('GET /suggest', async () => {
10
- const res = await app.inject({
11
- method: 'GET',
12
- url: `/api/suggest/test.storage.data`,
13
- });
14
- const rep = JSON.parse(res?.body);
15
- // console.log(rep);
16
- assert.equal(res?.statusCode, 200);
17
- assert.ok(rep?.count);
18
- });
19
-
20
- await t.test('GET /suggest key query', async () => {
21
- const key = 'Новокиївка';
22
- const res = await app.inject({
23
- method: 'GET',
24
- url: `/api/suggest/test.suggest.ato_new?key=${key}`,
25
- });
26
- const rep = JSON.parse(res?.body);
27
- // console.log(rep);
28
- assert.equal(res?.statusCode, 200);
29
- assert.ok(rep?.count);
30
- });
31
-
32
- await t.test('GET /suggest key searchColumn', async () => {
33
- const key = 'data_address.addr_city';
34
- const res = await app.inject({
35
- method: 'GET',
36
- url: `/api/suggest/test.storage.data?key=${key}`,
37
- });
38
- const rep = JSON.parse(res?.body);
39
- // console.log(rep);
40
- assert.equal(res?.statusCode, 200);
41
- assert.ok(rep?.count);
42
- });
43
-
44
- await t.test('GET /suggest інша db', async () => {
45
- const res = await app.inject({
46
- method: 'GET',
47
- url: `/api/suggest/test.suggest.data`,
48
- });
49
- const rep = JSON.parse(res?.body);
50
- // console.log(rep);
51
- assert.equal(res?.statusCode, 200);
52
- assert.ok(rep?.count);
53
- });
54
-
55
- await t.test('GET /suggest parent', async () => {
56
- const parent = '3206158274160231699';
57
- const res = await app.inject({
58
- method: 'GET',
59
- url: `/api/suggest/test.suggest.parent?parent=${parent}`,
60
- });
61
- const rep = JSON.parse(res?.body);
62
- // console.log(rep);
63
- assert.equal(res?.statusCode, 200);
64
- assert.ok(rep?.count);
65
- });
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert';
3
+
4
+ import build from '../../helper.js';
5
+
6
+ test('api suggest', async (t) => {
7
+ const app = await build(t);
8
+
9
+ await t.test('GET /suggest', async () => {
10
+ const res = await app.inject({
11
+ method: 'GET',
12
+ url: `/api/suggest/test.storage.data`,
13
+ });
14
+ const rep = JSON.parse(res?.body);
15
+ // console.log(rep);
16
+ assert.equal(res?.statusCode, 200);
17
+ assert.ok(rep?.count);
18
+ });
19
+
20
+ await t.test('GET /suggest key query', async () => {
21
+ const key = 'Новокиївка';
22
+ const res = await app.inject({
23
+ method: 'GET',
24
+ url: `/api/suggest/test.suggest.ato_new?key=${key}`,
25
+ });
26
+ const rep = JSON.parse(res?.body);
27
+ // console.log(rep);
28
+ assert.equal(res?.statusCode, 200);
29
+ assert.ok(rep?.count);
30
+ });
31
+
32
+ await t.test('GET /suggest key searchColumn', async () => {
33
+ const key = 'data_address.addr_city';
34
+ const res = await app.inject({
35
+ method: 'GET',
36
+ url: `/api/suggest/test.storage.data?key=${key}`,
37
+ });
38
+ const rep = JSON.parse(res?.body);
39
+ // console.log(rep);
40
+ assert.equal(res?.statusCode, 200);
41
+ assert.ok(rep?.count);
42
+ });
43
+
44
+ await t.test('GET /suggest інша db', async () => {
45
+ const res = await app.inject({
46
+ method: 'GET',
47
+ url: `/api/suggest/test.suggest.data`,
48
+ });
49
+ const rep = JSON.parse(res?.body);
50
+ // console.log(rep);
51
+ assert.equal(res?.statusCode, 200);
52
+ assert.ok(rep?.count);
53
+ });
54
+
55
+ await t.test('GET /suggest parent', async () => {
56
+ const parent = '3206158274160231699';
57
+ const res = await app.inject({
58
+ method: 'GET',
59
+ url: `/api/suggest/test.suggest.parent?parent=${parent}`,
60
+ });
61
+ const rep = JSON.parse(res?.body);
62
+ // console.log(rep);
63
+ assert.equal(res?.statusCode, 200);
64
+ assert.ok(rep?.count);
65
+ });
66
66
  })
@@ -1,18 +1,18 @@
1
- import config from '../config.js';
2
-
3
- Object.assign(config, {
4
- folder: 'test/templates',
5
- pg: {
6
- host: '192.168.3.160',
7
- port: 5434,
8
- database: 'mbk_rivne_dma',
9
- user: 'postgres',
10
- password: 'postgres',
11
- },
12
- redis: {
13
- host: '192.168.3.160',
14
- port: 6379,
15
- family: 4,
16
- },
17
- });
18
- export default config;
1
+ import config from '../config.js';
2
+
3
+ Object.assign(config, {
4
+ folder: 'test/templates',
5
+ pg: {
6
+ host: '192.168.3.160',
7
+ port: 5434,
8
+ database: 'mbk_rivne_dma',
9
+ user: 'postgres',
10
+ password: 'postgres',
11
+ },
12
+ redis: {
13
+ host: '192.168.3.160',
14
+ port: 6379,
15
+ family: 4,
16
+ },
17
+ });
18
+ export default config;
@@ -1,31 +1,31 @@
1
- import { test } from 'node:test';
2
- import assert from 'node:assert';
3
-
4
- // import build from '../../helper.js';
5
- // import config from '../config.js';
6
-
7
- // import addNotification from '../../notification/funcs/addNotification.js';
8
-
9
- // import pgClients from '../../pg/pgClients.js';
10
-
11
- test('notification funcs', async (t) => {
12
- // await build(t);
13
- // const pg = pgClients.client;
14
- // let resp;
15
- /* await t.test('addNotification', async () => {
16
- resp = await addNotification({
17
- pg,
18
-
19
- title: 'test title',
20
- body: 'test body',
21
- link: 'http://link',
22
- notificationType: 'mention',
23
- uid: config.testUser?.uid || '1',
24
- });
25
- assert.ok(resp.id);
26
- });
27
- await t.test('clean up after test, before pool is closed', async () => {
28
- await pg.query('delete from crm.notification where notification_id=$1', [resp.id]);
29
- console.log(resp.id, 'deleted');
30
- }); */
31
- });
1
+ import { test } from 'node:test';
2
+ import assert from 'node:assert';
3
+
4
+ // import build from '../../helper.js';
5
+ // import config from '../config.js';
6
+
7
+ // import addNotification from '../../notification/funcs/addNotification.js';
8
+
9
+ // import pgClients from '../../pg/pgClients.js';
10
+
11
+ test('notification funcs', async (t) => {
12
+ // await build(t);
13
+ // const pg = pgClients.client;
14
+ // let resp;
15
+ /* await t.test('addNotification', async () => {
16
+ resp = await addNotification({
17
+ pg,
18
+
19
+ title: 'test title',
20
+ body: 'test body',
21
+ link: 'http://link',
22
+ notificationType: 'mention',
23
+ uid: config.testUser?.uid || '1',
24
+ });
25
+ assert.ok(resp.id);
26
+ });
27
+ await t.test('clean up after test, before pool is closed', async () => {
28
+ await pg.query('delete from crm.notification where notification_id=$1', [resp.id]);
29
+ console.log(resp.id, 'deleted');
30
+ }); */
31
+ });