@opengis/surveyor 0.0.14 → 0.0.15
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/chunks/{AppIcon-CO70tpMX.js → AppIcon-Di5F4Bu_.js} +1 -1
- package/dist/chunks/{AppealDetailField-DNRGpnyD.js → AppealDetailField-DNpsGpPY.js} +2 -2
- package/dist/chunks/{AppealStatusBadge-Ct3EcB4_.js → AppealStatusBadge-COxcUM2Q.js} +1 -1
- package/dist/chunks/{AppealStatusBadge-BlAaNUSK.js → AppealStatusBadge-z77wwkFD.js} +2 -2
- package/dist/chunks/{ApplicationHistorySection-D7KPV2cX.js → ApplicationHistorySection-DHq-iJla.js} +4 -4
- package/dist/chunks/{BaseModal-SjP521X9.js → BaseModal-DP_ilBdg.js} +2 -2
- package/dist/chunks/{FormFilePicker-DxPQlxgy.js → FormFilePicker-D5fAUE0Z.js} +2 -2
- package/dist/chunks/{MapLayerMenu-AUeTqgEp.js → MapLayerMenu-CI5cbLEC.js} +1 -1
- package/dist/chunks/{RegistryForm-BlK1lExt.js → RegistryForm-Ct8xiLV0.js} +1 -1
- package/dist/chunks/{RegistryFormModal-DhzEpxys.js → RegistryFormModal-DTi3g3CX.js} +3 -3
- package/dist/chunks/{RegistryToolbar-DXOEcD84.js → RegistryToolbar-v7DdReH2.js} +5 -5
- package/dist/chunks/{SurveyorTeleport-CnSF0Ptl.js → SurveyorTeleport-D6-KXe_5.js} +1 -1
- package/dist/chunks/{TablePagination-CUtnDQQ_.js → TablePagination-Iri38U68.js} +2 -2
- package/dist/chunks/{UserAccessBadge-DyZDv7Oo.js → UserAccessBadge-B5Q1LvNv.js} +1 -1
- package/dist/chunks/{UserTypeBadge-LvnMuKGo.js → UserTypeBadge-CuAMctTK.js} +1 -1
- package/dist/chunks/{VerifiedBadge-bk0n-rlC.js → VerifiedBadge-D6L7mCdp.js} +2 -2
- package/dist/chunks/{card-DEJs9IIP.js → card-Ba8_kfj9.js} +4 -4
- package/dist/chunks/{card-C-ohjNkC.js → card-CF5Lo4ui.js} +5 -5
- package/dist/chunks/{card-BBx1zR0E.js → card-CJhdeB6f.js} +10 -10
- package/dist/chunks/{card-Bj4zFzbe.js → card-CVujkVkR.js} +10 -10
- package/dist/chunks/{card-_YyJbLNI.js → card-DcYkb_aF.js} +6 -6
- package/dist/chunks/{card-VnUCFC7v.js → card-TP5UFJb2.js} +5 -5
- package/dist/chunks/{certificates-DtfZTFN9.js → certificates-Ew5AekPn.js} +6 -6
- package/dist/chunks/{create-Cgeu7aKO.js → create-CSIDl4gP.js} +9 -9
- package/dist/chunks/{forgot-DoG6vXhq.js → forgot-DnixBqdc.js} +2 -2
- package/dist/chunks/{login-BWGylcSU.js → login-BWCQdEkv.js} +2 -2
- package/dist/chunks/{map-layers-BmuIMLHa.js → map-layers-BdWEHPLx.js} +6 -6
- package/dist/chunks/{map-DkKsEnCM.js → map-mZ8Rn4aR.js} +11 -11
- package/dist/chunks/{organizations-BO1dIl7v.js → organizations-D0o0e_ps.js} +7 -7
- package/dist/chunks/{profile-CkwMFh82.js → profile-F7mr0poI.js} +3 -3
- package/dist/chunks/{registration-3GLgq-ae.js → registration-BRF4985_.js} +2 -2
- package/dist/chunks/{requests-rWq8ok3C.js → requests-BCJN-CNx.js} +5 -5
- package/dist/chunks/{requests-BZ2jrt5J.js → requests-F0Kp8OPp.js} +5 -5
- package/dist/chunks/{reset-CP9LsLkC.js → reset-OZCgLi6f.js} +2 -2
- package/dist/chunks/{useEntityPath-C5Owtidc.js → useEntityPath-8s0Y1tjA.js} +1 -1
- package/dist/chunks/{users-DOiQeVwn.js → users-Dr543AYk.js} +7 -7
- package/dist/index.css +1 -1
- package/dist/index.js +40 -40
- package/migrations/20261016120000_map_layers.sql +156 -156
- package/migrations/20261016150000_password_reset.sql +15 -15
- package/migrations/20261016180000_settlement_lookup.sql +16 -16
- package/package.json +83 -83
- package/server/dictionaries/index.ts +17 -17
- package/server/dictionaries/surveyor/map_layer_components.ts +11 -11
- package/server/dictionaries/surveyor/map_layer_groups.ts +10 -10
- package/server/dictionaries/surveyor/map_layer_types.ts +11 -11
- package/server/modules/surveyor/route.ts +13 -12
- package/server/modules/surveyor/services/applicationTile.ts +3 -3
- package/server/modules/surveyor/services/cancelApplication.ts +2 -1
- package/server/modules/surveyor/services/changeSurveyorPasswordByAdmin.ts +1 -1
- package/server/modules/surveyor/services/completeApplication.ts +1 -1
- package/server/modules/surveyor/services/identifyApplications.ts +2 -2
- package/server/modules/surveyor/services/issueSourceData.ts +1 -1
- package/server/modules/surveyor/services/mapLayers.ts +61 -61
- package/server/modules/surveyor/services/registerSurveyor.ts +1 -1
- package/server/modules/surveyor/services/resendRegistration.ts +1 -1
- package/server/modules/surveyor/services/searchApplications.ts +2 -2
- package/server/modules/surveyor/services/updateSurveyorAccountStatus.ts +1 -1
- package/server/modules/surveyor/services/updateSurveyorStatus.ts +1 -1
- package/server/modules/surveyor/services/verifyApplication.ts +1 -1
- package/server/modules/surveyor/utils/shared.ts +28 -6
- package/server/modules/surveyor/utils/templates/ds.surveyor_password_reset.pt.hbs +79 -79
- package/server/resources/helpers/settlement_lookup.ts +7 -7
- package/server/resources/surveyor-admin/application_comments.ts +1 -1
- package/server/resources/surveyor-admin/application_status_history.ts +1 -1
- package/server/resources/surveyor-admin/applications.ts +1 -1
- package/server/resources/surveyor-admin/certificates.ts +1 -1
- package/server/resources/surveyor-admin/map_layers.ts +1 -1
- package/server/resources/surveyor-admin/organization_surveyors.ts +31 -31
- package/server/resources/surveyor-admin/organizations.ts +1 -1
- package/server/resources/surveyor-admin/surveyors.ts +1 -1
|
@@ -16,7 +16,7 @@ export async function updateSurveyorAccountStatus(
|
|
|
16
16
|
ctx: AppContext;
|
|
17
17
|
}
|
|
18
18
|
) {
|
|
19
|
-
const uid = admin(user);
|
|
19
|
+
const uid = admin(user, "surveyors:update");
|
|
20
20
|
if (typeof input.enabled !== "boolean") {
|
|
21
21
|
throw new BadRequestError("Enabled must be a boolean");
|
|
22
22
|
}
|
|
@@ -16,7 +16,7 @@ export async function updateSurveyorStatus(
|
|
|
16
16
|
ctx: AppContext;
|
|
17
17
|
}
|
|
18
18
|
) {
|
|
19
|
-
const uid = admin(user);
|
|
19
|
+
const uid = admin(user, "surveyors:update");
|
|
20
20
|
if (typeof input.enabled !== "boolean") {
|
|
21
21
|
throw new BadRequestError("Enabled must be a boolean");
|
|
22
22
|
}
|
|
@@ -22,7 +22,7 @@ export async function verifyApplication(
|
|
|
22
22
|
ctx: AppContext;
|
|
23
23
|
}
|
|
24
24
|
) {
|
|
25
|
-
const uid = admin(user);
|
|
25
|
+
const uid = admin(user, "applications:update");
|
|
26
26
|
const file = input.file_path
|
|
27
27
|
? await attachedFile({ ctx, appId: id, filePath: input.file_path })
|
|
28
28
|
: null;
|
|
@@ -39,15 +39,37 @@ export function actor(user: User | undefined): string {
|
|
|
39
39
|
return user.id;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/** Право, що відкриває адмінський (службовий) режим кабінету. */
|
|
43
|
+
export const STAFF_PERMISSION = "applications:read";
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Чи має користувач право: адміністратор має всі, інші — лише видані (`resource:action`).
|
|
47
|
+
* @param user Користувач із запиту.
|
|
48
|
+
* @param permission Право у форматі `resource:action`.
|
|
49
|
+
*/
|
|
50
|
+
export function hasPermission(user: User | undefined, permission: string): boolean {
|
|
51
|
+
return user?.type === "admin" || Boolean(user?.permissions?.includes(permission));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Чи працює користувач у службовому режимі (адміністратор або працівник з правами),
|
|
56
|
+
* а не як геодезист.
|
|
57
|
+
* @param user Користувач із запиту.
|
|
58
|
+
*/
|
|
59
|
+
export function isStaff(user: User | undefined): boolean {
|
|
60
|
+
return hasPermission(user, STAFF_PERMISSION);
|
|
61
|
+
}
|
|
62
|
+
|
|
42
63
|
/**
|
|
43
|
-
* Перевіряє
|
|
64
|
+
* Перевіряє службове право та повертає ідентифікатор користувача.
|
|
44
65
|
* @param user Користувач із запиту.
|
|
45
|
-
* @
|
|
66
|
+
* @param permission Потрібне право у форматі `resource:action`.
|
|
67
|
+
* @returns Ідентифікатор користувача.
|
|
46
68
|
*/
|
|
47
|
-
export function admin(user: User | undefined): string {
|
|
69
|
+
export function admin(user: User | undefined, permission: string): string {
|
|
48
70
|
const id = actor(user);
|
|
49
|
-
if (user
|
|
50
|
-
throw new ForbiddenError(
|
|
71
|
+
if (!hasPermission(user, permission)) {
|
|
72
|
+
throw new ForbiddenError(`Missing permission: ${permission}`);
|
|
51
73
|
}
|
|
52
74
|
return id;
|
|
53
75
|
}
|
|
@@ -127,7 +149,7 @@ export async function surveyorForUser(
|
|
|
127
149
|
export async function canReadApplication(
|
|
128
150
|
{ db, app, user }: { db: Db; app: Application; user: User | undefined }
|
|
129
151
|
): Promise<void> {
|
|
130
|
-
if (user
|
|
152
|
+
if (isStaff(user)) {
|
|
131
153
|
return;
|
|
132
154
|
}
|
|
133
155
|
const surveyorId = await surveyorForUser({ db, user });
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="uk">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8">
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
-
<title>Відновлення пароля</title>
|
|
8
|
-
<style>
|
|
9
|
-
body {
|
|
10
|
-
font-family: Arial, sans-serif;
|
|
11
|
-
color: #333;
|
|
12
|
-
background-color: #f4f4f4;
|
|
13
|
-
padding: 20px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.email-container {
|
|
17
|
-
max-width: 600px;
|
|
18
|
-
margin: 0 auto;
|
|
19
|
-
background-color: #ffffff;
|
|
20
|
-
padding: 20px;
|
|
21
|
-
border-radius: 5px;
|
|
22
|
-
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
h1 {
|
|
26
|
-
font-size: 20px;
|
|
27
|
-
color: #000;
|
|
28
|
-
margin-bottom: 20px;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
p {
|
|
32
|
-
line-height: 1.6;
|
|
33
|
-
margin: 10px 0;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.credentials {
|
|
37
|
-
font-weight: bold;
|
|
38
|
-
margin-top: 10px;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
a {
|
|
42
|
-
color: #007bff;
|
|
43
|
-
text-decoration: none;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
a:hover {
|
|
47
|
-
text-decoration: underline;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.footer {
|
|
51
|
-
font-size: 12px;
|
|
52
|
-
color: #777;
|
|
53
|
-
margin-top: 20px;
|
|
54
|
-
text-align: center;
|
|
55
|
-
}
|
|
56
|
-
</style>
|
|
57
|
-
</head>
|
|
58
|
-
|
|
59
|
-
<body>
|
|
60
|
-
<div class="email-container">
|
|
61
|
-
<h1>Відновлення пароля до
|
|
62
|
-
<a target="_blank" href="{{protocol}}://{{host}}">кабінету геодезиста</a>
|
|
63
|
-
</h1>
|
|
64
|
-
<p class="credentials">
|
|
65
|
-
Логін: <strong>{{login}}</strong>
|
|
66
|
-
</p>
|
|
67
|
-
<p>
|
|
68
|
-
Щоб встановити новий пароль, відкрийте це посилання або скопіюйте його в адресний рядок вашого браузера:<br>
|
|
69
|
-
<a target="_blank" href="{{resetUrl}}">{{resetUrl}}</a>
|
|
70
|
-
</p>
|
|
71
|
-
<p>Посилання дійсне протягом 1 години і може бути використане лише один раз.</p>
|
|
72
|
-
<p>Якщо ви не надсилали запит на відновлення пароля, проігноруйте цей лист — ваш поточний пароль залишиться без змін.</p>
|
|
73
|
-
<div class="footer">
|
|
74
|
-
Це автоматично створений лист, будь ласка, не відповідайте на нього.
|
|
75
|
-
</div>
|
|
76
|
-
</div>
|
|
77
|
-
</body>
|
|
78
|
-
|
|
79
|
-
</html>
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="uk">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
7
|
+
<title>Відновлення пароля</title>
|
|
8
|
+
<style>
|
|
9
|
+
body {
|
|
10
|
+
font-family: Arial, sans-serif;
|
|
11
|
+
color: #333;
|
|
12
|
+
background-color: #f4f4f4;
|
|
13
|
+
padding: 20px;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.email-container {
|
|
17
|
+
max-width: 600px;
|
|
18
|
+
margin: 0 auto;
|
|
19
|
+
background-color: #ffffff;
|
|
20
|
+
padding: 20px;
|
|
21
|
+
border-radius: 5px;
|
|
22
|
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
h1 {
|
|
26
|
+
font-size: 20px;
|
|
27
|
+
color: #000;
|
|
28
|
+
margin-bottom: 20px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
p {
|
|
32
|
+
line-height: 1.6;
|
|
33
|
+
margin: 10px 0;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.credentials {
|
|
37
|
+
font-weight: bold;
|
|
38
|
+
margin-top: 10px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
a {
|
|
42
|
+
color: #007bff;
|
|
43
|
+
text-decoration: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
a:hover {
|
|
47
|
+
text-decoration: underline;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.footer {
|
|
51
|
+
font-size: 12px;
|
|
52
|
+
color: #777;
|
|
53
|
+
margin-top: 20px;
|
|
54
|
+
text-align: center;
|
|
55
|
+
}
|
|
56
|
+
</style>
|
|
57
|
+
</head>
|
|
58
|
+
|
|
59
|
+
<body>
|
|
60
|
+
<div class="email-container">
|
|
61
|
+
<h1>Відновлення пароля до
|
|
62
|
+
<a target="_blank" href="{{protocol}}://{{host}}">кабінету геодезиста</a>
|
|
63
|
+
</h1>
|
|
64
|
+
<p class="credentials">
|
|
65
|
+
Логін: <strong>{{login}}</strong>
|
|
66
|
+
</p>
|
|
67
|
+
<p>
|
|
68
|
+
Щоб встановити новий пароль, відкрийте це посилання або скопіюйте його в адресний рядок вашого браузера:<br>
|
|
69
|
+
<a target="_blank" href="{{resetUrl}}">{{resetUrl}}</a>
|
|
70
|
+
</p>
|
|
71
|
+
<p>Посилання дійсне протягом 1 години і може бути використане лише один раз.</p>
|
|
72
|
+
<p>Якщо ви не надсилали запит на відновлення пароля, проігноруйте цей лист — ваш поточний пароль залишиться без змін.</p>
|
|
73
|
+
<div class="footer">
|
|
74
|
+
Це автоматично створений лист, будь ласка, не відповідайте на нього.
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</body>
|
|
78
|
+
|
|
79
|
+
</html>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// The view prefixes the settlement name with its type for lookup labels.
|
|
2
|
-
export const settlementLookup = {
|
|
3
|
-
table: "surveyor.settlement_lookup",
|
|
4
|
-
value: "katottg",
|
|
5
|
-
text: "settlement_text",
|
|
6
|
-
filterFields: ["level"],
|
|
7
|
-
};
|
|
1
|
+
// The view prefixes the settlement name with its type for lookup labels.
|
|
2
|
+
export const settlementLookup = {
|
|
3
|
+
table: "surveyor.settlement_lookup",
|
|
4
|
+
value: "katottg",
|
|
5
|
+
text: "settlement_text",
|
|
6
|
+
filterFields: ["level"],
|
|
7
|
+
};
|
|
@@ -18,7 +18,7 @@ export default {
|
|
|
18
18
|
title: "Заявки на геодезичні роботи",
|
|
19
19
|
table: "surveyor.applications",
|
|
20
20
|
key: "app_id",
|
|
21
|
-
access: "
|
|
21
|
+
access: "user",
|
|
22
22
|
operations: ["read", "update"],
|
|
23
23
|
searchable: ["number", "location", "description"],
|
|
24
24
|
capabilities: ["notes", "files"],
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import type { ResourceContract } from '@opengis/fcore';
|
|
2
|
-
|
|
3
|
-
export default {
|
|
4
|
-
name: 'organization_surveyors',
|
|
5
|
-
version: 1,
|
|
6
|
-
table: 'surveyor.organization_surveyors',
|
|
7
|
-
key: 'org_id',
|
|
8
|
-
module: 'surveyor',
|
|
9
|
-
operations: ["read"],
|
|
10
|
-
fields: {
|
|
11
|
-
org_id: { type: 'text', read: true, },
|
|
12
|
-
surveyor_id: { type: 'text', read: true },
|
|
13
|
-
first_name: { type: 'text', read: true },
|
|
14
|
-
last_name: { type: 'text', read: true },
|
|
15
|
-
middle_name: { type: 'text', read: true },
|
|
16
|
-
enabled: { type: 'boolean', read: true },
|
|
17
|
-
created_by: { type: 'text', read: true },
|
|
18
|
-
created_at: { type: 'timestamp', read: true },
|
|
19
|
-
registered_at: { type: 'timestamp', read: true },
|
|
20
|
-
email: { type: 'text', read: true },
|
|
21
|
-
phone: { type: 'text', read: true },
|
|
22
|
-
certificate_id: {
|
|
23
|
-
type: 'text',
|
|
24
|
-
read: true,
|
|
25
|
-
lookup: { table: 'surveyor.certificates', value: 'certificate_id', text: 'number_certificate' },
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
joins: [{
|
|
29
|
-
sql: `LEFT JOIN LATERAL (select first_name, last_name, middle_name, registered_at, email, phone, certificate_id, enabled AS surveyor_enabled from surveyor.surveyors s where s.surveyor_id = t.surveyor_id) as s on true`
|
|
30
|
-
}]
|
|
31
|
-
|
|
1
|
+
import type { ResourceContract } from '@opengis/fcore';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
name: 'organization_surveyors',
|
|
5
|
+
version: 1,
|
|
6
|
+
table: 'surveyor.organization_surveyors',
|
|
7
|
+
key: 'org_id',
|
|
8
|
+
module: 'surveyor',
|
|
9
|
+
operations: ["read"],
|
|
10
|
+
fields: {
|
|
11
|
+
org_id: { type: 'text', read: true, },
|
|
12
|
+
surveyor_id: { type: 'text', read: true },
|
|
13
|
+
first_name: { type: 'text', read: true },
|
|
14
|
+
last_name: { type: 'text', read: true },
|
|
15
|
+
middle_name: { type: 'text', read: true },
|
|
16
|
+
enabled: { type: 'boolean', read: true },
|
|
17
|
+
created_by: { type: 'text', read: true },
|
|
18
|
+
created_at: { type: 'timestamp', read: true },
|
|
19
|
+
registered_at: { type: 'timestamp', read: true },
|
|
20
|
+
email: { type: 'text', read: true },
|
|
21
|
+
phone: { type: 'text', read: true },
|
|
22
|
+
certificate_id: {
|
|
23
|
+
type: 'text',
|
|
24
|
+
read: true,
|
|
25
|
+
lookup: { table: 'surveyor.certificates', value: 'certificate_id', text: 'number_certificate' },
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
joins: [{
|
|
29
|
+
sql: `LEFT JOIN LATERAL (select first_name, last_name, middle_name, registered_at, email, phone, certificate_id, enabled AS surveyor_enabled from surveyor.surveyors s where s.surveyor_id = t.surveyor_id) as s on true`
|
|
30
|
+
}]
|
|
31
|
+
|
|
32
32
|
} satisfies ResourceContract;
|
|
@@ -9,7 +9,7 @@ export default {
|
|
|
9
9
|
table: "surveyor.organizations",
|
|
10
10
|
key: "org_id",
|
|
11
11
|
display: ["name"],
|
|
12
|
-
access: "
|
|
12
|
+
access: "user",
|
|
13
13
|
operations: ["read", "create", "update", "delete"],
|
|
14
14
|
searchable: ["name", "email", "phone"],
|
|
15
15
|
capabilities: ["notes", "files"],
|