@opengis/surveyor 0.0.21 → 0.0.22
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-Di5F4Bu_.js → AppIcon-CCLzEE-_.js} +1 -1
- package/dist/chunks/{AppealDetailField-CWayoaII.js → AppealDetailField-BUkzf_fd.js} +2 -2
- package/dist/chunks/{AppealStatusBadge-RQkpbDmk.js → AppealStatusBadge-ClFdtWGr.js} +1 -1
- package/dist/chunks/{AppealStatusBadge-z77wwkFD.js → AppealStatusBadge-CzzI6x8I.js} +2 -2
- package/dist/chunks/{ApplicationGeometryExportModal-CH9VrqxO.js → ApplicationGeometryExportModal-jLas6-rv.js} +7 -7
- package/dist/chunks/{BaseModal-X-hzV_I2.js → BaseModal-BvHbtINw.js} +2 -2
- package/dist/chunks/{FormFilePicker-D5fAUE0Z.js → FormFilePicker-Dss6pGmO.js} +2 -2
- package/dist/chunks/{MapLayerMenu-CyVxRSNX.js → MapLayerMenu-BeherGz6.js} +1 -1
- package/dist/chunks/{RegistryForm-J7R4RWO3.js → RegistryForm-CRd2gUjs.js} +1 -1
- package/dist/chunks/{RegistryFormModal-B_EDwu9O.js → RegistryFormModal-BhYsDr2N.js} +3 -3
- package/dist/chunks/{RegistryToolbar-BDVaZ2Rf.js → RegistryToolbar-BOBzfY5O.js} +5 -5
- package/dist/chunks/{SurveyorTeleport-Y-NJhfsb.js → SurveyorTeleport-CHkB_uiv.js} +1 -1
- package/dist/chunks/{TablePagination-CZhRgCVr.js → TablePagination-vMlynwhO.js} +2 -2
- package/dist/chunks/{UserAccessBadge-B5Q1LvNv.js → UserAccessBadge-D8JfgGfN.js} +1 -1
- package/dist/chunks/{UserTypeBadge-CuAMctTK.js → UserTypeBadge-YIwwoCho.js} +1 -1
- package/dist/chunks/{VerifiedBadge-D6L7mCdp.js → VerifiedBadge-B__Vs_ce.js} +2 -2
- package/dist/chunks/{card-Dy333mEd.js → card-Bg2s2sUj.js} +5 -5
- package/dist/chunks/{card-Cll0FQ0z.js → card-BlhHWS3W.js} +6 -6
- package/dist/chunks/{card-Bw_EXY3D.js → card-CR1YmWBu.js} +4 -4
- package/dist/chunks/{card-DMt5SAoD.js → card-DxYRpS4g.js} +5 -5
- package/dist/chunks/{card-pTFhEtmI.js → card-Yp61N7At.js} +11 -11
- package/dist/chunks/{card-BMe6jQRR.js → card-pMk7mIJk.js} +10 -10
- package/dist/chunks/{certificates-URuwsRqg.js → certificates-CtLcclid.js} +6 -6
- package/dist/chunks/{create-CJXITPL0.js → create-Do1oraFc.js} +9 -9
- package/dist/chunks/{forgot-JFlAKndO.js → forgot-Ch4FUFpq.js} +2 -2
- package/dist/chunks/{login-Bd6krLDP.js → login-C3w9BK6L.js} +2 -2
- package/dist/chunks/{map-BZg1CvsE.js → map-CecGe6bQ.js} +11 -11
- package/dist/chunks/{map-layers-BgK6h6AD.js → map-layers-DGRdYvYA.js} +6 -6
- package/dist/chunks/{organizations-BLYhVQwf.js → organizations-DJ5vdt9m.js} +7 -7
- package/dist/chunks/{profile-F7mr0poI.js → profile-BI_RIHN1.js} +3 -3
- package/dist/chunks/{registration-DIA4xV-t.js → registration-Bi_Z4Os3.js} +2 -2
- package/dist/chunks/{requests-CPVQ1Yy_.js → requests-D19RKr0i.js} +5 -5
- package/dist/chunks/{requests-DhLUiL_6.js → requests-fCA3ykNT.js} +6 -6
- package/dist/chunks/{reset-DR3GXwrH.js → reset-DYBGrvE-.js} +2 -2
- package/dist/chunks/{useEntityPath-8s0Y1tjA.js → useEntityPath-n7hCq8zh.js} +1 -1
- package/dist/chunks/{users-BsWV3iTt.js → users-BxDdMbAB.js} +7 -7
- 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/migrations/20261105120000_user_lookup.sql +15 -15
- package/package.json +1 -1
- 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/services/changeApplicationStatus.ts +100 -100
- package/server/modules/surveyor/services/createApplication.ts +2 -2
- package/server/modules/surveyor/services/mapLayers.ts +61 -61
- package/server/modules/surveyor/utils/templates/ds.surveyor_admin_password.pt.hbs +79 -79
- 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/applications.ts +126 -126
- package/server/resources/surveyor-admin/certificates.ts +113 -113
- package/server/resources/surveyor-admin/organization_surveyors.ts +31 -31
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import type { AppContext, User } from "@opengis/fcore";
|
|
2
|
-
import { BadRequestError, ConflictError, FCoreError, ForbiddenError } from "@opengis/fcore";
|
|
3
|
-
import {
|
|
4
|
-
admin,
|
|
5
|
-
audit,
|
|
6
|
-
history,
|
|
7
|
-
readApplication,
|
|
8
|
-
releaseReservesForParent,
|
|
9
|
-
type Db,
|
|
10
|
-
type Status,
|
|
11
|
-
} from "../utils/shared.js";
|
|
12
|
-
|
|
13
|
-
/** Статуси, з яких службовий користувач (не адміністратор) може скасувати заявку. */
|
|
14
|
-
export const STAFF_CANCELLABLE_STATUSES: Status[] = ["reserve", "awaitingData", "dataIssued"];
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Ручна зміна статусу заявки з адмінки.
|
|
18
|
-
* Адміністратор (`type = admin`) може встановити будь-який статус на будь-якому етапі;
|
|
19
|
-
* користувач із правом `applications:update` (через роль) — лише скасувати заявку
|
|
20
|
-
* в статусах `reserve`, `awaitingData`, `dataIssued`.
|
|
21
|
-
* @param params Заявка, новий статус, причина, користувач і контекст FCore.
|
|
22
|
-
* @returns Новий статус і перелік заявок, знятих із резерву.
|
|
23
|
-
*/
|
|
24
|
-
export async function changeApplicationStatus({
|
|
25
|
-
id,
|
|
26
|
-
status,
|
|
27
|
-
reason,
|
|
28
|
-
user,
|
|
29
|
-
ctx,
|
|
30
|
-
}: {
|
|
31
|
-
id: string;
|
|
32
|
-
status: Status;
|
|
33
|
-
reason?: string | null;
|
|
34
|
-
user: User | undefined;
|
|
35
|
-
ctx: AppContext;
|
|
36
|
-
}) {
|
|
37
|
-
const uid = admin(user, "applications:update");
|
|
38
|
-
const isAdmin = user?.type === "admin";
|
|
39
|
-
const text = reason?.trim() || null;
|
|
40
|
-
|
|
41
|
-
if (!isAdmin && status !== "cancelled") {
|
|
42
|
-
throw new ForbiddenError("Only administrator can change application status");
|
|
43
|
-
}
|
|
44
|
-
if (status === "cancelled" && !text) {
|
|
45
|
-
throw new BadRequestError("Cancel reason is required");
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const result = await ctx.pg.transaction(async (db: Db) => {
|
|
49
|
-
// Узгоджує зміну статусу та звільнення резервів із паралельним створенням заявок.
|
|
50
|
-
await db.query("SELECT pg_advisory_xact_lock(85437120)");
|
|
51
|
-
const app = await readApplication({ db, id });
|
|
52
|
-
const from = app.status;
|
|
53
|
-
|
|
54
|
-
if (from === status) {
|
|
55
|
-
throw new FCoreError("APPLICATION_INVALID_STATUS", `Application is already in ${status} status`, 409);
|
|
56
|
-
}
|
|
57
|
-
if (!isAdmin && !STAFF_CANCELLABLE_STATUSES.includes(from)) {
|
|
58
|
-
throw new FCoreError(
|
|
59
|
-
"APPLICATION_INVALID_STATUS",
|
|
60
|
-
`Application can be cancelled only in ${STAFF_CANCELLABLE_STATUSES.join(", ")} status`,
|
|
61
|
-
409
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const cancelled = status === "cancelled";
|
|
66
|
-
const updated = await db.query<{ app_id: string }>(
|
|
67
|
-
`UPDATE surveyor.applications
|
|
68
|
-
SET status = $2,
|
|
69
|
-
cancel_reason = CASE WHEN $4 THEN $5 ELSE NULL END,
|
|
70
|
-
cancelled_at = CASE WHEN $4 THEN now() ELSE NULL END,
|
|
71
|
-
cancelled_by = CASE WHEN $4 THEN $3 ELSE NULL END,
|
|
72
|
-
verified_at = CASE WHEN $2 = 'verified' THEN coalesce(verified_at, now()) ELSE verified_at END,
|
|
73
|
-
verified_by = CASE WHEN $2 = 'verified' THEN coalesce(verified_by, $3) ELSE verified_by END,
|
|
74
|
-
integrated_at = CASE WHEN $2 = 'completed' THEN coalesce(integrated_at, now()) ELSE integrated_at END,
|
|
75
|
-
integrated_by = CASE WHEN $2 = 'completed' THEN coalesce(integrated_by, $3) ELSE integrated_by END,
|
|
76
|
-
updated_by = $3,
|
|
77
|
-
updated_at = now()
|
|
78
|
-
WHERE app_id = $1 AND status = $6
|
|
79
|
-
RETURNING app_id`,
|
|
80
|
-
[id, status, uid, cancelled, text, from]
|
|
81
|
-
);
|
|
82
|
-
if (!updated.rows[0]) {
|
|
83
|
-
throw new ConflictError("Application changed concurrently");
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
await history({ db, appId: id, from, to: status, by: uid, reason: text });
|
|
87
|
-
|
|
88
|
-
const released =
|
|
89
|
-
status === "cancelled" || status === "completed"
|
|
90
|
-
? await releaseReservesForParent({ db, parentId: id, uid })
|
|
91
|
-
: [];
|
|
92
|
-
return { id, status, released };
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
await audit({ ctx, action: status === "cancelled" ? "cancel" : "changeStatus", appId: id, uid });
|
|
96
|
-
for (const released of result.released) {
|
|
97
|
-
await audit({ ctx, action: "releaseReserve", appId: released, uid });
|
|
98
|
-
}
|
|
99
|
-
return result;
|
|
100
|
-
}
|
|
1
|
+
import type { AppContext, User } from "@opengis/fcore";
|
|
2
|
+
import { BadRequestError, ConflictError, FCoreError, ForbiddenError } from "@opengis/fcore";
|
|
3
|
+
import {
|
|
4
|
+
admin,
|
|
5
|
+
audit,
|
|
6
|
+
history,
|
|
7
|
+
readApplication,
|
|
8
|
+
releaseReservesForParent,
|
|
9
|
+
type Db,
|
|
10
|
+
type Status,
|
|
11
|
+
} from "../utils/shared.js";
|
|
12
|
+
|
|
13
|
+
/** Статуси, з яких службовий користувач (не адміністратор) може скасувати заявку. */
|
|
14
|
+
export const STAFF_CANCELLABLE_STATUSES: Status[] = ["reserve", "awaitingData", "dataIssued"];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Ручна зміна статусу заявки з адмінки.
|
|
18
|
+
* Адміністратор (`type = admin`) може встановити будь-який статус на будь-якому етапі;
|
|
19
|
+
* користувач із правом `applications:update` (через роль) — лише скасувати заявку
|
|
20
|
+
* в статусах `reserve`, `awaitingData`, `dataIssued`.
|
|
21
|
+
* @param params Заявка, новий статус, причина, користувач і контекст FCore.
|
|
22
|
+
* @returns Новий статус і перелік заявок, знятих із резерву.
|
|
23
|
+
*/
|
|
24
|
+
export async function changeApplicationStatus({
|
|
25
|
+
id,
|
|
26
|
+
status,
|
|
27
|
+
reason,
|
|
28
|
+
user,
|
|
29
|
+
ctx,
|
|
30
|
+
}: {
|
|
31
|
+
id: string;
|
|
32
|
+
status: Status;
|
|
33
|
+
reason?: string | null;
|
|
34
|
+
user: User | undefined;
|
|
35
|
+
ctx: AppContext;
|
|
36
|
+
}) {
|
|
37
|
+
const uid = admin(user, "applications:update");
|
|
38
|
+
const isAdmin = user?.type === "admin";
|
|
39
|
+
const text = reason?.trim() || null;
|
|
40
|
+
|
|
41
|
+
if (!isAdmin && status !== "cancelled") {
|
|
42
|
+
throw new ForbiddenError("Only administrator can change application status");
|
|
43
|
+
}
|
|
44
|
+
if (status === "cancelled" && !text) {
|
|
45
|
+
throw new BadRequestError("Cancel reason is required");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const result = await ctx.pg.transaction(async (db: Db) => {
|
|
49
|
+
// Узгоджує зміну статусу та звільнення резервів із паралельним створенням заявок.
|
|
50
|
+
await db.query("SELECT pg_advisory_xact_lock(85437120)");
|
|
51
|
+
const app = await readApplication({ db, id });
|
|
52
|
+
const from = app.status;
|
|
53
|
+
|
|
54
|
+
if (from === status) {
|
|
55
|
+
throw new FCoreError("APPLICATION_INVALID_STATUS", `Application is already in ${status} status`, 409);
|
|
56
|
+
}
|
|
57
|
+
if (!isAdmin && !STAFF_CANCELLABLE_STATUSES.includes(from)) {
|
|
58
|
+
throw new FCoreError(
|
|
59
|
+
"APPLICATION_INVALID_STATUS",
|
|
60
|
+
`Application can be cancelled only in ${STAFF_CANCELLABLE_STATUSES.join(", ")} status`,
|
|
61
|
+
409
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const cancelled = status === "cancelled";
|
|
66
|
+
const updated = await db.query<{ app_id: string }>(
|
|
67
|
+
`UPDATE surveyor.applications
|
|
68
|
+
SET status = $2,
|
|
69
|
+
cancel_reason = CASE WHEN $4 THEN $5 ELSE NULL END,
|
|
70
|
+
cancelled_at = CASE WHEN $4 THEN now() ELSE NULL END,
|
|
71
|
+
cancelled_by = CASE WHEN $4 THEN $3 ELSE NULL END,
|
|
72
|
+
verified_at = CASE WHEN $2 = 'verified' THEN coalesce(verified_at, now()) ELSE verified_at END,
|
|
73
|
+
verified_by = CASE WHEN $2 = 'verified' THEN coalesce(verified_by, $3) ELSE verified_by END,
|
|
74
|
+
integrated_at = CASE WHEN $2 = 'completed' THEN coalesce(integrated_at, now()) ELSE integrated_at END,
|
|
75
|
+
integrated_by = CASE WHEN $2 = 'completed' THEN coalesce(integrated_by, $3) ELSE integrated_by END,
|
|
76
|
+
updated_by = $3,
|
|
77
|
+
updated_at = now()
|
|
78
|
+
WHERE app_id = $1 AND status = $6
|
|
79
|
+
RETURNING app_id`,
|
|
80
|
+
[id, status, uid, cancelled, text, from]
|
|
81
|
+
);
|
|
82
|
+
if (!updated.rows[0]) {
|
|
83
|
+
throw new ConflictError("Application changed concurrently");
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
await history({ db, appId: id, from, to: status, by: uid, reason: text });
|
|
87
|
+
|
|
88
|
+
const released =
|
|
89
|
+
status === "cancelled" || status === "completed"
|
|
90
|
+
? await releaseReservesForParent({ db, parentId: id, uid })
|
|
91
|
+
: [];
|
|
92
|
+
return { id, status, released };
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
await audit({ ctx, action: status === "cancelled" ? "cancel" : "changeStatus", appId: id, uid });
|
|
96
|
+
for (const released of result.released) {
|
|
97
|
+
await audit({ ctx, action: "releaseReserve", appId: released, uid });
|
|
98
|
+
}
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
@@ -128,9 +128,9 @@ export async function createApplication(
|
|
|
128
128
|
`SELECT COALESCE(MAX(substring(number FROM 5)::integer), 0) + 1 AS n
|
|
129
129
|
FROM surveyor.applications
|
|
130
130
|
WHERE number ~ $1`,
|
|
131
|
-
[`^${year}[0-9]{6}$`]
|
|
131
|
+
[`^${year}[0-9]{5,6}$`]
|
|
132
132
|
);
|
|
133
|
-
const number = `${year}${String(next.rows[0]!.n).padStart(
|
|
133
|
+
const number = `${year}${String(next.rows[0]!.n).padStart(5, "0")}`;
|
|
134
134
|
|
|
135
135
|
const inserted = await db.query<{ app_id: string }>(
|
|
136
136
|
`INSERT INTO surveyor.applications (
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import type { AppContext, User } from "@opengis/fcore";
|
|
2
|
-
import { actor } from "../utils/shared.js";
|
|
3
|
-
|
|
4
|
-
export type MapLayerComponent = "map" | "application-form" | "application-card";
|
|
5
|
-
|
|
6
|
-
export type MapLayersInput = { component?: MapLayerComponent };
|
|
7
|
-
|
|
8
|
-
export type MapLayer = {
|
|
9
|
-
code: string;
|
|
10
|
-
name: string;
|
|
11
|
-
layer_group: "base" | "overlay";
|
|
12
|
-
layer_type: "raster" | "vector" | "applications";
|
|
13
|
-
tiles: string[];
|
|
14
|
-
scheme: "xyz" | "tms";
|
|
15
|
-
source_layer: string | null;
|
|
16
|
-
attribution: string | null;
|
|
17
|
-
minzoom: number | null;
|
|
18
|
-
maxzoom: number | null;
|
|
19
|
-
opacity: number;
|
|
20
|
-
style: Record<string, unknown> | null;
|
|
21
|
-
legend: Record<string, unknown> | null;
|
|
22
|
-
preview: string | null;
|
|
23
|
-
components: MapLayerComponent[];
|
|
24
|
-
is_default: boolean;
|
|
25
|
-
has_filters: boolean;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type MapLayersResult = {
|
|
29
|
-
default_base: string | null;
|
|
30
|
-
base: MapLayer[];
|
|
31
|
-
overlays: MapLayer[];
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Повертає увімкнені шари панелі карти, згруповані на базові та додаткові у порядку відображення.
|
|
36
|
-
* Додаткові шари йдуть від верхнього до нижнього: перший у списку малюється поверх.
|
|
37
|
-
* Якщо передано `component`, повертаються лише шари, налаштовані для цього компонента.
|
|
38
|
-
*/
|
|
39
|
-
export async function mapLayers(
|
|
40
|
-
{ input, user, ctx }: { input: MapLayersInput; user: User | undefined; ctx: AppContext }
|
|
41
|
-
): Promise<MapLayersResult> {
|
|
42
|
-
actor(user);
|
|
43
|
-
|
|
44
|
-
const { rows }: { rows: MapLayer[] } = await ctx.pg.query(
|
|
45
|
-
`SELECT code, name, layer_group, layer_type, tiles, scheme, source_layer, attribution,
|
|
46
|
-
minzoom, maxzoom, opacity::float AS opacity, style, legend, preview, components,
|
|
47
|
-
is_default, has_filters
|
|
48
|
-
FROM surveyor.map_layers
|
|
49
|
-
WHERE enabled
|
|
50
|
-
AND ($1::text IS NULL OR components @> ARRAY[$1::text])
|
|
51
|
-
ORDER BY layer_group, sort_order, name`,
|
|
52
|
-
[input.component ?? null]
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
const base = rows.filter((layer) => layer.layer_group === "base");
|
|
56
|
-
const overlays = rows.filter((layer) => layer.layer_group === "overlay");
|
|
57
|
-
// Підложку вимкнути не можна, тому без явного значення активна перша.
|
|
58
|
-
const defaultBase = base.find((layer) => layer.is_default) ?? base[0];
|
|
59
|
-
|
|
60
|
-
return { default_base: defaultBase?.code ?? null, base, overlays };
|
|
61
|
-
}
|
|
1
|
+
import type { AppContext, User } from "@opengis/fcore";
|
|
2
|
+
import { actor } from "../utils/shared.js";
|
|
3
|
+
|
|
4
|
+
export type MapLayerComponent = "map" | "application-form" | "application-card";
|
|
5
|
+
|
|
6
|
+
export type MapLayersInput = { component?: MapLayerComponent };
|
|
7
|
+
|
|
8
|
+
export type MapLayer = {
|
|
9
|
+
code: string;
|
|
10
|
+
name: string;
|
|
11
|
+
layer_group: "base" | "overlay";
|
|
12
|
+
layer_type: "raster" | "vector" | "applications";
|
|
13
|
+
tiles: string[];
|
|
14
|
+
scheme: "xyz" | "tms";
|
|
15
|
+
source_layer: string | null;
|
|
16
|
+
attribution: string | null;
|
|
17
|
+
minzoom: number | null;
|
|
18
|
+
maxzoom: number | null;
|
|
19
|
+
opacity: number;
|
|
20
|
+
style: Record<string, unknown> | null;
|
|
21
|
+
legend: Record<string, unknown> | null;
|
|
22
|
+
preview: string | null;
|
|
23
|
+
components: MapLayerComponent[];
|
|
24
|
+
is_default: boolean;
|
|
25
|
+
has_filters: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type MapLayersResult = {
|
|
29
|
+
default_base: string | null;
|
|
30
|
+
base: MapLayer[];
|
|
31
|
+
overlays: MapLayer[];
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Повертає увімкнені шари панелі карти, згруповані на базові та додаткові у порядку відображення.
|
|
36
|
+
* Додаткові шари йдуть від верхнього до нижнього: перший у списку малюється поверх.
|
|
37
|
+
* Якщо передано `component`, повертаються лише шари, налаштовані для цього компонента.
|
|
38
|
+
*/
|
|
39
|
+
export async function mapLayers(
|
|
40
|
+
{ input, user, ctx }: { input: MapLayersInput; user: User | undefined; ctx: AppContext }
|
|
41
|
+
): Promise<MapLayersResult> {
|
|
42
|
+
actor(user);
|
|
43
|
+
|
|
44
|
+
const { rows }: { rows: MapLayer[] } = await ctx.pg.query(
|
|
45
|
+
`SELECT code, name, layer_group, layer_type, tiles, scheme, source_layer, attribution,
|
|
46
|
+
minzoom, maxzoom, opacity::float AS opacity, style, legend, preview, components,
|
|
47
|
+
is_default, has_filters
|
|
48
|
+
FROM surveyor.map_layers
|
|
49
|
+
WHERE enabled
|
|
50
|
+
AND ($1::text IS NULL OR components @> ARRAY[$1::text])
|
|
51
|
+
ORDER BY layer_group, sort_order, name`,
|
|
52
|
+
[input.component ?? null]
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
const base = rows.filter((layer) => layer.layer_group === "base");
|
|
56
|
+
const overlays = rows.filter((layer) => layer.layer_group === "overlay");
|
|
57
|
+
// Підложку вимкнути не можна, тому без явного значення активна перша.
|
|
58
|
+
const defaultBase = base.find((layer) => layer.is_default) ?? base[0];
|
|
59
|
+
|
|
60
|
+
return { default_base: defaultBase?.code ?? null, base, overlays };
|
|
61
|
+
}
|
|
@@ -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><br>
|
|
66
|
-
Пароль: <strong>{{password}}</strong>
|
|
67
|
-
</p>
|
|
68
|
-
<p>
|
|
69
|
-
Ви можете увійти на сайт, натиснувши на цьому посиланні або скопіювавши його в адресний рядок вашого
|
|
70
|
-
браузера:<br>
|
|
71
|
-
<a target="_blank" href="{{protocol}}://{{host}}">{{protocol}}://{{host}}</a>
|
|
72
|
-
</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><br>
|
|
66
|
+
Пароль: <strong>{{password}}</strong>
|
|
67
|
+
</p>
|
|
68
|
+
<p>
|
|
69
|
+
Ви можете увійти на сайт, натиснувши на цьому посиланні або скопіювавши його в адресний рядок вашого
|
|
70
|
+
браузера:<br>
|
|
71
|
+
<a target="_blank" href="{{protocol}}://{{host}}">{{protocol}}://{{host}}</a>
|
|
72
|
+
</p>
|
|
73
|
+
<div class="footer">
|
|
74
|
+
Це автоматично створений лист, будь ласка, не відповідайте на нього.
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</body>
|
|
78
|
+
|
|
79
|
+
</html>
|
|
@@ -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>
|