@opengis/fastify-table 1.1.56 → 1.1.57
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/index.js +27 -14
- package/package.json +9 -4
- package/{cron → server/plugins/cron}/funcs/addCron.js +12 -12
- package/server/plugins/cron/index.js +6 -0
- package/{crud → server/plugins/crud}/funcs/dataDelete.js +3 -1
- package/{crud → server/plugins/crud}/funcs/dataInsert.js +3 -0
- package/{crud → server/plugins/crud}/funcs/dataUpdate.js +3 -1
- package/{crud → server/plugins/crud}/funcs/getAccess.js +5 -3
- package/{crud → server/plugins/crud}/funcs/getOpt.js +2 -0
- package/{crud → server/plugins/crud}/funcs/getToken.js +4 -1
- package/{crud → server/plugins/crud}/funcs/setOpt.js +3 -0
- package/{crud → server/plugins/crud}/funcs/setToken.js +4 -1
- package/{crud → server/plugins/crud}/funcs/utils/getFolder.js +2 -1
- package/{crud → server/plugins/crud}/funcs/utils/logChanges.js +2 -2
- package/server/plugins/crud/index.js +23 -0
- package/{hook → server/plugins/hook}/funcs/addHook.js +1 -1
- package/{hook → server/plugins/hook}/funcs/applyHook.js +2 -2
- package/server/plugins/hook/index.js +8 -0
- package/{logger → server/plugins/logger}/createFileStream.js +1 -1
- package/{logger → server/plugins/logger}/getLogger.js +1 -1
- package/{migration → server/plugins/migration/funcs}/exec.migrations.js +1 -1
- package/server/plugins/migration/index.js +7 -0
- package/{pg → server/plugins/pg}/funcs/getPG.js +3 -3
- package/{pg → server/plugins/pg}/funcs/getPGAsync.js +3 -3
- package/{pg → server/plugins/pg}/funcs/init.js +2 -4
- package/{pg → server/plugins/pg}/index.js +5 -14
- package/{pg → server/plugins/pg}/pgClients.js +2 -1
- package/{policy → server/plugins/policy}/funcs/checkPolicy.js +1 -1
- package/{crud/controllers/utils → server/plugins/policy/funcs}/checkXSS.js +1 -4
- package/{policy → server/plugins/policy}/index.js +0 -2
- package/{policy/funcs → server/plugins/policy}/sqlInjection.js +1 -1
- package/{redis → server/plugins/redis}/funcs/getRedis.js +2 -1
- package/{redis → server/plugins/redis}/funcs/redisClients.js +1 -0
- package/{redis → server/plugins/redis}/index.js +2 -6
- package/{table → server/plugins/table}/funcs/getFilterSQL/index.js +3 -1
- package/{table/controllers/utils → server/plugins/table/funcs}/getSelectMeta.js +1 -10
- package/{table/controllers/utils → server/plugins/table/funcs}/getTemplate.js +2 -1
- package/{table/controllers/utils → server/plugins/table/funcs}/getTemplatePath.js +3 -3
- package/{table/controllers/utils → server/plugins/table/funcs}/getTemplates.js +2 -1
- package/{table/controllers/utils → server/plugins/table/funcs}/gisIRColumn.js +4 -7
- package/{table → server/plugins/table}/funcs/metaFormat/getSelectVal.js +4 -2
- package/{table → server/plugins/table}/funcs/metaFormat/index.js +3 -1
- package/server/plugins/table/index.js +13 -0
- package/{util → server/plugins/util/funcs}/eventStream.js +1 -0
- package/server/plugins/util/index.js +7 -0
- package/{cron → server/routes/cron}/controllers/cronApi.js +1 -1
- package/{cron → server/routes/cron}/index.js +5 -3
- package/{crud → server/routes/crud}/controllers/deleteCrud.js +2 -2
- package/{crud → server/routes/crud}/controllers/insert.js +5 -3
- package/{crud → server/routes/crud}/controllers/update.js +3 -3
- package/server/routes/crud/index.js +19 -0
- package/{util → server/routes/logger}/controllers/logger.file.js +5 -5
- package/{util → server/routes/logger}/controllers/utils/checkUserAccess.js +1 -1
- package/{util → server/routes/logger}/controllers/utils/getRootDir.js +4 -3
- package/server/routes/logger/index.js +15 -0
- package/{util → server/routes/properties}/controllers/properties.add.js +19 -20
- package/server/routes/properties/controllers/properties.get.js +17 -0
- package/{util → server/routes/properties}/index.js +5 -8
- package/{table → server/routes/table}/controllers/card.js +3 -5
- package/{table → server/routes/table}/controllers/data.js +4 -10
- package/{table → server/routes/table}/controllers/filter.js +3 -4
- package/{table → server/routes/table}/controllers/form.js +1 -1
- package/{table → server/routes/table}/controllers/search.js +15 -17
- package/{table → server/routes/table}/controllers/suggest.js +8 -7
- package/{table → server/routes/table}/controllers/table.js +5 -7
- package/{table → server/routes/table}/index.js +1 -10
- package/{table → server/routes/table}/schema.js +1 -1
- package/{util → server/routes/util}/controllers/next.id.js +1 -1
- package/server/routes/util/index.js +11 -0
- package/utils.js +58 -50
- package/.eslintrc.cjs +0 -44
- package/.gitlab-ci.yml +0 -18
- package/Changelog.md +0 -352
- package/cron/schema.js +0 -8
- package/crud/index.js +0 -31
- package/crud/schema.js +0 -11
- package/docs/.vitepress/abbr.mjs +0 -26
- package/docs/.vitepress/config.mjs +0 -127
- package/docs/.vitepress/navigation.mjs +0 -82
- package/docs/.vitepress/theme/Layout.vue +0 -17
- package/docs/.vitepress/theme/components/NavigationLinks.vue +0 -102
- package/docs/.vitepress/theme/components/Panzoom.vue +0 -169
- package/docs/.vitepress/theme/index.mjs +0 -15
- package/docs/.vitepress/theme/style.scss +0 -163
- package/docs/abbr.json +0 -4
- package/docs/api/cron/cronApi.md +0 -56
- package/docs/api/crud/deleteCrud.md +0 -58
- package/docs/api/crud/insert.md +0 -82
- package/docs/api/crud/update.md +0 -85
- package/docs/api/index.md +0 -47
- package/docs/api/notification/testEmail.md +0 -91
- package/docs/api/table/card.md +0 -73
- package/docs/api/table/data.md +0 -134
- package/docs/api/table/export.md +0 -60
- package/docs/api/table/filter.md +0 -104
- package/docs/api/table/form.md +0 -126
- package/docs/api/table/search.md +0 -123
- package/docs/api/table/suggest.md +0 -156
- package/docs/api/table/table.md +0 -107
- package/docs/api/user/user.cls.id.md +0 -77
- package/docs/api/user/user.cls.md +0 -49
- package/docs/api/user/user.cls.post.md +0 -62
- package/docs/api/user/user.info.md +0 -37
- package/docs/api/utils/logger.file.md +0 -61
- package/docs/api/utils/next.id.md +0 -34
- package/docs/api/utils/properties.add.md +0 -127
- package/docs/api/utils/properties.get.md +0 -73
- package/docs/api/utils/status.monitor.md +0 -36
- package/docs/api/widget/widget.del.md +0 -76
- package/docs/api/widget/widget.get.md +0 -233
- package/docs/api/widget/widget.set.md +0 -88
- package/docs/db/admin.md +0 -947
- package/docs/db/crm.md +0 -564
- package/docs/db/index.md +0 -9
- package/docs/db/log.md +0 -204
- package/docs/hook/card/afterCard.md +0 -20
- package/docs/hook/card/preCard.md +0 -25
- package/docs/hook/data/afterData.md +0 -26
- package/docs/hook/data/preData.md +0 -26
- package/docs/hook/deleteCrud/afterDelete.md +0 -21
- package/docs/hook/deleteCrud/preDelete.md +0 -26
- package/docs/hook/form/afterForm.md +0 -19
- package/docs/hook/form/preForm.md +0 -26
- package/docs/hook/getTemplate/afterTemplate.md +0 -24
- package/docs/hook/getTemplate/preTemplate.md +0 -29
- package/docs/hook/index.md +0 -45
- package/docs/hook/insert/afterInsert.md +0 -41
- package/docs/hook/insert/preInsert.md +0 -25
- package/docs/hook/table/afterTable.md +0 -20
- package/docs/hook/table/preTable.md +0 -25
- package/docs/hook/update/afterUpdate.md +0 -41
- package/docs/hook/update/preUpdate.md +0 -25
- package/docs/index.md +0 -42
- package/docs/public/fastify-dark.svg +0 -4
- package/docs/public/fastify.svg +0 -1
- package/docs/public/logo-short-dark.svg +0 -12
- package/docs/public/logo-short.svg +0 -11
- package/docs/public/logo.svg +0 -19
- package/docs/readme/index.md +0 -121
- package/docs/templates/card.md +0 -83
- package/docs/templates/cls.md +0 -29
- package/docs/templates/filters.md +0 -91
- package/docs/templates/forms.md +0 -139
- package/docs/templates/image.png +0 -0
- package/docs/templates/index.md +0 -28
- package/docs/templates/select.md +0 -90
- package/docs/templates/table.md +0 -162
- package/docs/utils/cron/addCron.md +0 -29
- package/docs/utils/crud/dataInsert.md +0 -52
- package/docs/utils/crud/dataUpdate.md +0 -53
- package/docs/utils/crud/getOpt.md +0 -34
- package/docs/utils/crud/isFileExists.md +0 -38
- package/docs/utils/crud/setOpt.md +0 -38
- package/docs/utils/hook/addHook.md +0 -74
- package/docs/utils/hook/applyHook.md +0 -64
- package/docs/utils/index.md +0 -48
- package/docs/utils/notification/addNotification.md +0 -28
- package/docs/utils/notification/notification.md +0 -41
- package/docs/utils/pg/autoIndex.md +0 -22
- package/docs/utils/pg/getMeta.md +0 -59
- package/docs/utils/pg/getPG.md +0 -34
- package/docs/utils/pg/init.md +0 -30
- package/docs/utils/pg/pg.md +0 -70
- package/docs/utils/redis/getRedis.md +0 -36
- package/docs/utils/redis/rclient.md +0 -74
- package/docs/utils/table/getForm.md +0 -69
- package/docs/utils/table/getMeta.md +0 -56
- package/docs/utils/table/getSelect.md +0 -39
- package/docs/utils/table/getSelectMeta.md +0 -47
- package/docs/utils/table/getTable.md +0 -78
- package/helper.js +0 -30
- package/module/core/select/core.user_mentioned.sql +0 -2
- package/module/test/cls/itree.composition.json +0 -26
- package/module/test/table/test.rest_zone.table.json +0 -266
- package/notification/controllers/readNotifications.js +0 -27
- package/notification/controllers/testEmail.js +0 -46
- package/notification/controllers/userNotifications.js +0 -61
- package/notification/controllers/utils/pin-m-ty-media-record-outline+303070.png +0 -0
- package/notification/funcs/addNotification.js +0 -21
- package/notification/funcs/sendNotification.js +0 -111
- package/notification/funcs/utils/sendEmail.js +0 -39
- package/notification/index.js +0 -18
- package/notification/schema.js +0 -10
- package/server.js +0 -26
- package/table/controllers/utils/getTemplate_old.js +0 -28
- package/test/api/applyHook.test.js +0 -95
- package/test/api/crud.test.js +0 -89
- package/test/api/crud.xss.test.js +0 -80
- package/test/api/notification.test.js +0 -48
- package/test/api/suggest.test.js +0 -66
- package/test/api/table.test.js +0 -134
- package/test/api/user.test.js +0 -85
- package/test/api/widget.test.js +0 -117
- package/test/config.example +0 -18
- package/test/funcs/pg.test.js +0 -34
- package/test/funcs/redis.test.js +0 -19
- package/test/helper/formatDate.test.js +0 -62
- package/test/templates/cls/itree.quality_condition.json +0 -20
- package/test/templates/cls/itree.recommend copy.json +0 -26
- package/test/templates/cls/itree.recommend.json +0 -26
- package/test/templates/cls/itree.type_plant.json +0 -65
- package/test/templates/cls/test.json +0 -10
- package/test/templates/form/cp_building.form.json +0 -33
- package/test/templates/select/account_id.json +0 -4
- package/test/templates/select/account_id.sql +0 -1
- package/test/templates/select/atu.nsdi.ato_level.json +0 -4
- package/test/templates/select/atu.nsdi.ato_level.sql +0 -11
- package/test/templates/select/contact_id.sql +0 -1
- package/test/templates/select/storage.data.json +0 -3
- package/test/templates/select/storage.data.sql +0 -1
- package/test/templates/select/test.storage.data.json +0 -4
- package/test/templates/select/test.storage.data.sql +0 -1
- package/test/templates/select/test.suggest.ato_new.json +0 -4
- package/test/templates/select/test.suggest.ato_new.sql +0 -26
- package/test/templates/select/test.suggest.data.json +0 -5
- package/test/templates/select/test.suggest.data.sql +0 -1
- package/test/templates/select/test.suggest.parent.sql +0 -2
- package/test/templates/table/gis.dataset.table.json +0 -21
- package/test/templates/table/green_space.table.json +0 -383
- package/test/templates/table/service.json +0 -18
- package/user/controllers/user.cls.id.js +0 -14
- package/user/controllers/user.cls.js +0 -71
- package/user/controllers/user.cls.post.js +0 -52
- package/user/controllers/user.info.js +0 -17
- package/user/index.js +0 -17
- package/user/schema.js +0 -17
- package/util/controllers/properties.get.js +0 -17
- package/util/schema.js +0 -19
- package/widget/controllers/utils/historyFormat.js +0 -76
- package/widget/controllers/utils/obj2db.js +0 -13
- package/widget/controllers/widget.del.js +0 -41
- package/widget/controllers/widget.get.js +0 -96
- package/widget/controllers/widget.set.js +0 -74
- package/widget/index.js +0 -40
- /package/{cron/controllers/utils → server/plugins/cron}/cronList.js +0 -0
- /package/{crud → server/plugins/crud}/funcs/isFileExists.js +0 -0
- /package/{hook/funcs → server/plugins/hook}/hookList.js +0 -0
- /package/{logger → server/plugins/logger}/getHooks.js +0 -0
- /package/{logger → server/plugins/logger}/labels.js +0 -0
- /package/{logger → server/plugins/logger}/logger.test.api.js +0 -0
- /package/{logger → server/plugins/logger}/serializers.js +0 -0
- /package/{pg → server/plugins/pg}/funcs/autoIndex.js +0 -0
- /package/{pg → server/plugins/pg}/funcs/getMeta.js +0 -0
- /package/{pg → server/plugins/pg}/funcs/pgClients.js +0 -0
- /package/{crud/controllers/utils → server/plugins/policy}/xssInjection.js +0 -0
- /package/{redis → server/plugins/redis}/client.js +0 -0
- /package/{table/controllers/utils → server/plugins/table/funcs}/addTemplateDir.js +0 -0
- /package/{table → server/plugins/table}/funcs/getFilterSQL/util/formatValue.js +0 -0
- /package/{table → server/plugins/table}/funcs/getFilterSQL/util/getCustomQuery.js +0 -0
- /package/{table → server/plugins/table}/funcs/getFilterSQL/util/getFilterQuery.js +0 -0
- /package/{table → server/plugins/table}/funcs/getFilterSQL/util/getOptimizedQuery.js +0 -0
- /package/{table → server/plugins/table}/funcs/getFilterSQL/util/getTableSql.js +0 -0
- /package/{table/controllers/utils → server/plugins/table/funcs}/getSelect.js +0 -0
- /package/{table/controllers/utils → server/plugins/table/funcs}/loadTemplate.js +0 -0
- /package/{table/controllers/utils → server/plugins/table/funcs}/loadTemplatePath.js +0 -0
- /package/{table/controllers/utils → server/plugins/table/funcs}/userTemplateDir.js +0 -0
- /package/{util → server/routes/util}/controllers/status.monitor.js +0 -0
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"ua": "Зелені насадження",
|
|
3
|
-
"key": "green_space_id",
|
|
4
|
-
"sql": [
|
|
5
|
-
{
|
|
6
|
-
"sql": "select short_ukr,short_rus,full_rus,full_ukr,latin,tr_family,genus from itree.green_space_species where gss_id in (t.type_tree,t.type_bush) limit 1",
|
|
7
|
-
"name": "green_space_species_sql"
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
"sql": "select json_agg(file_path) as img_list from admin.doc_file where object_id=t.green_space_id and file_status=1",
|
|
11
|
-
"name": "image_sql"
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
"table": "itree.green_space_pass",
|
|
15
|
-
"form": "green_space.form",
|
|
16
|
-
"columns": [
|
|
17
|
-
{
|
|
18
|
-
"ua": "Інвентарний номер",
|
|
19
|
-
"name": "invent_number",
|
|
20
|
-
"meta": "id",
|
|
21
|
-
"format": "text"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"en": "Object name",
|
|
25
|
-
"ru": "Назва объекта",
|
|
26
|
-
"ua": "Назва об'єкта",
|
|
27
|
-
"name": "type_tree",
|
|
28
|
-
"meta": "title",
|
|
29
|
-
"data": "itree.type_plant",
|
|
30
|
-
"format": "select",
|
|
31
|
-
"html": "{{#ifCond type_plant 'in' '1,2,3,4,5,8'}}{{#ifCond type_plant '==' '1'}}{{select type_bush data=\"itree.type_bush\"}}{{/ifCond}}{{#ifCond type_plant 'in' '2,8'}}{{select type_tree data=\"itree.type_tree\" }}{{/ifCond}}{{#ifCond type_plant '==' '3'}}{{select type_hedge data=\"itree.type_hedge\"}}{{/ifCond}}{{#ifCond type_plant '==' '4'}}{{select type_lawn data=\"itree.type_lawn\"}}{{/ifCond}}{{#ifCond type_plant '==' '5'}}{{select type_flower data=\"itree.type_flower\"}}{{/ifCond}} {{^}}...{{/ifCond}}"
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
"en": "Type",
|
|
35
|
-
"ru": "Тип",
|
|
36
|
-
"ua": "Тип насадження",
|
|
37
|
-
"name": "type_plant",
|
|
38
|
-
"meta": "type",
|
|
39
|
-
"data": "itree.type_plant",
|
|
40
|
-
"format": "select"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
"name": "quality_condition",
|
|
44
|
-
"ua": "Якісний стан об'єкта",
|
|
45
|
-
"data": "itree.quality_condition",
|
|
46
|
-
"meta": "status",
|
|
47
|
-
"format": "badge"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
"en": "Recomendations",
|
|
51
|
-
"ru": "Рекомендации",
|
|
52
|
-
"ua": "Рекомендації",
|
|
53
|
-
"name": "recommend",
|
|
54
|
-
"data": "itree.recommend",
|
|
55
|
-
"meta": "other",
|
|
56
|
-
"format": "badge"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"name": "uid",
|
|
60
|
-
"ua": "Хто додав",
|
|
61
|
-
"width": "70",
|
|
62
|
-
"data": "contact_id",
|
|
63
|
-
"format": "select"
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"ua": "Зона відпочинку",
|
|
67
|
-
"hidden": true,
|
|
68
|
-
"meta": "other",
|
|
69
|
-
"name": "rz_id",
|
|
70
|
-
"format": "select",
|
|
71
|
-
"data": "rz_id"
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
"name": "address_id",
|
|
75
|
-
"ua": "Адреса",
|
|
76
|
-
"hidden": true,
|
|
77
|
-
"meta": "other",
|
|
78
|
-
"format": "select",
|
|
79
|
-
"data": "itree.address_id"
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"name": "age",
|
|
83
|
-
"ua": "Вік, років",
|
|
84
|
-
"meta": "other",
|
|
85
|
-
"hidden": true,
|
|
86
|
-
"format": "number"
|
|
87
|
-
},
|
|
88
|
-
{
|
|
89
|
-
"name": "height",
|
|
90
|
-
"ua": "Висота, м",
|
|
91
|
-
"meta": "other",
|
|
92
|
-
"hidden": true,
|
|
93
|
-
"format": "number"
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
"name": "diameter",
|
|
97
|
-
"ua": "Діаметр стовбура на висоті 1.3 м, см",
|
|
98
|
-
"meta": "other",
|
|
99
|
-
"hidden": true,
|
|
100
|
-
"format": "number"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
"name": "cdate",
|
|
104
|
-
"ua": "Дата",
|
|
105
|
-
"meta": "other",
|
|
106
|
-
"format": "date"
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"name": "amount",
|
|
110
|
-
"ua": "Кількіть (шт./м2)",
|
|
111
|
-
"meta": "other",
|
|
112
|
-
"hidden": true,
|
|
113
|
-
"format": "number"
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
"name": "area",
|
|
117
|
-
"ua": "Площа кв.м.",
|
|
118
|
-
"meta": "other",
|
|
119
|
-
"hidden": true,
|
|
120
|
-
"format": "number"
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
"ua": "Балансова вартість, грн",
|
|
124
|
-
"name": "cost",
|
|
125
|
-
"meta": "other",
|
|
126
|
-
"hidden": true,
|
|
127
|
-
"format": "text"
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
"ua": "Штрих-код",
|
|
131
|
-
"hidden": true,
|
|
132
|
-
"meta": "other",
|
|
133
|
-
"name": "barcode",
|
|
134
|
-
"format": "text"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
"name": "trunk_circ",
|
|
138
|
-
"ua": "Окружність стовбура, см",
|
|
139
|
-
"hidden": true,
|
|
140
|
-
"meta": "other",
|
|
141
|
-
"format": "number"
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
"name": "soil_condi",
|
|
145
|
-
"ua": "Розмір лунки",
|
|
146
|
-
"hidden": true,
|
|
147
|
-
"meta": "other",
|
|
148
|
-
"format": "select",
|
|
149
|
-
"data": "itree.soil_condi"
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
"name": "discrete_s",
|
|
153
|
-
"ua": "Рівень нахилу в градусах",
|
|
154
|
-
"hidden": true,
|
|
155
|
-
"meta": "other",
|
|
156
|
-
"format": "select",
|
|
157
|
-
"data": "itree.discrete_s"
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
"name": "undercut",
|
|
161
|
-
"ua": "Підрізка",
|
|
162
|
-
"hidden": true,
|
|
163
|
-
"meta": "other",
|
|
164
|
-
"format": "select",
|
|
165
|
-
"data": "itree.undercut"
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
"name": "bark_damag",
|
|
169
|
-
"ua": "Пошкодження кори (в відсотках)",
|
|
170
|
-
"hidden": true,
|
|
171
|
-
"meta": "other",
|
|
172
|
-
"format": "select",
|
|
173
|
-
"data": "itree.bark_damag"
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
"name": "fungus",
|
|
177
|
-
"ua": "Гриби",
|
|
178
|
-
"hidden": true,
|
|
179
|
-
"meta": "other",
|
|
180
|
-
"format": "yes/no"
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
"name": "woodworms",
|
|
184
|
-
"ua": "Древоточець",
|
|
185
|
-
"hidden": true,
|
|
186
|
-
"meta": "other",
|
|
187
|
-
"format": "yes/no"
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
"name": "rottenness",
|
|
191
|
-
"ua": "Трухлявість",
|
|
192
|
-
"hidden": true,
|
|
193
|
-
"meta": "other",
|
|
194
|
-
"format": "yes/no"
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
"name": "hollow",
|
|
198
|
-
"ua": "Дупла",
|
|
199
|
-
"hidden": true,
|
|
200
|
-
"meta": "other",
|
|
201
|
-
"format": "yes/no"
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
"name": "frost_bump",
|
|
205
|
-
"ua": "Морозобоїни",
|
|
206
|
-
"hidden": true,
|
|
207
|
-
"meta": "other",
|
|
208
|
-
"format": "yes/no"
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
"name": "burns",
|
|
212
|
-
"ua": "Опіки",
|
|
213
|
-
"hidden": true,
|
|
214
|
-
"meta": "other",
|
|
215
|
-
"format": "yes/no"
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
"name": "nails",
|
|
219
|
-
"ua": "Цвяхи",
|
|
220
|
-
"hidden": true,
|
|
221
|
-
"meta": "other",
|
|
222
|
-
"format": "yes/no"
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
"name": "lamps_and_wires",
|
|
226
|
-
"ua": "Лампи та дроти",
|
|
227
|
-
"hidden": true,
|
|
228
|
-
"meta": "other",
|
|
229
|
-
"format": "yes/no"
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
"name": "trunk_inje",
|
|
233
|
-
"ua": "Інєкції в стовбур",
|
|
234
|
-
"hidden": true,
|
|
235
|
-
"meta": "other",
|
|
236
|
-
"format": "yes/no"
|
|
237
|
-
},
|
|
238
|
-
{
|
|
239
|
-
"name": "needs_trea",
|
|
240
|
-
"ua": "Потребує лікування",
|
|
241
|
-
"hidden": true,
|
|
242
|
-
"meta": "other",
|
|
243
|
-
"format": "yes/no"
|
|
244
|
-
},
|
|
245
|
-
{
|
|
246
|
-
"name": "crown_bare",
|
|
247
|
-
"ua": "Оцінка стану крони (частка голих гілок в вегетаційний період)",
|
|
248
|
-
"hidden": true,
|
|
249
|
-
"meta": "other",
|
|
250
|
-
"format": "select",
|
|
251
|
-
"data": "itree.crown_bare"
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
"name": "diameter_stump",
|
|
255
|
-
"ua": "Діаметр пенька, см",
|
|
256
|
-
"hidden": true,
|
|
257
|
-
"meta": "other",
|
|
258
|
-
"format": "number"
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
"en": "Photo",
|
|
262
|
-
"ru": "Фото",
|
|
263
|
-
"ua": "Фото",
|
|
264
|
-
"html": "{{#each img_list}}<a class='btn btn-xs btn-default' href=\"{{this}}\" download><i class='fa fa-file-text'></i></a><a target=\"_blank\" class='btn btn-xs btn-default' href=\"{{this}}\"><i class='fa fa-eye'></i></a><br>{{/each}}",
|
|
265
|
-
"name": "image",
|
|
266
|
-
"format": "image"
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
"ua": "Верифіковано",
|
|
270
|
-
"html": " {{#ifCond verif '==' true}} \r\n <span class=\"label\" style=\"color:#fff;background:green\"> Так</span> \r\n {{else}} \r\n <span class=\"label\" style=\"color:#fff;background:red\"> Ні</span>\r\n {{/ifCond}}",
|
|
271
|
-
"name": "verif",
|
|
272
|
-
"format": "verify"
|
|
273
|
-
}
|
|
274
|
-
],
|
|
275
|
-
"filterInline": [
|
|
276
|
-
{
|
|
277
|
-
"label": "Інвентарний номер",
|
|
278
|
-
"id": "invent_number",
|
|
279
|
-
"type": "Text"
|
|
280
|
-
}
|
|
281
|
-
],
|
|
282
|
-
"filterCustom": [
|
|
283
|
-
{
|
|
284
|
-
"label": "Поточний рік",
|
|
285
|
-
"sql": "cdate > '2014-01-01'"
|
|
286
|
-
}
|
|
287
|
-
],
|
|
288
|
-
"filterState": [
|
|
289
|
-
{
|
|
290
|
-
"label": "Не верифіковано",
|
|
291
|
-
"sql": "verif=false"
|
|
292
|
-
},
|
|
293
|
-
{
|
|
294
|
-
"label": "Верифіковано",
|
|
295
|
-
"sql": "verif=true"
|
|
296
|
-
}
|
|
297
|
-
],
|
|
298
|
-
"filterList": [
|
|
299
|
-
{
|
|
300
|
-
"label": "Інвентарний номер",
|
|
301
|
-
"id": "invent_number",
|
|
302
|
-
"type": "Text"
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
"label": "Дата",
|
|
306
|
-
"id": "cdate",
|
|
307
|
-
"type": "Date"
|
|
308
|
-
},
|
|
309
|
-
{
|
|
310
|
-
"label": "Тип насадження",
|
|
311
|
-
"data": "itree.type_plant",
|
|
312
|
-
"id": "type_plant",
|
|
313
|
-
"type": "Check"
|
|
314
|
-
},
|
|
315
|
-
{
|
|
316
|
-
"label": "Якісний стан об'єкта",
|
|
317
|
-
"data": "itree.quality_condition",
|
|
318
|
-
"id": "quality_condition",
|
|
319
|
-
"type": "Check"
|
|
320
|
-
},
|
|
321
|
-
{
|
|
322
|
-
"label": "Рекомендації",
|
|
323
|
-
"data": "itree.recommend",
|
|
324
|
-
"id": "recommend",
|
|
325
|
-
"type": "Check"
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
"label": "Зона відпочинку",
|
|
329
|
-
"data": "rz_id",
|
|
330
|
-
"id": "rz_id",
|
|
331
|
-
"type": "Text"
|
|
332
|
-
},
|
|
333
|
-
{
|
|
334
|
-
"label": "Адреса",
|
|
335
|
-
"data": "itree.address_id",
|
|
336
|
-
"id": "address_id",
|
|
337
|
-
"type": "Text"
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
"id": "bark_damag",
|
|
341
|
-
"label": "Пошкодження кори (в відсотках)",
|
|
342
|
-
"data": "itree.bark_damag",
|
|
343
|
-
"type": "Check"
|
|
344
|
-
},
|
|
345
|
-
{
|
|
346
|
-
"id": "undercut",
|
|
347
|
-
"label": "Підрізка",
|
|
348
|
-
"data": "itree.undercut",
|
|
349
|
-
"type": "Check"
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
"id": "crown_bare",
|
|
353
|
-
"label": "Оцінка стану крони (частка голих гілок в вегетаційний період)",
|
|
354
|
-
"data": "itree.crown_bare",
|
|
355
|
-
"type": "Check"
|
|
356
|
-
},
|
|
357
|
-
{
|
|
358
|
-
"id": "needs_trea",
|
|
359
|
-
"label": "Потребує лікування",
|
|
360
|
-
"data": "yes_no",
|
|
361
|
-
"type": "Check"
|
|
362
|
-
},
|
|
363
|
-
{
|
|
364
|
-
"id": "verif",
|
|
365
|
-
"label": "Верифіковано?",
|
|
366
|
-
"data": "yes_no",
|
|
367
|
-
"type": "Check"
|
|
368
|
-
},
|
|
369
|
-
{
|
|
370
|
-
"label": "Балансова вартість, грн",
|
|
371
|
-
"id": "cost",
|
|
372
|
-
"type": "Range"
|
|
373
|
-
}
|
|
374
|
-
],
|
|
375
|
-
"meta": {
|
|
376
|
-
"title": "invent_number",
|
|
377
|
-
"search": "invent_number,type_tree"
|
|
378
|
-
},
|
|
379
|
-
"actions": [
|
|
380
|
-
"edit",
|
|
381
|
-
"del"
|
|
382
|
-
]
|
|
383
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"table": "site.page_node",
|
|
3
|
-
"key": "alias",
|
|
4
|
-
"query": "t.category_id='3060540645924931148' and t.enabled and t.lang='ua'",
|
|
5
|
-
"orderby": "value_number",
|
|
6
|
-
"sql": [
|
|
7
|
-
{
|
|
8
|
-
"sql": "select object_id,value_number from site.page_node_data where attr='ord' and t.nid=object_id limit 1",
|
|
9
|
-
"name": "page_node_data_sql"
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
"columns": [
|
|
13
|
-
"title",
|
|
14
|
-
"alias",
|
|
15
|
-
"teaser",
|
|
16
|
-
"image"
|
|
17
|
-
]
|
|
18
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import userCls from './user.cls.js';
|
|
2
|
-
|
|
3
|
-
export default async function userClsId(req) {
|
|
4
|
-
const { id } = req.params || {};
|
|
5
|
-
const res = await userCls(req);
|
|
6
|
-
if (req.query?.sql || res?.error) {
|
|
7
|
-
return res;
|
|
8
|
-
}
|
|
9
|
-
const { rows = [] } = res?.message || {};
|
|
10
|
-
if (!rows?.length) {
|
|
11
|
-
return { message: `cls not found: ${id}`, status: 404 };
|
|
12
|
-
}
|
|
13
|
-
return { message: rows?.[0], status: 200 };
|
|
14
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'fs/promises';
|
|
2
|
-
import { getSelect, getTemplatePath } from '../../utils.js';
|
|
3
|
-
|
|
4
|
-
export default async function userCls(req) {
|
|
5
|
-
const {
|
|
6
|
-
pg, params = {}, query = {}, session = {},
|
|
7
|
-
} = req;
|
|
8
|
-
const { uid } = session.passport?.user || {};
|
|
9
|
-
|
|
10
|
-
if (!uid) {
|
|
11
|
-
return { message: 'access restricted', status: 403 };
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
if (query.type && !['json', 'sql'].includes(query.type)) {
|
|
15
|
-
return { message: 'param type is invalid', status: 400 };
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const q = `select user_clsid as id, name, type,
|
|
19
|
-
case when type='json' then (
|
|
20
|
-
${params?.id
|
|
21
|
-
? `(with recursive rows as (
|
|
22
|
-
select user_clsid, code as id, name as text, icon, color, parent
|
|
23
|
-
from admin.user_cls a
|
|
24
|
-
where name=u.name
|
|
25
|
-
union all
|
|
26
|
-
select a.user_clsid, a.code, a.name, a.icon, a.color, a.parent
|
|
27
|
-
from admin.user_cls a
|
|
28
|
-
join rows b on a.parent=b.text
|
|
29
|
-
) select json_agg(row_to_json(q)) from rows q where text<>u.name
|
|
30
|
-
)`
|
|
31
|
-
: 'select count(*)::int from admin.user_cls where parent=u.name'} ) else null end as children,
|
|
32
|
-
case when type='sql' then data else null end as sql from admin.user_cls u
|
|
33
|
-
where (case when type='json' then parent is null else true end)
|
|
34
|
-
and uid=(select uid from admin.users where $1 in (login,uid) limit 1)
|
|
35
|
-
and parent is null and ${query.type ? `type='${query.type}'` : '1=1'} and ${params?.id ? 'u.name=$2' : '1=1'}`;
|
|
36
|
-
|
|
37
|
-
if (query?.sql) return q;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const { rows = [] } = await pg.query(q, [uid, params.id].filter((el) => el));
|
|
41
|
-
|
|
42
|
-
rows.forEach((row) => {
|
|
43
|
-
if (row.type === 'sql') delete row.children;
|
|
44
|
-
if (row.type === 'json') { delete row.sql; Object.assign(row, { children: row.children || (params?.id ? [] : 0) }); }
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
const clsList = query.type === 'sql' ? [] : getTemplatePath('cls'); // skip cls if type sql
|
|
48
|
-
const selectList = query.type === 'json' ? [] : getTemplatePath('select'); // skip sql if type json
|
|
49
|
-
|
|
50
|
-
const userClsNames = rows.map((el) => el.name);
|
|
51
|
-
const selectNames = selectList.map((el) => el[0]);
|
|
52
|
-
|
|
53
|
-
const arr = (clsList || []).concat(selectList || []).map((el) => ({ name: el[0], path: el[1], type: el[2] }))
|
|
54
|
-
?.filter((el) => (params?.id ? el.name === params?.id : true))
|
|
55
|
-
?.filter((el) => ['sql', 'json'].includes(el?.type) && !userClsNames.includes(el.name))
|
|
56
|
-
?.filter((el) => (el?.type === 'json' ? !selectNames?.includes(el?.name) : true));
|
|
57
|
-
|
|
58
|
-
const res = await Promise.all(arr?.map(async (el) => {
|
|
59
|
-
const type = { json: 'cls', sql: 'select' }[el.type] || el.type;
|
|
60
|
-
// const clsData = await getSelect(type, el.name);
|
|
61
|
-
const str = await readFile(el.path, 'utf-8');
|
|
62
|
-
const clsData = type === 'cls' ? JSON.parse(str) : str;
|
|
63
|
-
if (type === 'cls') {
|
|
64
|
-
const children = params?.id ? clsData : clsData?.length || 0;
|
|
65
|
-
return { name: el.name, type: el.type, children };
|
|
66
|
-
}
|
|
67
|
-
return { name: el.name, type: el.type, sql: clsData?.sql || clsData };
|
|
68
|
-
}));
|
|
69
|
-
|
|
70
|
-
return { message: { rows: rows.concat(res) }, status: 200 };
|
|
71
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
export default async function userClsPost({
|
|
2
|
-
pg, body = {}, session = {},
|
|
3
|
-
}) {
|
|
4
|
-
const { uid } = session.passport?.user || {};
|
|
5
|
-
const {
|
|
6
|
-
name, type = 'json', children = [], sql,
|
|
7
|
-
} = body;
|
|
8
|
-
|
|
9
|
-
if (!uid) {
|
|
10
|
-
return { message: 'access restricted', status: 403 };
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (!name) {
|
|
14
|
-
return { message: 'not enough params: name', status: 400 };
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
if (type === 'json' && (!Array.isArray(children) || !children.length || !children?.[0]?.id)) {
|
|
18
|
-
return { message: 'invalid params: children (array of objects)', status: 400 };
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
if (type === 'sql' && (!sql || typeof sql !== 'string')) {
|
|
22
|
-
return { message: 'invalid params: sql (string)', status: 400 };
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const { rowCount = 0 } = await pg.query(`with recursive rows as (
|
|
27
|
-
select user_clsid, name, code, icon, color, parent
|
|
28
|
-
from admin.user_cls a
|
|
29
|
-
where name=$1
|
|
30
|
-
union all
|
|
31
|
-
select a.user_clsid, a.name, a.code, a.icon, a.color, a.parent
|
|
32
|
-
from admin.user_cls a
|
|
33
|
-
join rows b on a.parent=b.name
|
|
34
|
-
) delete from admin.user_cls where user_clsid in (select user_clsid from rows )`, [name]);
|
|
35
|
-
console.log('delete old user cls', name, rowCount);
|
|
36
|
-
|
|
37
|
-
const { id, data } = await pg.query('insert into admin.user_cls(name,type,data,uid) values($1,$2,$3,$4) returning user_clsid as id, data', [name, type, sql, uid])
|
|
38
|
-
.then((res) => res.rows?.[0] || {});
|
|
39
|
-
if (type === 'json') {
|
|
40
|
-
if (!id) { return { error: 'insert user cls error', status: 500 }; }
|
|
41
|
-
const q1 = `insert into admin.user_cls(code,name,color,icon,parent,uid)
|
|
42
|
-
|
|
43
|
-
select value->>'id',value->>'text',value->>'color',value->>'icon', '${name.replace(/'/g, "''")}', '${uid}'
|
|
44
|
-
from json_array_elements('${JSON.stringify(children).replace(/'/g, "''")}'::json)
|
|
45
|
-
|
|
46
|
-
returning user_clsid as id, code, name, parent`;
|
|
47
|
-
const { rows = [] } = await pg.query(q1);
|
|
48
|
-
return { id, children: rows };
|
|
49
|
-
}
|
|
50
|
-
return { id, data };
|
|
51
|
-
|
|
52
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export default async function userInfo({
|
|
2
|
-
pg, session = {},
|
|
3
|
-
}) {
|
|
4
|
-
const { uid } = session.passport?.user || {};
|
|
5
|
-
|
|
6
|
-
if (!uid) {
|
|
7
|
-
return { message: 'access restricted', status: 403 };
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const data = await pg.query(`select user_name, sur_name, father_name, user_rnokpp, user_type, email, login from admin.users
|
|
11
|
-
where uid=$1`, [uid]).then((res) => res.rows?.[0] || {});
|
|
12
|
-
|
|
13
|
-
const { notifications = 0 } = await pg.query(`select count(*)::int as notifications from crm.notifications
|
|
14
|
-
where addressee_id=$1 and read is not true`, [uid]).then((res) => res.rows?.[0] || {});
|
|
15
|
-
return { uid, ...data, notifications };
|
|
16
|
-
|
|
17
|
-
}
|
package/user/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import userCls from './controllers/user.cls.js';
|
|
2
|
-
import userClsId from './controllers/user.cls.id.js';
|
|
3
|
-
import userInfo from './controllers/user.info.js';
|
|
4
|
-
import userClsPost from './controllers/user.cls.post.js';
|
|
5
|
-
|
|
6
|
-
import { userClsSchema, userClsIdSchema } from './schema.js'
|
|
7
|
-
|
|
8
|
-
async function plugin(fastify, opts) {
|
|
9
|
-
const { prefix = '/api' } = opts || {};
|
|
10
|
-
|
|
11
|
-
fastify.get(`${prefix}/user-cls`, { config: { policy: ['user'] }, schema: userClsSchema }, userCls);
|
|
12
|
-
fastify.get(`${prefix}/user-cls/:id`, { config: { policy: ['user'] }, schema: userClsIdSchema }, userClsId);
|
|
13
|
-
fastify.get(`${prefix}/user-info`, { config: { policy: ['user'] } }, userInfo);
|
|
14
|
-
fastify.post(`${prefix}/user-cls/:id`, { config: { policy: ['user'] }, schema: userClsIdSchema }, userClsPost);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default plugin;
|
package/user/schema.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const userClsSchema = {
|
|
2
|
-
params: {
|
|
3
|
-
id: { type: 'string', pattern: '^([\\d\\w]+)$' },
|
|
4
|
-
},
|
|
5
|
-
quertstring: {
|
|
6
|
-
sql: { type: 'string', pattern: '^(\\d)$' },
|
|
7
|
-
},
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const userClsIdSchema = {
|
|
11
|
-
params: {
|
|
12
|
-
id: { type: 'string', pattern: '^([\\d\\w]+)$' },
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export { userClsSchema, userClsIdSchema };
|
|
17
|
-
export default null;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export default async function getExtraProperties({
|
|
2
|
-
pg, params = {},
|
|
3
|
-
}) {
|
|
4
|
-
const { id } = params;
|
|
5
|
-
if (!id) {
|
|
6
|
-
return { message: 'not enougn params', status: 400 };
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
const { rows = [] } = pg.pk?.['crm.properties']
|
|
10
|
-
? await pg.query(`select property_key, property_type, property_text, property_int,
|
|
11
|
-
property_json, property_date from crm.properties where property_key is not null and object_id=$1`, [id])
|
|
12
|
-
: {};
|
|
13
|
-
if (!rows.length) return {};
|
|
14
|
-
|
|
15
|
-
const data = rows.reduce((acc, curr) => Object.assign(acc, { [curr.property_key]: curr[`property_${curr.property_type}`] }), {});
|
|
16
|
-
return { message: data, status: 200 };
|
|
17
|
-
}
|
package/util/schema.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const propertiesSchema = {
|
|
2
|
-
params: {
|
|
3
|
-
id: { type: 'string', pattern: '^([\\d\\w]+)$' },
|
|
4
|
-
},
|
|
5
|
-
};
|
|
6
|
-
const loggerSchema = {
|
|
7
|
-
// params: {
|
|
8
|
-
//
|
|
9
|
-
// },
|
|
10
|
-
querystring: {
|
|
11
|
-
download: { type: 'string', pattern: '^(\\d+)$' },
|
|
12
|
-
full: { type: 'string', pattern: '^(\\d+)$' },
|
|
13
|
-
dir: { type: 'string', pattern: '^(\\d+)$' },
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
export {
|
|
17
|
-
propertiesSchema, loggerSchema
|
|
18
|
-
}
|
|
19
|
-
export default null;
|