@opengis/admin 0.2.3 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (164) hide show
  1. package/README.md +29 -29
  2. package/config.js +4 -4
  3. package/dist/{IconChevronDown-YHCKqGur.js → IconChevronDown-DvXDlar_.js} +1 -1
  4. package/dist/{add-page-BMqlSjvT.js → add-page-Bz0DZZQT.js} +1 -1
  5. package/dist/{admin-interface-CqdympB0.js → admin-interface-CUtcsr8c.js} +4 -4
  6. package/dist/{admin-view-DgNcerj_.js → admin-view-C-5ANryA.js} +3 -3
  7. package/dist/admin.js +1 -1
  8. package/dist/admin.umd.cjs +62 -54
  9. package/dist/assets/logo.svg +41 -41
  10. package/dist/{card-view-BfQIpSyU.js → card-view-Dul9Iva7.js} +1 -1
  11. package/dist/{edit-page-CKNYeOGK.js → edit-page-LUVtND0S.js} +1 -1
  12. package/dist/{import-file-DR6FZUIf.js → import-file-Dx0tYzFS.js} +6688 -6544
  13. package/dist/style.css +1 -1
  14. package/module/settings/card/admin.accounts.table/index.yml +7 -7
  15. package/module/settings/card/admin.accounts.table/rules.hbs +18 -18
  16. package/module/settings/card/admin.accounts.table/users.hbs +13 -13
  17. package/module/settings/card/admin.roles.table/access.hbs +3 -3
  18. package/module/settings/card/admin.roles.table/general_info.hbs +1 -1
  19. package/module/settings/card/admin.roles.table/index.yml +21 -21
  20. package/module/settings/card/admin.roles.table/users.hbs +6 -6
  21. package/module/settings/card/admin.routes.table/general_info.hbs +13 -13
  22. package/module/settings/card/admin.routes.table/groups.hbs +11 -11
  23. package/module/settings/card/admin.routes.table/index.yml +11 -11
  24. package/module/settings/card/admin.routes.table/users.hbs +16 -16
  25. package/module/settings/card/admin.users.table/context.hbs +14 -14
  26. package/module/settings/card/admin.users.table/general_info.hbs +12 -12
  27. package/module/settings/card/admin.users.table/index.yml +22 -22
  28. package/module/settings/card/admin.users.table/last_login.hbs +9 -9
  29. package/module/settings/card/admin.users.table/logs.hbs +10 -10
  30. package/module/settings/card/admin.users.table/routes.hbs +7 -7
  31. package/module/settings/card/admin.users.table/user_roles.hbs +12 -12
  32. package/module/settings/cls/core.actions.json +17 -17
  33. package/module/settings/cls/core.scope.json +13 -13
  34. package/module/settings/cls/properties.site_status.json +13 -13
  35. package/module/settings/cls/properties.widget_status.json +13 -13
  36. package/module/settings/cls/users.user_type.json +13 -13
  37. package/module/settings/form/admin.accounts.form.json +13 -13
  38. package/module/settings/form/admin.custom_column.form.json +71 -71
  39. package/module/settings/form/admin.properties.form.json +15 -15
  40. package/module/settings/form/admin.roles.form.json +21 -21
  41. package/module/settings/form/admin.routes.form.json +25 -25
  42. package/module/settings/form/admin.rules.form.json +30 -30
  43. package/module/settings/form/admin.user_properties.form.json +15 -15
  44. package/module/settings/form/admin.user_roles.form.json +13 -13
  45. package/module/settings/form/admin.user_roles_card.form.json +13 -13
  46. package/module/settings/form/admin.users.form.json +153 -153
  47. package/module/settings/form/context.account_grants.form.json +23 -23
  48. package/module/settings/form/context.account_users.form.json +12 -12
  49. package/module/settings/form/user.user_roles.form.json +13 -13
  50. package/module/settings/interface/admin.properties.json +4 -4
  51. package/module/settings/interface/admin.roles.json +4 -4
  52. package/module/settings/interface/admin.routes.json +4 -4
  53. package/module/settings/interface/admin.users.json +4 -4
  54. package/module/settings/menu.json +84 -84
  55. package/module/settings/select/core.routes.sql +1 -1
  56. package/module/settings/select/core.user_mentioned.sql +1 -1
  57. package/module/settings/select/core.user_uid.sql +1 -1
  58. package/module/settings/table/admin.accounts.table.json +42 -42
  59. package/module/settings/table/admin.custom_column.table.json +99 -99
  60. package/module/settings/table/admin.properties.table.json +39 -39
  61. package/module/settings/table/admin.roles.table.json +64 -64
  62. package/module/settings/table/admin.routes.table.json +73 -73
  63. package/module/settings/table/admin.rules.table.json +76 -76
  64. package/module/settings/table/admin.user_properties.table.json +34 -34
  65. package/module/settings/table/admin.user_roles.table.json +72 -72
  66. package/module/settings/table/admin.users.table.json +132 -132
  67. package/module/settings/table/context.account_grants.table.json +67 -67
  68. package/module/settings/table/context.account_users.table.json +37 -37
  69. package/package.json +83 -83
  70. package/plugin.js +29 -29
  71. package/server/helpers/core/badge.js +16 -16
  72. package/server/helpers/core/buttonHelper.js +21 -14
  73. package/server/helpers/core/select.js +48 -48
  74. package/server/helpers/core/token.js +18 -18
  75. package/server/helpers/index.js +28 -28
  76. package/server/helpers/list/buttonHelper.js +21 -11
  77. package/server/helpers/list/descriptionList.js +43 -43
  78. package/server/helpers/list/tableList.js +81 -81
  79. package/server/helpers/list/utils/button.js +5 -5
  80. package/server/helpers/temp/contentList.js +58 -58
  81. package/server/helpers/temp/ifCond.js +101 -101
  82. package/server/helpers/utils/button.js +5 -5
  83. package/server/helpers/utils/buttonAdd.js +6 -0
  84. package/server/helpers/utils/buttonDel.js +5 -5
  85. package/server/helpers/utils/buttonEdit.js +6 -0
  86. package/server/plugins/access/funcs/getAdminAccess.js +12 -12
  87. package/server/plugins/access/index.mjs +6 -6
  88. package/server/plugins/adminHook.js +81 -81
  89. package/server/plugins/cron.js +10 -10
  90. package/server/plugins/docs.js +28 -28
  91. package/server/plugins/hook.js +230 -233
  92. package/server/plugins/vite.js +71 -71
  93. package/server/routes/access/controllers/access.group.js +29 -29
  94. package/server/routes/access/controllers/access.group.post.js +48 -48
  95. package/server/routes/access/index.mjs +8 -8
  96. package/server/routes/access/schema.mjs +57 -57
  97. package/server/routes/calendar/controllers/calendar.data.js +87 -87
  98. package/server/routes/calendar/index.mjs +7 -7
  99. package/server/routes/calendar/schema.js +21 -21
  100. package/server/routes/data/controllers/cardData.js +105 -105
  101. package/server/routes/data/controllers/cardTabData.js +49 -49
  102. package/server/routes/data/controllers/funcs/getFilterSQL/index.js +92 -92
  103. package/server/routes/data/controllers/funcs/getFilterSQL/util/formatValue.js +170 -170
  104. package/server/routes/data/controllers/funcs/getFilterSQL/util/getCustomQuery.js +13 -13
  105. package/server/routes/data/controllers/funcs/getFilterSQL/util/getFilterQuery.js +64 -64
  106. package/server/routes/data/controllers/funcs/getFilterSQL/util/getOptimizedQuery.js +12 -12
  107. package/server/routes/data/controllers/funcs/getFilterSQL/util/getTableSql.js +34 -34
  108. package/server/routes/data/controllers/tableData.js +29 -29
  109. package/server/routes/data/controllers/tableDataId.js +27 -27
  110. package/server/routes/data/controllers/tableFilter.js +67 -67
  111. package/server/routes/data/controllers/tokenInfo.js +9 -9
  112. package/server/routes/data/controllers/utils/assignTokens.js +30 -30
  113. package/server/routes/data/controllers/utils/conditions.js +20 -20
  114. package/server/routes/data/controllers/utils/getColumns.js +8 -8
  115. package/server/routes/data/index.mjs +17 -17
  116. package/server/routes/data/schema.js +54 -54
  117. package/server/routes/menu/controllers/getMenu.js +58 -57
  118. package/server/routes/menu/index.mjs +5 -5
  119. package/server/routes/notifications/controllers/readNotifications.js +27 -27
  120. package/server/routes/notifications/controllers/testEmail.js +35 -35
  121. package/server/routes/notifications/controllers/userNotifications.js +53 -53
  122. package/server/routes/notifications/funcs/addNotification.js +21 -21
  123. package/server/routes/notifications/funcs/sendNotification.js +92 -92
  124. package/server/routes/notifications/hook/onWidgetSet.js +57 -57
  125. package/server/routes/notifications/index.mjs +27 -27
  126. package/server/routes/notifications/schema.js +16 -16
  127. package/server/routes/properties/controllers/admin.properties.get.js +29 -29
  128. package/server/routes/properties/controllers/user.properties.get.js +30 -30
  129. package/server/routes/properties/controllers/user.properties.post.js +30 -30
  130. package/server/routes/properties/funcs/getSettings.js +56 -56
  131. package/server/routes/properties/funcs/setSettings.js +44 -44
  132. package/server/routes/properties/funcs/utils/dataInsert.js +26 -26
  133. package/server/routes/properties/index.mjs +14 -14
  134. package/server/routes/properties/schema.js +10 -10
  135. package/server/routes/root.mjs +3 -3
  136. package/server/routes/templates/controllers/getTemplate.js +30 -26
  137. package/server/routes/templates/index.mjs +16 -16
  138. package/server/routes/templates/schema.js +8 -8
  139. package/server/routes/user/controllers/user.cls.id.js +14 -14
  140. package/server/routes/user/controllers/user.cls.js +71 -71
  141. package/server/routes/user/controllers/user.cls.post.js +52 -52
  142. package/server/routes/user/controllers/user.info.js +17 -17
  143. package/server/routes/user/schema.js +14 -14
  144. package/server/routes/widget/controllers/utils/historyFormat.js +75 -75
  145. package/server/routes/widget/controllers/utils/obj2db.js +13 -13
  146. package/server/routes/widget/controllers/widget.del.js +41 -41
  147. package/server/routes/widget/controllers/widget.get.js +96 -96
  148. package/server/routes/widget/controllers/widget.set.js +76 -76
  149. package/server/routes/widget/index.mjs +11 -11
  150. package/server/routes/widget/schema.js +12 -12
  151. package/server/templates/cls/itree.recrzone_category.json +73 -73
  152. package/server/templates/cls/test.json +9 -9
  153. package/server/templates/form/admin.user_cls.data.form.json +49 -49
  154. package/server/templates/form/admin.user_group_rel.form.json +21 -21
  155. package/server/templates/form/cp_building.form.json +32 -32
  156. package/server/templates/form/form-user-pass.json +10 -10
  157. package/server/templates/form/form-user_group.json +39 -39
  158. package/server/templates/form/form-users.json +156 -156
  159. package/server/templates/form/user_group_access.form.json +22 -22
  160. package/server/templates/select/account_id.json +2 -2
  161. package/server/templates/table/gis.dataset.table.json +43 -43
  162. package/server/templates/table/management.user_group.table.json +112 -112
  163. package/server/templates/table/management.users.table.json +126 -126
  164. package/utils.js +29 -29
@@ -1,68 +1,68 @@
1
- {
2
- "key": "ag_id",
3
- "ua": "Організації/Права",
4
- "table": "admin.account_grants",
5
- "form": "context.account_grants.form",
6
- "order": "cdate desc",
7
- "access": "admin",
8
- "actions": [
9
- "add",
10
- "edit",
11
- "del"
12
- ],
13
- "columns": [
14
- {
15
- "name": "account_id",
16
- "ua": "id Організації",
17
- "format": "Select",
18
- "data": "core.accounts"
19
- },
20
- {
21
- "name": "rule_id",
22
- "ua": "id Правила",
23
- "data": "core.rules",
24
- "format": "Select"
25
- },
26
- {
27
- "name": "routes",
28
- "ua": "Роути",
29
- "format": "Text"
30
- },
31
- {
32
- "name": "values",
33
- "ua": "Значення",
34
- "format": "Text"
35
- },
36
- {
37
- "name": "grants_doc_id",
38
- "ua": "id Документу",
39
- "format": "Text"
40
- },
41
- {
42
- "name": "grant_scan",
43
- "ua": "id Скану",
44
- "format": "Text"
45
- },
46
- {
47
- "name": "expire_date",
48
- "ua": "Дата закінчення дії дозволу",
49
- "format": "Date"
50
- },
51
- {
52
- "name": "actions",
53
- "ua": "Дії",
54
- "format": "Text"
55
- },
56
- {
57
- "name": "uid",
58
- "format": "Select",
59
- "data": "core.user_uid",
60
- "ua": "Хто створив"
61
- },
62
- {
63
- "name": "cdate",
64
- "ua": "Дата створення",
65
- "format": "Dat"
66
- }
67
- ]
1
+ {
2
+ "key": "ag_id",
3
+ "ua": "Організації/Права",
4
+ "table": "admin.account_grants",
5
+ "form": "context.account_grants.form",
6
+ "order": "cdate desc",
7
+ "access": "admin",
8
+ "actions": [
9
+ "add",
10
+ "edit",
11
+ "del"
12
+ ],
13
+ "columns": [
14
+ {
15
+ "name": "account_id",
16
+ "ua": "id Організації",
17
+ "format": "Select",
18
+ "data": "core.accounts"
19
+ },
20
+ {
21
+ "name": "rule_id",
22
+ "ua": "id Правила",
23
+ "data": "core.rules",
24
+ "format": "Select"
25
+ },
26
+ {
27
+ "name": "routes",
28
+ "ua": "Роути",
29
+ "format": "Text"
30
+ },
31
+ {
32
+ "name": "values",
33
+ "ua": "Значення",
34
+ "format": "Text"
35
+ },
36
+ {
37
+ "name": "grants_doc_id",
38
+ "ua": "id Документу",
39
+ "format": "Text"
40
+ },
41
+ {
42
+ "name": "grant_scan",
43
+ "ua": "id Скану",
44
+ "format": "Text"
45
+ },
46
+ {
47
+ "name": "expire_date",
48
+ "ua": "Дата закінчення дії дозволу",
49
+ "format": "Date"
50
+ },
51
+ {
52
+ "name": "actions",
53
+ "ua": "Дії",
54
+ "format": "Text"
55
+ },
56
+ {
57
+ "name": "uid",
58
+ "format": "Select",
59
+ "data": "core.user_uid",
60
+ "ua": "Хто створив"
61
+ },
62
+ {
63
+ "name": "cdate",
64
+ "ua": "Дата створення",
65
+ "format": "Dat"
66
+ }
67
+ ]
68
68
  }
@@ -1,38 +1,38 @@
1
- {
2
- "key": "au_id",
3
- "ua": "Користувачі/Організації",
4
- "table": "admin.account_users",
5
- "form": "context.account_users.form",
6
- "order": "cdate desc",
7
- "access": "admin",
8
- "actions": [
9
- "add",
10
- "edit",
11
- "del"
12
- ],
13
- "columns": [
14
- {
15
- "name": "account_id",
16
- "format": "Select",
17
- "data": "core.accounts",
18
- "ua": "id Організації"
19
- },
20
- {
21
- "name": "user_id",
22
- "format": "Select",
23
- "data": "core.user_uid",
24
- "ua": "id Користувача"
25
- },
26
- {
27
- "name": "uid",
28
- "format": "Select",
29
- "data": "core.user_uid",
30
- "ua": "Хто створив"
31
- },
32
- {
33
- "name": "cdate",
34
- "format": "date",
35
- "ua": "Дата створення"
36
- }
37
- ]
1
+ {
2
+ "key": "au_id",
3
+ "ua": "Користувачі/Організації",
4
+ "table": "admin.account_users",
5
+ "form": "context.account_users.form",
6
+ "order": "cdate desc",
7
+ "access": "admin",
8
+ "actions": [
9
+ "add",
10
+ "edit",
11
+ "del"
12
+ ],
13
+ "columns": [
14
+ {
15
+ "name": "account_id",
16
+ "format": "Select",
17
+ "data": "core.accounts",
18
+ "ua": "id Організації"
19
+ },
20
+ {
21
+ "name": "user_id",
22
+ "format": "Select",
23
+ "data": "core.user_uid",
24
+ "ua": "id Користувача"
25
+ },
26
+ {
27
+ "name": "uid",
28
+ "format": "Select",
29
+ "data": "core.user_uid",
30
+ "ua": "Хто створив"
31
+ },
32
+ {
33
+ "name": "cdate",
34
+ "format": "date",
35
+ "ua": "Дата створення"
36
+ }
37
+ ]
38
38
  }
package/package.json CHANGED
@@ -1,83 +1,83 @@
1
- {
2
- "name": "@opengis/admin",
3
- "version": "0.2.3",
4
- "description": "This project Softpro Admin",
5
- "main": "dist/admin.js",
6
- "type": "module",
7
- "directories": {
8
- "test": "test"
9
- },
10
- "files": [
11
- "dist/*",
12
- "module/*",
13
- "server/*",
14
- "plugin.js",
15
- "utils.js",
16
- "config.js"
17
- ],
18
- "scripts": {
19
- "test": "node --test test/**/*.test.js",
20
- "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
21
- "build": "vite build",
22
- "build-app": "cross-env APP=true vite build",
23
- "admin": "cross-env NODE_ENV=admin npm run start",
24
- "prod": "cross-env NODE_ENV=production npm run start",
25
- "debug": "node --watch-path=server server",
26
- "start": "node server",
27
- "docs:dev": "vitepress dev docs",
28
- "docs:build": "vitepress build docs",
29
- "docs:preview": "vitepress preview docs"
30
- },
31
- "keywords": [],
32
- "author": "Softpro",
33
- "license": "ISC",
34
- "dependencies": {
35
- "@fancyapps/ui": "^5.0.36",
36
- "@opengis/admin": "^0.1.69",
37
- "@opengis/fastify-auth": "^1.0.53",
38
- "@opengis/fastify-file": "^1.0.27",
39
- "@opengis/fastify-table": "^1.1.86",
40
- "@opengis/v3-core": "^0.2.41",
41
- "@opengis/v3-filter": "^0.0.41",
42
- "@tiptap/core": "^2.8.0",
43
- "@tiptap/extension-color": "^2.8.0",
44
- "@tiptap/extension-mention": "^2.8.0",
45
- "@tiptap/extension-placeholder": "^2.8.0",
46
- "@tiptap/extension-text": "^2.8.0",
47
- "@tiptap/extension-text-style": "^2.8.0",
48
- "@tiptap/extension-underline": "^2.8.0",
49
- "@tiptap/pm": "^2.8.0",
50
- "@tiptap/starter-kit": "^2.8.0",
51
- "@tiptap/suggestion": "^2.8.0",
52
- "@tiptap/vue-3": "^2.8.0",
53
- "@turf/turf": "^7.1.0",
54
- "@vitejs/plugin-vue": "^5.0.4",
55
- "close-with-grace": "^1.3.0",
56
- "cross-env": "^7.0.3",
57
- "fastify": "^4.26.1",
58
- "fastify-plugin": "^4.0.0",
59
- "maplibre-gl": "^4.7.0",
60
- "moment": "^2.30.1",
61
- "vite": "^5.1.4",
62
- "vue": "^3.4.21",
63
- "vue-router": "^4.3.0"
64
- },
65
- "devDependencies": {
66
- "@panzoom/panzoom": "^4.5.1",
67
- "@vue/eslint-config-typescript": "^12.0.0",
68
- "autoprefixer": "^10.4.20",
69
- "eslint": "^8.49.0",
70
- "eslint-config-airbnb": "^19.0.4",
71
- "eslint-plugin-import": "^2.25.3",
72
- "eslint-plugin-vue": "^9.17.0",
73
- "markdown-it-abbr": "^2.0.0",
74
- "mermaid": "^10.9.0",
75
- "postcss": "^8.4.47",
76
- "sass-embedded": "^1.79.1",
77
- "tailwindcss": "^3.4.13",
78
- "vitepress": "^1.1.3",
79
- "vitepress-plugin-mermaid": "^2.0.16",
80
- "vitepress-plugin-tabs": "^0.5.0",
81
- "vitepress-sidebar": "^1.22.0"
82
- }
83
- }
1
+ {
2
+ "name": "@opengis/admin",
3
+ "version": "0.2.5",
4
+ "description": "This project Softpro Admin",
5
+ "main": "dist/admin.js",
6
+ "type": "module",
7
+ "directories": {
8
+ "test": "test"
9
+ },
10
+ "files": [
11
+ "dist/*",
12
+ "module/*",
13
+ "server/*",
14
+ "plugin.js",
15
+ "utils.js",
16
+ "config.js"
17
+ ],
18
+ "scripts": {
19
+ "test": "node --test test/**/*.test.js",
20
+ "lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
21
+ "build": "vite build",
22
+ "build-app": "cross-env APP=true vite build",
23
+ "admin": "cross-env NODE_ENV=admin npm run start",
24
+ "prod": "cross-env NODE_ENV=production npm run start",
25
+ "debug": "node --watch-path=server server",
26
+ "start": "node server",
27
+ "docs:dev": "vitepress dev docs",
28
+ "docs:build": "vitepress build docs",
29
+ "docs:preview": "vitepress preview docs"
30
+ },
31
+ "keywords": [],
32
+ "author": "Softpro",
33
+ "license": "ISC",
34
+ "dependencies": {
35
+ "@fancyapps/ui": "^5.0.36",
36
+ "@opengis/admin": "^0.1.69",
37
+ "@opengis/fastify-auth": "^1.0.51",
38
+ "@opengis/fastify-file": "^1.0.30",
39
+ "@opengis/fastify-table": "^1.1.86",
40
+ "@opengis/v3-core": "^0.2.52",
41
+ "@opengis/v3-filter": "^0.0.41",
42
+ "@tiptap/core": "^2.8.0",
43
+ "@tiptap/extension-color": "^2.8.0",
44
+ "@tiptap/extension-mention": "^2.8.0",
45
+ "@tiptap/extension-placeholder": "^2.8.0",
46
+ "@tiptap/extension-text": "^2.8.0",
47
+ "@tiptap/extension-text-style": "^2.8.0",
48
+ "@tiptap/extension-underline": "^2.8.0",
49
+ "@tiptap/pm": "^2.8.0",
50
+ "@tiptap/starter-kit": "^2.8.0",
51
+ "@tiptap/suggestion": "^2.8.0",
52
+ "@tiptap/vue-3": "^2.8.0",
53
+ "@turf/turf": "^7.1.0",
54
+ "@vitejs/plugin-vue": "^5.0.4",
55
+ "close-with-grace": "^1.3.0",
56
+ "cross-env": "^7.0.3",
57
+ "fastify": "^4.26.1",
58
+ "fastify-plugin": "^4.0.0",
59
+ "maplibre-gl": "^4.7.0",
60
+ "moment": "^2.30.1",
61
+ "vite": "^5.1.4",
62
+ "vue": "^3.4.21",
63
+ "vue-router": "^4.3.0"
64
+ },
65
+ "devDependencies": {
66
+ "@panzoom/panzoom": "^4.5.1",
67
+ "@vue/eslint-config-typescript": "^12.0.0",
68
+ "autoprefixer": "^10.4.20",
69
+ "eslint": "^8.49.0",
70
+ "eslint-config-airbnb": "^19.0.4",
71
+ "eslint-plugin-import": "^2.25.3",
72
+ "eslint-plugin-vue": "^9.17.0",
73
+ "markdown-it-abbr": "^2.0.0",
74
+ "mermaid": "^10.9.0",
75
+ "postcss": "^8.4.47",
76
+ "sass-embedded": "^1.79.1",
77
+ "tailwindcss": "^3.4.13",
78
+ "vitepress": "^1.1.3",
79
+ "vitepress-plugin-mermaid": "^2.0.16",
80
+ "vitepress-plugin-tabs": "^0.5.0",
81
+ "vitepress-sidebar": "^1.22.0"
82
+ }
83
+ }
package/plugin.js CHANGED
@@ -1,30 +1,30 @@
1
- import fp from 'fastify-plugin';
2
-
3
- import config from './config.js';
4
-
5
- config.prefix = config.prefix || '/api';
6
-
7
- async function plugin(fastify, opts = config) {
8
- // const prefix = config.prefix || '/api';
9
-
10
- fastify.register(import('./server/helpers/index.js'), opts);
11
- // fastify.register(import('@opengis/fastify-auth'), config);
12
-
13
- fastify.register(import('./server/plugins/cron.js'), opts); // cron / scheduler
14
- fastify.register(import('./server/plugins/hook.js'), opts); // data / template hooks
15
- fastify.register(import('./server/plugins/access/index.mjs'), opts); // check access / analogue of policy
16
-
17
- // API
18
- fastify.register(import('./server/routes/properties/index.mjs'), opts);
19
- fastify.register(import('./server/routes/calendar/index.mjs'), opts);
20
- fastify.register(import('./server/routes/notifications/index.mjs'), opts);
21
- fastify.register(import('./server/routes/templates/index.mjs'), opts);
22
- fastify.register(import('./server/routes/menu/index.mjs'), opts);
23
- fastify.register(import('./server/routes/data/index.mjs'), opts);
24
-
25
- fastify.register(import('./server/routes/user/index.mjs'), opts);
26
- fastify.register(import('./server/routes/widget/index.mjs'), opts);
27
-
28
- fastify.register(import('./server/routes/access/index.mjs'), opts);
29
- }
1
+ import fp from 'fastify-plugin';
2
+
3
+ import config from './config.js';
4
+
5
+ config.prefix = config.prefix || '/api';
6
+
7
+ async function plugin(fastify, opts = config) {
8
+ // const prefix = config.prefix || '/api';
9
+
10
+ fastify.register(import('./server/helpers/index.js'), opts);
11
+ // fastify.register(import('@opengis/fastify-auth'), config);
12
+
13
+ fastify.register(import('./server/plugins/cron.js'), opts); // cron / scheduler
14
+ fastify.register(import('./server/plugins/hook.js'), opts); // data / template hooks
15
+ fastify.register(import('./server/plugins/access/index.mjs'), opts); // check access / analogue of policy
16
+
17
+ // API
18
+ fastify.register(import('./server/routes/properties/index.mjs'), opts);
19
+ fastify.register(import('./server/routes/calendar/index.mjs'), opts);
20
+ fastify.register(import('./server/routes/notifications/index.mjs'), opts);
21
+ fastify.register(import('./server/routes/templates/index.mjs'), opts);
22
+ fastify.register(import('./server/routes/menu/index.mjs'), opts);
23
+ fastify.register(import('./server/routes/data/index.mjs'), opts);
24
+
25
+ fastify.register(import('./server/routes/user/index.mjs'), opts);
26
+ fastify.register(import('./server/routes/widget/index.mjs'), opts);
27
+
28
+ fastify.register(import('./server/routes/access/index.mjs'), opts);
29
+ }
30
30
  export default fp(plugin)
@@ -1,16 +1,16 @@
1
- import { getSelect } from "@opengis/fastify-table/utils.js";
2
-
3
-
4
-
5
- export default async function badge(id, options) {
6
- if (!id) return '-';
7
- const data = options.hash?.data;
8
- if (!data) return id;
9
- const classifier = await getSelect(data);
10
- if (!classifier?.arr) return id;
11
-
12
- const item = classifier?.arr.find(el => el.id == id);
13
- if (!item) return id;
14
- return `<span style='color:${item.color || '#14b8a6'};border-color:${item.color || '#14b8a6'};' class="inline-flex items-center gap-x-1.5 py-1.5 px-3 rounded-full text-xs font-medium border border-teal-500 text-teal-500">${item.text}</span>`
15
-
16
- }
1
+ import { getSelect } from "@opengis/fastify-table/utils.js";
2
+
3
+
4
+
5
+ export default async function badge(id, options) {
6
+ if (!id) return '-';
7
+ const data = options.hash?.data;
8
+ if (!data) return id;
9
+ const classifier = await getSelect(data);
10
+ if (!classifier?.arr) return id;
11
+
12
+ const item = classifier?.arr.find(el => el.id == id);
13
+ if (!item) return id;
14
+ return `<span style='color:${item.color || '#14b8a6'};border-color:${item.color || '#14b8a6'};' class="inline-flex items-center gap-x-1.5 py-1.5 px-3 rounded-full text-xs font-medium border border-teal-500 text-teal-500">${item.text}</span>`
15
+
16
+ }
@@ -1,14 +1,21 @@
1
-
2
- import button from '../utils/button.js';
3
- import buttonDel from '../utils/buttonDel.js';
4
- export default function buttonHelper(data, opt) {
5
- const { hash } = opt;
6
-
7
- // console.log(params)
8
-
9
- if (!hash.token) return 'token empty';
10
- if (hash.del) {
11
- return buttonDel(hash.token, hash.title)
12
- }
13
- return button(hash.token, hash.title);
14
- }
1
+ import buttonAdd from "../utils/buttonAdd.js";
2
+ import buttonDel from "../utils/buttonDel.js";
3
+ import buttonEdit from "../utils/buttonEdit.js";
4
+ import button from "../utils/button.js";
5
+ export default function buttonHelper(data, opt) {
6
+ const { hash } = opt;
7
+
8
+ // console.log(params)
9
+
10
+ if (!hash.token) return "token empty";
11
+ if (hash.add) {
12
+ return buttonAdd(hash.token, hash.title);
13
+ }
14
+ if (hash.del) {
15
+ return buttonDel(hash.token, hash.title);
16
+ }
17
+ if (hash.edit) {
18
+ return buttonEdit(hash.token, hash.title);
19
+ }
20
+ return button(hash.token, hash.title);
21
+ }
@@ -1,48 +1,48 @@
1
- import { getPG, getSelect } from "@opengis/fastify-table/utils.js";
2
- const pg = getPG();
3
-
4
- export default async function select(ids, options) {
5
- if (!ids || (Array.isArray(ids) && ids.length === 0) || ids === '') {
6
- return '';
7
- }
8
-
9
- const data = options.hash?.data;
10
- if (!data && data !== false && data !== 0) return '';
11
- try {
12
- const idsArray = Array.isArray(ids) ? ids : [ids];
13
-
14
- const classifier = await getSelect(data);
15
-
16
-
17
-
18
- if (!classifier) return `Не знайдено класифікатор ${data}`;
19
-
20
- const arr = classifier.arr || []
21
- if (classifier.sql && typeof classifier.sql === 'string') {
22
-
23
-
24
-
25
- const metaQuery = `SELECT * FROM (${classifier.sql})q LIMIT 0`;
26
- const meta = await pg.query(metaQuery);
27
- const idColumn = meta.fields[0].name;
28
- const textColumn = meta.fields[1].name;
29
-
30
- const sql = `SELECT "${idColumn}" AS id, "${textColumn}" AS text FROM (${classifier.sql}) q WHERE "${idColumn}" = ANY($1::text[])`;
31
- const values = [idsArray.map(id => String(id))];
32
-
33
- const { rows } = await pg.query(sql, values);
34
- Object.assign(arr, rows)
35
-
36
- }
37
- if (!arr.length) return idsArray
38
-
39
- const results = idsArray.map(id => {
40
- const result = arr.find(el => String(el.id) == String(id));
41
- return result ? result.text : '';
42
- });
43
-
44
- return results.filter(Boolean).join(', ');
45
- } catch (error) {
46
- return `Сталася помилка.<!-- err: ${error.toString()} -->`;
47
- }
48
- }
1
+ import { getPG, getSelect } from "@opengis/fastify-table/utils.js";
2
+ const pg = getPG();
3
+
4
+ export default async function select(ids, options) {
5
+ if (!ids || (Array.isArray(ids) && ids.length === 0) || ids === '') {
6
+ return '';
7
+ }
8
+
9
+ const data = options.hash?.data;
10
+ if (!data && data !== false && data !== 0) return '';
11
+ try {
12
+ const idsArray = Array.isArray(ids) ? ids : [ids];
13
+
14
+ const classifier = await getSelect(data);
15
+
16
+
17
+
18
+ if (!classifier) return `Не знайдено класифікатор ${data}`;
19
+
20
+ const arr = classifier.arr || []
21
+ if (classifier.sql && typeof classifier.sql === 'string') {
22
+
23
+
24
+
25
+ const metaQuery = `SELECT * FROM (${classifier.sql})q LIMIT 0`;
26
+ const meta = await pg.query(metaQuery);
27
+ const idColumn = meta.fields[0].name;
28
+ const textColumn = meta.fields[1].name;
29
+
30
+ const sql = `SELECT "${idColumn}" AS id, "${textColumn}" AS text FROM (${classifier.sql}) q WHERE "${idColumn}" = ANY($1::text[])`;
31
+ const values = [idsArray.map(id => String(id))];
32
+
33
+ const { rows } = await pg.query(sql, values);
34
+ Object.assign(arr, rows)
35
+
36
+ }
37
+ if (!arr.length) return idsArray
38
+
39
+ const results = idsArray.map(id => {
40
+ const result = arr.find(el => String(el.id) == String(id));
41
+ return result ? result.text : '';
42
+ });
43
+
44
+ return results.filter(Boolean).join(', ');
45
+ } catch (error) {
46
+ return `Сталася помилка.<!-- err: ${error.toString()} -->`;
47
+ }
48
+ }
@@ -1,19 +1,19 @@
1
- import { setToken } from "@opengis/fastify-table/utils.js";
2
-
3
- export default function token(params) {
4
-
5
- const { data, hash } = params;
6
-
7
- if (!data?.root?.user?.uid && !hash.uid) return '-';
8
- if (!hash || typeof hash !== 'object') return '-';
9
-
10
- // const id = hash?.edit ? hash?.id : data?.root?.id;
11
- // console.log(hash)
12
- const [token] = setToken({
13
- ids: [JSON.stringify(hash)],
14
-
15
- uid: data?.root?.user?.uid || hash.uid,
16
- array: 1,
17
- });
18
- return token;
1
+ import { setToken } from "@opengis/fastify-table/utils.js";
2
+
3
+ export default function token(params) {
4
+
5
+ const { data, hash } = params;
6
+
7
+ if (!data?.root?.user?.uid && !hash.uid) return '-';
8
+ if (!hash || typeof hash !== 'object') return '-';
9
+
10
+ // const id = hash?.edit ? hash?.id : data?.root?.id;
11
+ // console.log(hash)
12
+ const [token] = setToken({
13
+ ids: [JSON.stringify(hash)],
14
+
15
+ uid: data?.root?.user?.uid || hash.uid,
16
+ array: 1,
17
+ });
18
+ return token;
19
19
  }