@opengis/admin 0.1.67 → 0.1.69

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 (29) hide show
  1. package/dist/{IconChevronDown-DN0s3TF_.js → IconChevronDown-D29D5cN_.js} +1 -1
  2. package/dist/add-page-w-DxgCiS.js +97 -0
  3. package/dist/{admin-interface-DUuz9KgB.js → admin-interface-DA_PeVj7.js} +265 -240
  4. package/dist/{admin-view-MSa57inW.js → admin-view-DrOVwYHu.js} +198 -188
  5. package/dist/admin.js +1 -1
  6. package/dist/admin.umd.cjs +48 -48
  7. package/dist/{card-page-B1zuuqAR.js → card-page-Pw97vvNR.js} +19 -19
  8. package/dist/{card-view-Bzt2AvI2.js → card-view-eMucbOjz.js} +1 -1
  9. package/dist/edit-page-DqEf35J2.js +101 -0
  10. package/dist/{import-file-B80Ws8by.js → import-file-z-nSvLVJ.js} +255 -244
  11. package/dist/style.css +1 -1
  12. package/package.json +5 -5
  13. package/server/plugins/hook.js +11 -44
  14. package/server/routes/calendar/index.mjs +2 -12
  15. package/server/routes/calendar/schema.js +22 -0
  16. package/server/routes/data/controllers/tableData.js +5 -107
  17. package/server/routes/data/index.mjs +4 -4
  18. package/server/routes/data/schema.js +49 -2
  19. package/server/routes/menu/controllers/getMenu.js +3 -1
  20. package/server/routes/menu/schema.js +0 -0
  21. package/server/routes/notifications/controllers/readNotifications.js +7 -14
  22. package/server/routes/notifications/controllers/userNotifications.js +15 -22
  23. package/server/routes/notifications/index.mjs +5 -30
  24. package/server/routes/notifications/schema.js +11 -0
  25. package/server/routes/properties/index.mjs +6 -18
  26. package/server/routes/properties/schema.js +11 -0
  27. package/server/routes/templates/scheme.js +9 -0
  28. package/dist/add-page-Cm4aSGoA.js +0 -92
  29. package/dist/edit-page-DoY4S7v6.js +0 -103
@@ -6,35 +6,10 @@ import userNotifications from './controllers/userNotifications.js'; // check all
6
6
  // hook
7
7
  import onWidgetSet from './hook/onWidgetSet.js'; // send notification on comment
8
8
 
9
+ import { notificationSchema } from './schema.js';
9
10
 
10
- const tableSchema = {
11
- params: {
12
- id: { type: 'string' },
13
- },
14
- querystring: {
15
- nocache: { type: 'string', pattern: '^(\\d+)$' },
16
- },
17
- };
18
-
19
- export default async function plugin(fastify, config = {}) {
20
- const prefix = config.prefix || '/api';
21
- fastify.route({
22
- method: 'GET',
23
- url: '/notification',
24
- config: {
25
- policy: ['user'],
26
- },
27
- schema: tableSchema,
28
- handler: userNotifications,
29
- });
30
- fastify.route({
31
- method: 'GET',
32
- url: '/notification-read/:id?',
33
- config: {
34
- policy: ['user'],
35
- },
36
- schema: tableSchema,
37
- handler: readNotifications,
38
- });
39
- addHook('onWidgetSet', onWidgetSet);
11
+ export default async function route(fastify) {
12
+ fastify.get(`/notification`, { config: { policy: ['user'] }, schema: notificationSchema }, userNotifications);
13
+ fastify.get(`/notification-read/:id?`, { config: { policy: ['user'] }, schema: notificationSchema }, readNotifications);
14
+ addHook('onWidgetSet', onWidgetSet);
40
15
  }
@@ -0,0 +1,11 @@
1
+ const notificationSchema = {
2
+ params: {
3
+ id: { type: 'string', pattern: '^([\\d\\w]+)$' },
4
+ },
5
+ querystring: {
6
+ nocache: { type: 'string', pattern: '^(\\d+)$' },
7
+ },
8
+ };
9
+
10
+ export default null;
11
+ export { notificationSchema }
@@ -4,23 +4,11 @@ import postAdminProperties from './controllers/admin.properties.post.js';
4
4
  import getUserProperties from './controllers/user.properties.get.js';
5
5
  import postUserProperties from './controllers/user.properties.post.js';
6
6
 
7
- export default async function route(fastify) {
8
- fastify.get('/admin-properties/:key?', {}, getAdminProperties);
9
-
10
- fastify.route({
11
- method: 'POST',
12
- path: '/admin-properties',
13
- config: {
14
- policy: ['superadmin'],
15
- },
16
- handler: postAdminProperties,
17
- });
7
+ import { propertiesSchema } from './schema.js';
18
8
 
19
- fastify.get('/user-properties/:key?', {}, getUserProperties);
20
-
21
- fastify.route({
22
- method: 'POST',
23
- path: '/user-properties',
24
- handler: postUserProperties,
25
- });
9
+ export default async function route(fastify) {
10
+ fastify.get('/admin-properties/:key?', { scheme: propertiesSchema }, getAdminProperties);
11
+ fastify.get('/user-properties/:key?', { scheme: propertiesSchema }, getUserProperties);
12
+ fastify.post('/admin-properties', { config: { policy: ['superadmin'] } }, postAdminProperties);
13
+ fastify.post('/user-properties', postUserProperties);
26
14
  }
@@ -0,0 +1,11 @@
1
+ const propertiesSchema = {
2
+ params: {
3
+ key: { type: 'string', pattern: '^([\\d\\w._]+)$' },
4
+ },
5
+ querystring: {
6
+ json: { type: 'string', pattern: '^([\\d\\w]+)$' },
7
+ },
8
+ };
9
+
10
+ export default null;
11
+ export { propertiesSchema }
@@ -0,0 +1,9 @@
1
+ const getTemplateSchema = {
2
+ params: {
3
+ name: { type: 'string', pattern: '^([\\d\\w._-]+)$' },
4
+ // type: { type: 'string' },
5
+ }
6
+ };
7
+
8
+ export default null;
9
+ export { getTemplateSchema }
@@ -1,92 +0,0 @@
1
- import { _ as m, u as b, a as c } from "./import-file-B80Ws8by.js";
2
- import { resolveComponent as h, openBlock as i, createElementBlock as d, createElementVNode as a, createBlock as p, createCommentVNode as f } from "vue";
3
- const g = {
4
- data() {
5
- return {
6
- formValues: {},
7
- scheme: null,
8
- table: ""
9
- };
10
- },
11
- mounted() {
12
- this.getFormScheme();
13
- },
14
- methods: {
15
- flattenMenu(t) {
16
- const e = [];
17
- return t.forEach((o) => {
18
- o.menu ? e.push(...this.flattenMenu(o.menu)) : e.push(o);
19
- }), e;
20
- },
21
- async getFormScheme() {
22
- const t = this.flattenMenu(b.value);
23
- t != null && t.length || this.$router.replace("/404");
24
- const e = t == null ? void 0 : t.find((s) => {
25
- var r, l;
26
- return (s == null ? void 0 : s.path) == ((l = (r = this.$route) == null ? void 0 : r.query) == null ? void 0 : l.table);
27
- });
28
- e || this.$router.replace("/404");
29
- const o = e == null ? void 0 : e.table;
30
- this.table = o;
31
- try {
32
- const {
33
- data: { form: s }
34
- } = await c.get(`/api/template/table/${o}`), { data: r } = await c.get(`/api/template/form/${s}`);
35
- this.scheme = (r == null ? void 0 : r.schema) || r;
36
- } catch {
37
- }
38
- },
39
- async createObject() {
40
- try {
41
- await this.$refs.form.doValidation(), await c.post(`/api/table/${this.table}`, this.formValues), await this.$router.back(), await this.$notify({
42
- title: "Успішно!",
43
- message: "Об'єкт успішно створено",
44
- type: "success"
45
- });
46
- } catch {
47
- this.$notify({
48
- title: "Помилка!",
49
- message: "Сталася помилка",
50
- type: "error"
51
- });
52
- }
53
- }
54
- }
55
- }, x = { style: { width: "calc(100vw - 260px)" } }, w = { class: "h-[76px] bg-gray-50 flex items-center justify-between px-[30px]" }, y = { class: "flex items-center gap-[6px]" }, k = {
56
- style: { height: "calc(100vh - 150px)", width: "calc(100vw - 260px)" },
57
- class: "bg-gray-50 p-[20px] flex"
58
- }, v = { class: "bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500" };
59
- function V(t, e, o, s, r, l) {
60
- const u = h("VsForm");
61
- return i(), d("div", x, [
62
- a("div", w, [
63
- e[3] || (e[3] = a("h2", { class: "text-xl font-medium" }, "Створити", -1)),
64
- a("div", y, [
65
- a("button", {
66
- onClick: e[0] || (e[0] = (n) => t.$router.back()),
67
- class: "py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"
68
- }, " Скасувати "),
69
- a("button", {
70
- onClick: e[1] || (e[1] = (...n) => l.createObject && l.createObject(...n)),
71
- class: "py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"
72
- }, " Зберегти ")
73
- ])
74
- ]),
75
- a("div", k, [
76
- a("div", v, [
77
- r.scheme ? (i(), p(u, {
78
- key: 0,
79
- ref: "form",
80
- scheme: r.scheme,
81
- modelValue: r.formValues,
82
- "onUpdate:modelValue": e[2] || (e[2] = (n) => r.formValues = n),
83
- class: "p-0 mt-[20px]"
84
- }, null, 8, ["scheme", "modelValue"])) : f("", !0)
85
- ])
86
- ])
87
- ]);
88
- }
89
- const j = /* @__PURE__ */ m(g, [["render", V]]);
90
- export {
91
- j as default
92
- };
@@ -1,103 +0,0 @@
1
- import { _ as b, u as h, a as c } from "./import-file-B80Ws8by.js";
2
- import { resolveComponent as d, openBlock as m, createElementBlock as p, createElementVNode as l, createBlock as f, createCommentVNode as g } from "vue";
3
- const x = {
4
- data() {
5
- return {
6
- formValues: {},
7
- scheme: null,
8
- table: ""
9
- };
10
- },
11
- mounted() {
12
- this.getFormScheme();
13
- },
14
- methods: {
15
- flattenMenu(t) {
16
- const e = [];
17
- return t.forEach((r) => {
18
- r.menu ? e.push(...this.flattenMenu(r.menu)) : e.push(r);
19
- }), e;
20
- },
21
- async getFormScheme() {
22
- var u, a;
23
- const t = this.flattenMenu(h.value);
24
- t != null && t.length || this.$router.replace("/404");
25
- const e = t == null ? void 0 : t.find((o) => {
26
- var n, s;
27
- return (o == null ? void 0 : o.path) == ((s = (n = this.$route) == null ? void 0 : n.query) == null ? void 0 : s.table);
28
- });
29
- e || this.$router.replace("/404");
30
- const r = e == null ? void 0 : e.table;
31
- this.table = r;
32
- try {
33
- const {
34
- data: { token: o, form: n }
35
- } = await c.get(`/api/template/table/${r}`), {
36
- data: s
37
- } = await c.get(
38
- `/api/table/${this.table}/${(a = (u = this.$route) == null ? void 0 : u.query) == null ? void 0 : a.id}`
39
- );
40
- this.formValues = s;
41
- const { data: i } = await c.get(`/api/template/form/${o || n}`);
42
- this.scheme = (i == null ? void 0 : i.schema) || i;
43
- } catch {
44
- }
45
- },
46
- async editObject() {
47
- var t, e;
48
- try {
49
- await this.$refs.form.doValidation(), await c.put(
50
- `/api/table/${this.table}/${(e = (t = this.$route) == null ? void 0 : t.query) == null ? void 0 : e.id}`,
51
- this.formValues
52
- ), await this.$router.back(), await this.$notify({
53
- title: "Успішно!",
54
- message: "Об'єкт успішно створено",
55
- type: "success"
56
- });
57
- } catch {
58
- this.$notify({
59
- title: "Помилка!",
60
- message: "Сталася помилка",
61
- type: "error"
62
- });
63
- }
64
- }
65
- }
66
- }, w = { style: { width: "calc(100vw - 260px)" } }, y = { class: "h-[76px] bg-gray-50 flex items-center justify-between px-[30px]" }, k = { class: "flex items-center gap-[6px]" }, v = {
67
- style: { height: "calc(100vh - 140px)", width: "calc(100vw - 260px)" },
68
- class: "bg-gray-50 p-[20px] flex"
69
- }, $ = { class: "bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500" };
70
- function V(t, e, r, u, a, o) {
71
- const n = d("VsForm");
72
- return m(), p("div", w, [
73
- l("div", y, [
74
- e[3] || (e[3] = l("h2", { class: "text-xl font-medium" }, "Редагувати", -1)),
75
- l("div", k, [
76
- l("button", {
77
- onClick: e[0] || (e[0] = (s) => t.$router.back()),
78
- class: "py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"
79
- }, " Скасувати "),
80
- l("button", {
81
- onClick: e[1] || (e[1] = (...s) => o.editObject && o.editObject(...s)),
82
- class: "py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"
83
- }, " Зберегти ")
84
- ])
85
- ]),
86
- l("div", v, [
87
- l("div", $, [
88
- a.scheme ? (m(), f(n, {
89
- key: 0,
90
- ref: "form",
91
- scheme: a.scheme,
92
- modelValue: a.formValues,
93
- "onUpdate:modelValue": e[2] || (e[2] = (s) => a.formValues = s),
94
- class: "p-0 mt-[20px]"
95
- }, null, 8, ["scheme", "modelValue"])) : g("", !0)
96
- ])
97
- ])
98
- ]);
99
- }
100
- const C = /* @__PURE__ */ b(x, [["render", V]]);
101
- export {
102
- C as default
103
- };