@opengis/admin 0.4.24 → 0.4.25
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/dist/{add-page-BnuV3GUq.js → add-page-BylD41-Z.js} +1 -1
- package/dist/{admin-interface-BNHfUVVd.js → admin-interface-CYCND0UV.js} +18 -21
- package/dist/{admin-view-BzRj8tla.js → admin-view-P4tmzsUd.js} +23 -28
- package/dist/admin.js +1 -1
- package/dist/admin.umd.cjs +8 -7
- package/dist/{card-view-fMATCpvv.js → card-view-Cl-WJQjk.js} +1 -1
- package/dist/{edit-page-CfwKksUs.js → edit-page-QSqaQJID.js} +1 -1
- package/dist/{import-file-BJlu2-xP.js → import-file-CWSxHcF6.js} +2723 -2728
- package/dist/profile-page-BET5knoL.js +78 -0
- package/dist/user-DCzCj0wb.js +2 -0
- package/package.json +1 -1
- package/server/routes/user/controllers/user.edit.js +19 -0
- package/server/routes/user/index.mjs +6 -0
- package/dist/profile-page-C5_ZayhZ.js +0 -78
- package/dist/user-B_2kh6ic.js +0 -5
@@ -0,0 +1,78 @@
|
|
1
|
+
import { _ as m, f as a } from "./import-file-CWSxHcF6.js";
|
2
|
+
import "./user-DCzCj0wb.js";
|
3
|
+
import { resolveComponent as p, createElementBlock as d, openBlock as n, createElementVNode as r, createTextVNode as h, toDisplayString as b, createBlock as f, createCommentVNode as g } from "vue";
|
4
|
+
const x = {
|
5
|
+
data() {
|
6
|
+
return {
|
7
|
+
formScheme: null,
|
8
|
+
uid: null,
|
9
|
+
userData: null
|
10
|
+
};
|
11
|
+
},
|
12
|
+
async created() {
|
13
|
+
await this.getUserData(), await this.getFormScheme();
|
14
|
+
},
|
15
|
+
methods: {
|
16
|
+
async getUserData() {
|
17
|
+
var o, l;
|
18
|
+
const { data: e } = await a.get("/user");
|
19
|
+
this.uid = (o = e == null ? void 0 : e.user) == null ? void 0 : o.uid;
|
20
|
+
const { data: t } = await a.get(`/api/data/admin.users.table/${this.uid}`);
|
21
|
+
this.userData = (l = t == null ? void 0 : t.rows) == null ? void 0 : l[0];
|
22
|
+
},
|
23
|
+
async updateUser() {
|
24
|
+
try {
|
25
|
+
await a.put(`/api/user/${this.uid}`, this.userData), await this.$notify({
|
26
|
+
title: "Успішно!",
|
27
|
+
message: "Дані успішно оновлені",
|
28
|
+
type: "success"
|
29
|
+
});
|
30
|
+
} catch (e) {
|
31
|
+
this.$notify({
|
32
|
+
title: "Помилка!",
|
33
|
+
message: `Сталася помилка редагування.
|
34
|
+
${e.toString()}`,
|
35
|
+
type: "error"
|
36
|
+
});
|
37
|
+
}
|
38
|
+
},
|
39
|
+
async getFormScheme() {
|
40
|
+
try {
|
41
|
+
const { data: e } = await a.get(
|
42
|
+
"/api/template/form/admin.profile.form"
|
43
|
+
);
|
44
|
+
this.formScheme = e.schema;
|
45
|
+
} catch (e) {
|
46
|
+
console.error(e);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}, w = { class: "flex justify-center pt-[20px] pb-[20px] pl-[20px] h-[calc(100vh-58px)]" }, y = { class: "bg-white rounded-xl p-[20px]" }, k = { class: "flex-1 overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-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" }, _ = { class: "flex" };
|
51
|
+
function v(e, t, o, l, s, c) {
|
52
|
+
const u = p("VsForm");
|
53
|
+
return n(), d("div", w, [
|
54
|
+
r("div", y, [
|
55
|
+
h(b(e.user) + " ", 1),
|
56
|
+
t[2] || (t[2] = r("h2", { class: "mb-[20px] text-center" }, "Профіль", -1)),
|
57
|
+
r("div", k, [
|
58
|
+
s.formScheme ? (n(), f(u, {
|
59
|
+
key: 0,
|
60
|
+
scheme: s.formScheme,
|
61
|
+
modelValue: s.userData,
|
62
|
+
"onUpdate:modelValue": t[0] || (t[0] = (i) => s.userData = i),
|
63
|
+
class: "pb-0"
|
64
|
+
}, null, 8, ["scheme", "modelValue"])) : g("", !0),
|
65
|
+
r("div", _, [
|
66
|
+
r("button", {
|
67
|
+
onClick: t[1] || (t[1] = (...i) => c.updateUser && c.updateUser(...i)),
|
68
|
+
class: "ml-auto text-[18px] bg-blue-500 text-white px-[8px] py-[4px] rounded hover:bg-blue-700 duration-300"
|
69
|
+
}, " Зберегти ")
|
70
|
+
])
|
71
|
+
])
|
72
|
+
])
|
73
|
+
]);
|
74
|
+
}
|
75
|
+
const U = /* @__PURE__ */ m(x, [["render", v]]);
|
76
|
+
export {
|
77
|
+
U as default
|
78
|
+
};
|
package/package.json
CHANGED
@@ -0,0 +1,19 @@
|
|
1
|
+
import { pgClients } from "@opengis/fastify-table/utils.js";
|
2
|
+
|
3
|
+
export default async function userEdit(req, reply) {
|
4
|
+
const {
|
5
|
+
pg = pgClients.client, body = {}, user = {}, params = {}
|
6
|
+
} = req
|
7
|
+
if (!params?.id) return reply.code(400).send({ status: 400, message: 'User id is empty' });
|
8
|
+
const { id } = params;
|
9
|
+
|
10
|
+
if (user?.uid !== id) return reply.code(403).send({ status: 403, message: 'Invalid user id' });
|
11
|
+
|
12
|
+
if (!body) return reply.code(400).send({ status: 400, message: 'body id is empty' });
|
13
|
+
const { sur_name, user_name, father_name, email, phone, avatar } = body
|
14
|
+
|
15
|
+
const updateSql = 'update admin.users set sur_name=$2,user_name=$3,father_name=$4,email=$5,phone=$6,avatar=$7 where uid =$1';
|
16
|
+
|
17
|
+
await pg.query(updateSql, [id, sur_name, user_name, father_name, email, phone, avatar]);
|
18
|
+
return reply.code(200).send({ status: 200, message: 'Updated successfully!' })
|
19
|
+
}
|
@@ -2,6 +2,7 @@ import userCls from './controllers/user.cls.js';
|
|
2
2
|
import userClsId from './controllers/user.cls.id.js';
|
3
3
|
import userInfo from './controllers/user.info.js';
|
4
4
|
import userClsPost from './controllers/user.cls.post.js';
|
5
|
+
import userEdit from './controllers/user.edit.js';
|
5
6
|
|
6
7
|
import { userClsSchema, userClsIdSchema } from './schema.js';
|
7
8
|
|
@@ -10,6 +11,11 @@ async function plugin(fastify, opts) {
|
|
10
11
|
fastify.get('/user-cls/:id', { config: { policy: ['user'] }, schema: userClsIdSchema }, userClsId);
|
11
12
|
fastify.get('/user-info', { config: { policy: ['user'] } }, userInfo);
|
12
13
|
fastify.post('/user-cls', { config: { policy: ['user'] }, schema: userClsIdSchema }, userClsPost);
|
14
|
+
|
15
|
+
fastify.put('/user/:id', { config: { policy: ['user'] } }, userEdit);
|
16
|
+
|
17
|
+
|
18
|
+
|
13
19
|
}
|
14
20
|
|
15
21
|
export default plugin;
|
@@ -1,78 +0,0 @@
|
|
1
|
-
import { _ as n, f as m } from "./import-file-BJlu2-xP.js";
|
2
|
-
import { u as p } from "./user-B_2kh6ic.js";
|
3
|
-
import { resolveComponent as f, createElementBlock as d, openBlock as u, createElementVNode as o, createBlock as h, createCommentVNode as b } from "vue";
|
4
|
-
const x = {
|
5
|
-
data() {
|
6
|
-
return {
|
7
|
-
formScheme: null,
|
8
|
-
formValues: {}
|
9
|
-
};
|
10
|
-
},
|
11
|
-
mounted() {
|
12
|
-
this.getFormScheme();
|
13
|
-
},
|
14
|
-
computed: {
|
15
|
-
userData() {
|
16
|
-
return p.value;
|
17
|
-
}
|
18
|
-
},
|
19
|
-
methods: {
|
20
|
-
async updateUser() {
|
21
|
-
var r;
|
22
|
-
try {
|
23
|
-
await m.put(`/user/${(r = this.userData.user) == null ? void 0 : r.uid}`, this.formValues), await this.$notify({
|
24
|
-
title: "Успішно!",
|
25
|
-
message: "Дані успішно оновлені",
|
26
|
-
type: "success"
|
27
|
-
});
|
28
|
-
} catch {
|
29
|
-
this.$notify({
|
30
|
-
title: "Помилка!",
|
31
|
-
message: "Сталася помилка",
|
32
|
-
type: "error"
|
33
|
-
});
|
34
|
-
}
|
35
|
-
},
|
36
|
-
async getFormScheme() {
|
37
|
-
var r, t, a, l;
|
38
|
-
try {
|
39
|
-
const { data: e } = await m.get(
|
40
|
-
"/api/template/form/admin.profile.form"
|
41
|
-
);
|
42
|
-
console.log(this.userData);
|
43
|
-
for (const s in e == null ? void 0 : e.schema)
|
44
|
-
(t = (r = this.userData) == null ? void 0 : r.user) != null && t[s] && (this.formValues[s] = (l = (a = this.userData) == null ? void 0 : a.user) == null ? void 0 : l[s]);
|
45
|
-
this.formScheme = e.schema;
|
46
|
-
} catch (e) {
|
47
|
-
console.error(e);
|
48
|
-
}
|
49
|
-
}
|
50
|
-
}
|
51
|
-
}, g = { class: "flex justify-center pt-[20px] pb-[20px] pl-[20px] h-[calc(100vh-58px)]" }, k = { class: "bg-white rounded-xl p-[20px]" }, y = { class: "flex-1 overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-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" }, w = { class: "flex" };
|
52
|
-
function _(r, t, a, l, e, s) {
|
53
|
-
const i = f("VsForm");
|
54
|
-
return u(), d("div", g, [
|
55
|
-
o("div", k, [
|
56
|
-
t[2] || (t[2] = o("h2", { class: "mb-[20px] text-center" }, "Профіль", -1)),
|
57
|
-
o("div", y, [
|
58
|
-
e.formScheme ? (u(), h(i, {
|
59
|
-
key: 0,
|
60
|
-
scheme: e.formScheme,
|
61
|
-
modelValue: e.formValues,
|
62
|
-
"onUpdate:modelValue": t[0] || (t[0] = (c) => e.formValues = c),
|
63
|
-
class: "pb-0"
|
64
|
-
}, null, 8, ["scheme", "modelValue"])) : b("", !0),
|
65
|
-
o("div", w, [
|
66
|
-
o("button", {
|
67
|
-
onClick: t[1] || (t[1] = (...c) => s.updateUser && s.updateUser(...c)),
|
68
|
-
class: "ml-auto text-[18px] bg-blue-500 text-white px-[8px] py-[4px] rounded hover:bg-blue-700 duration-300"
|
69
|
-
}, " Зберегти ")
|
70
|
-
])
|
71
|
-
])
|
72
|
-
])
|
73
|
-
]);
|
74
|
-
}
|
75
|
-
const D = /* @__PURE__ */ n(x, [["render", _]]);
|
76
|
-
export {
|
77
|
-
D as default
|
78
|
-
};
|