@opengis/surveyor 0.0.0-stage → 0.0.2
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/CHANGELOG.md +42 -0
- package/README.md +188 -3
- package/dist/chunks/AppIcon-CIR6y5uE.js +85 -0
- package/dist/chunks/AppealDetailField-CI-1qhs3.js +58 -0
- package/dist/chunks/AppealStatusBadge-CSXnfarR.js +132 -0
- package/dist/chunks/AppealStatusBadge-DYBe9hqP.js +171 -0
- package/dist/chunks/ApplicationHistorySection-C0wwhwA4.js +769 -0
- package/dist/chunks/BaseModal-C7PVYz0m.js +85 -0
- package/dist/chunks/FormFilePicker-C3XQw50i.js +76 -0
- package/dist/chunks/MapLayerMenu-DjYCxEc3.js +145 -0
- package/dist/chunks/RegistryForm-CEUqFmsF.js +99 -0
- package/dist/chunks/RegistryFormModal-DfY4z_7r.js +85 -0
- package/dist/chunks/RegistryToolbar-BV4mYVAc.js +452 -0
- package/dist/chunks/UserAccessBadge-D8JfgGfN.js +44 -0
- package/dist/chunks/UserTypeBadge-YIwwoCho.js +188 -0
- package/dist/chunks/VerifiedBadge-Bba8WnuB.js +34 -0
- package/dist/chunks/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
- package/dist/chunks/account-types-Br7gx_D_.js +35 -0
- package/dist/chunks/account_types-DLL1w122.js +25 -0
- package/dist/chunks/appealMapLayers-CQMK3rrz.js +115 -0
- package/dist/chunks/application_status-BhNGiY2I.js +45 -0
- package/dist/chunks/applications-BB9JRcgl.js +132 -0
- package/dist/chunks/buildSchema-CccjX9TJ.js +37 -0
- package/dist/chunks/card-B-ftozcq.js +739 -0
- package/dist/chunks/card-BctFHFZe.js +538 -0
- package/dist/chunks/card-CKD1N0QD.js +330 -0
- package/dist/chunks/card-CiNZxAd5.js +297 -0
- package/dist/chunks/card-DUtDfwMk.js +607 -0
- package/dist/chunks/card-fL26_Gvc.js +1189 -0
- package/dist/chunks/certificates-BSd1i0un.js +424 -0
- package/dist/chunks/create-DxMC_IL1.js +1033 -0
- package/dist/chunks/filterQuery-CvfZrkTC.js +99 -0
- package/dist/chunks/form-Bh6i5n1U.js +315 -0
- package/dist/chunks/form-DDjELqZ9.js +89 -0
- package/dist/chunks/geometry-DyhIVRcw.js +67 -0
- package/dist/chunks/map-Z57iMvFb.js +2763 -0
- package/dist/chunks/map-layers-DnmkOEld.js +400 -0
- package/dist/chunks/mapLayersApi-CWoQ2be-.js +251 -0
- package/dist/chunks/organizations-BO1_JETm.js +476 -0
- package/dist/chunks/organizations-BbYipLwk.js +14 -0
- package/dist/chunks/profile-ByahbF4B.js +164 -0
- package/dist/chunks/profile-Dwwn_4Pr.js +243 -0
- package/dist/chunks/requests-BCin936Z.js +232 -0
- package/dist/chunks/requests-CFv5wwAN.js +530 -0
- package/dist/chunks/resendSurveyorRegistration-BHTTVIw1.js +27 -0
- package/dist/chunks/resources-2e8RFqWR.js +129 -0
- package/dist/chunks/rolldown-runtime-Dy4uBu1J.js +11 -0
- package/dist/chunks/surveyorAccount-C7UiiIYg.js +78 -0
- package/dist/chunks/users-DtTYsgMb.js +291 -0
- package/dist/chunks/work_types-Hwme-FEX.js +34 -0
- package/dist/index.css +3 -0
- package/dist/index.js +336 -0
- package/migrations/20260924120000_surveyor_schema.sql +450 -0
- package/migrations/20261008170000_address_lookup.sql +20 -0
- package/migrations/20261016120000_map_layers.sql +156 -0
- package/migrations/20261016150000_password_reset.sql +15 -0
- package/migrations/20261016170000_address_lookup_format.sql +37 -0
- package/migrations/20261016180000_settlement_lookup.sql +16 -0
- package/migrations/20261019170000_actor_lookup.sql +15 -0
- package/package.json +86 -6
- package/plugin.d.ts +15 -0
- package/plugin.js +8 -0
- package/server/app.ts +51 -0
- package/server/dictionaries/index.ts +17 -0
- package/server/dictionaries/surveyor/account_types.ts +12 -0
- package/server/dictionaries/surveyor/application_status.ts +16 -0
- package/server/dictionaries/surveyor/map_layer_components.ts +11 -0
- package/server/dictionaries/surveyor/map_layer_groups.ts +10 -0
- package/server/dictionaries/surveyor/map_layer_types.ts +11 -0
- package/server/dictionaries/surveyor/work_types.ts +15 -0
- package/server/dictionaries/surveyor/yes_no.ts +11 -0
- package/server/fastify.d.ts +12 -0
- package/server/index.ts +23 -0
- package/server/modules/surveyor/route.ts +410 -0
- package/server/modules/surveyor/schema.ts +439 -0
- package/server/modules/surveyor/services/applicationTile.ts +53 -0
- package/server/modules/surveyor/services/cancelApplication.ts +74 -0
- package/server/modules/surveyor/services/changeSurveyorPassword.ts +52 -0
- package/server/modules/surveyor/services/changeSurveyorPasswordByAdmin.ts +41 -0
- package/server/modules/surveyor/services/completeApplication.ts +46 -0
- package/server/modules/surveyor/services/completeSurveyorRegistration.ts +48 -0
- package/server/modules/surveyor/services/createApplication.ts +169 -0
- package/server/modules/surveyor/services/geometryExport.ts +34 -0
- package/server/modules/surveyor/services/geometryImport.ts +66 -0
- package/server/modules/surveyor/services/getSurveyorUser.ts +56 -0
- package/server/modules/surveyor/services/identifyApplications.ts +82 -0
- package/server/modules/surveyor/services/issueSourceData.ts +55 -0
- package/server/modules/surveyor/services/loginSurveyor.ts +67 -0
- package/server/modules/surveyor/services/mapLayers.ts +61 -0
- package/server/modules/surveyor/services/rasterExport.ts +15 -0
- package/server/modules/surveyor/services/registerSurveyor.ts +161 -0
- package/server/modules/surveyor/services/requestPasswordReset.ts +49 -0
- package/server/modules/surveyor/services/resendRegistration.ts +42 -0
- package/server/modules/surveyor/services/resetSurveyorPassword.ts +53 -0
- package/server/modules/surveyor/services/searchApplications.ts +63 -0
- package/server/modules/surveyor/services/submitSurvey.ts +70 -0
- package/server/modules/surveyor/services/updateSurveyorAccountStatus.ts +52 -0
- package/server/modules/surveyor/services/updateSurveyorStatus.ts +53 -0
- package/server/modules/surveyor/services/vectorExport.ts +86 -0
- package/server/modules/surveyor/services/verifyApplication.ts +59 -0
- package/server/modules/surveyor/utils/accessibleApplication.ts +37 -0
- package/server/modules/surveyor/utils/application.ts +68 -0
- package/server/modules/surveyor/utils/export.ts +39 -0
- package/server/modules/surveyor/utils/firstBoundary.ts +48 -0
- package/server/modules/surveyor/utils/mail.ts +161 -0
- package/server/modules/surveyor/utils/permissions.ts +29 -0
- package/server/modules/surveyor/utils/registration.ts +33 -0
- package/server/modules/surveyor/utils/shared.ts +305 -0
- package/server/modules/surveyor/utils/templates/ds.surveyor_admin_password.pt.hbs +79 -0
- package/server/modules/surveyor/utils/templates/ds.surveyor_password_reset.pt.hbs +79 -0
- package/server/modules/surveyor/utils/templates/ds.surveyor_registration.pt.hbs +80 -0
- package/server/modules/surveyor/utils/templates/ds.surveyor_send_mail.pt.hbs +79 -0
- package/server/modules/surveyor/utils/vectorLayer.ts +41 -0
- package/server/plugins/convertVector.ts +74 -0
- package/server/plugins/proto/convertVector.proto +21 -0
- package/server/plugins/swagger.ts +54 -0
- package/server/plugins/vite.dev.ts +52 -0
- package/server/plugins/vite.prod.ts +55 -0
- package/server/resources/helpers/actor_lookup.ts +5 -0
- package/server/resources/helpers/address_lookup.ts +8 -0
- package/server/resources/helpers/settlement_lookup.ts +7 -0
- package/server/resources/helpers/user_lookup.ts +5 -0
- package/server/resources/index.ts +30 -0
- package/server/resources/surveyor-admin/application_comments.ts +24 -0
- package/server/resources/surveyor-admin/application_status_history.ts +46 -0
- package/server/resources/surveyor-admin/applications.ts +125 -0
- package/server/resources/surveyor-admin/certificates.ts +87 -0
- package/server/resources/surveyor-admin/map_layers.ts +69 -0
- package/server/resources/surveyor-admin/organization_surveyors.ts +32 -0
- package/server/resources/surveyor-admin/organizations.ts +61 -0
- package/server/resources/surveyor-admin/surveyors.ts +71 -0
- package/server/resources/surveyor-user/application_status_history.ts +52 -0
- package/server/resources/surveyor-user/applications.ts +131 -0
- package/server/resources/surveyor-user/certificates.ts +67 -0
- package/server/resources/surveyor-user/organizations.ts +40 -0
- package/server/resources/surveyor-user/surveyors.ts +69 -0
- package/server/suggests/index.ts +17 -0
- package/server/tsconfig.json +3 -0
- package/surveyor-types.d.ts +30 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ResourceContract } from "@opengis/fcore";
|
|
2
|
+
import mapLayerComponents from "../../dictionaries/surveyor/map_layer_components.js";
|
|
3
|
+
import mapLayerGroups from "../../dictionaries/surveyor/map_layer_groups.js";
|
|
4
|
+
import mapLayerTypes from "../../dictionaries/surveyor/map_layer_types.js";
|
|
5
|
+
import { userLookup } from "../helpers/user_lookup.js";
|
|
6
|
+
|
|
7
|
+
// Panel order is sort_order inside each group; the cabinet reads the list via /api/surveyor/map/layers.
|
|
8
|
+
export default {
|
|
9
|
+
version: 1,
|
|
10
|
+
name: "map_layers",
|
|
11
|
+
module: "surveyor",
|
|
12
|
+
title: "Шари карти",
|
|
13
|
+
table: "surveyor.map_layers",
|
|
14
|
+
key: "layer_id",
|
|
15
|
+
display: ["name"],
|
|
16
|
+
displayFields: ["code", "layer_group", "layer_type"],
|
|
17
|
+
access: "admin",
|
|
18
|
+
operations: ["read", "create", "update", "delete"],
|
|
19
|
+
searchable: ["name", "code"],
|
|
20
|
+
fields: {
|
|
21
|
+
layer_id: { type: "text", write: false, filterable: true },
|
|
22
|
+
code: { type: "string", write: true, required: true, searchable: true, sortable: true, pattern: "^[a-z0-9_-]+$" },
|
|
23
|
+
name: { type: "string", write: true, required: true, searchable: true, sortable: true },
|
|
24
|
+
layer_group: {
|
|
25
|
+
type: "string",
|
|
26
|
+
write: true,
|
|
27
|
+
required: true,
|
|
28
|
+
filterable: true,
|
|
29
|
+
sortable: true,
|
|
30
|
+
dictionary: mapLayerGroups.code,
|
|
31
|
+
enum: mapLayerGroups.items.map(({ code }) => code),
|
|
32
|
+
},
|
|
33
|
+
layer_type: {
|
|
34
|
+
type: "string",
|
|
35
|
+
write: true,
|
|
36
|
+
required: true,
|
|
37
|
+
filterable: true,
|
|
38
|
+
dictionary: mapLayerTypes.code,
|
|
39
|
+
enum: mapLayerTypes.items.map(({ code }) => code),
|
|
40
|
+
},
|
|
41
|
+
tiles: { type: "string", array: true, write: true },
|
|
42
|
+
scheme: { type: "string", write: true, enum: ["xyz", "tms"] },
|
|
43
|
+
source_layer: { type: "string", write: true },
|
|
44
|
+
attribution: { type: "string", write: true },
|
|
45
|
+
minzoom: { type: "integer", write: true, minimum: 0, maximum: 24 },
|
|
46
|
+
maxzoom: { type: "integer", write: true, minimum: 0, maximum: 24 },
|
|
47
|
+
opacity: { type: "number", write: true, minimum: 0, maximum: 1 },
|
|
48
|
+
style: { type: "json", write: true },
|
|
49
|
+
legend: { type: "json", write: true },
|
|
50
|
+
preview: { type: "string", write: true },
|
|
51
|
+
// No `enum`: FCore checks it against the whole value, so arrays never pass.
|
|
52
|
+
// Allowed values are enforced by map_layers_components_check.
|
|
53
|
+
components: {
|
|
54
|
+
type: "string",
|
|
55
|
+
array: true,
|
|
56
|
+
write: true,
|
|
57
|
+
filterable: true,
|
|
58
|
+
dictionary: mapLayerComponents.code,
|
|
59
|
+
},
|
|
60
|
+
sort_order: { type: "integer", write: true, sortable: true },
|
|
61
|
+
is_default: { type: "boolean", write: true, filterable: true, dictionary: "yes-no" },
|
|
62
|
+
has_filters: { type: "boolean", write: true, filterable: true, dictionary: "yes-no" },
|
|
63
|
+
enabled: { type: "boolean", write: true, filterable: true, dictionary: "yes-no" },
|
|
64
|
+
created_by: { type: "string", write: false, lookup: userLookup },
|
|
65
|
+
created_at: { type: "timestamp", write: false, sortable: true },
|
|
66
|
+
updated_by: { type: "string", write: false, lookup: userLookup },
|
|
67
|
+
updated_at: { type: "timestamp", write: false, sortable: true },
|
|
68
|
+
},
|
|
69
|
+
} satisfies ResourceContract;
|
|
@@ -0,0 +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
|
+
|
|
32
|
+
} satisfies ResourceContract;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { ResourceContract } from "@opengis/fcore";
|
|
2
|
+
import { userLookup } from "../helpers/user_lookup.js";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
version: 1,
|
|
6
|
+
name: "organizations",
|
|
7
|
+
module: "surveyor",
|
|
8
|
+
title: "Організації",
|
|
9
|
+
table: "surveyor.organizations",
|
|
10
|
+
key: "org_id",
|
|
11
|
+
display: ["name"],
|
|
12
|
+
access: "admin",
|
|
13
|
+
operations: ["read", "create", "update", "delete"],
|
|
14
|
+
searchable: ["name", "email", "phone"],
|
|
15
|
+
capabilities: ["notes", "files"],
|
|
16
|
+
fields: {
|
|
17
|
+
org_id: {
|
|
18
|
+
type: "text",
|
|
19
|
+
write: false,
|
|
20
|
+
filterable: true,
|
|
21
|
+
lookup: {
|
|
22
|
+
table: "surveyor.organizations",
|
|
23
|
+
value: "org_id",
|
|
24
|
+
text: "name",
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
name: { type: "string", write: true, required: true, searchable: true, sortable: true },
|
|
28
|
+
legal_address: { type: "text", write: true },
|
|
29
|
+
phone: { type: "string", write: true, required: true, searchable: true },
|
|
30
|
+
email: { type: "string", write: true, required: true, searchable: true },
|
|
31
|
+
scan_path: { type: "file", write: true },
|
|
32
|
+
created_by: { type: "string", write: false, lookup: userLookup },
|
|
33
|
+
updated_by: { type: "string", write: false, lookup: userLookup },
|
|
34
|
+
created_at: { type: "timestamp", write: false, filterable: true, sortable: true },
|
|
35
|
+
updated_at: { type: "timestamp", write: false, sortable: true },
|
|
36
|
+
verified: { type: "boolean", write: true, filterable: true, dictionary: "yes-no" },
|
|
37
|
+
},
|
|
38
|
+
relations: {
|
|
39
|
+
surveyors: {
|
|
40
|
+
resource: "organization_surveyors",
|
|
41
|
+
localKey: "org_id",
|
|
42
|
+
// `enabled` is the surveyor account flag; the membership flag is exposed separately.
|
|
43
|
+
fields: [
|
|
44
|
+
't."org_id"',
|
|
45
|
+
't."surveyor_id"',
|
|
46
|
+
's."first_name"',
|
|
47
|
+
's."last_name"',
|
|
48
|
+
's."middle_name"',
|
|
49
|
+
's."email"',
|
|
50
|
+
's."phone"',
|
|
51
|
+
's."registered_at"',
|
|
52
|
+
's."certificate_id"',
|
|
53
|
+
's."surveyor_enabled" AS "enabled"',
|
|
54
|
+
't."enabled" AS "membership_enabled"',
|
|
55
|
+
't."created_by"',
|
|
56
|
+
't."created_at"',
|
|
57
|
+
],
|
|
58
|
+
},
|
|
59
|
+
applications: { resource: "applications", localKey: "org_id", foreignKey: "org_id" },
|
|
60
|
+
},
|
|
61
|
+
} satisfies ResourceContract;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { ResourceContract } from "@opengis/fcore";
|
|
2
|
+
import accountTypes from "../../dictionaries/surveyor/account_types.js";
|
|
3
|
+
import { userLookup } from "../helpers/user_lookup.js";
|
|
4
|
+
|
|
5
|
+
// Registration and password changes are Business API operations.
|
|
6
|
+
export default {
|
|
7
|
+
version: 1,
|
|
8
|
+
name: "surveyors",
|
|
9
|
+
module: "surveyor",
|
|
10
|
+
title: "Геодезисти",
|
|
11
|
+
table: "surveyor.surveyors",
|
|
12
|
+
key: "surveyor_id",
|
|
13
|
+
access: "admin",
|
|
14
|
+
operations: ["read", "update"],
|
|
15
|
+
searchable: ["first_name", "last_name", "email", "phone"],
|
|
16
|
+
fields: {
|
|
17
|
+
surveyor_id: { type: "text", write: false, filterable: true },
|
|
18
|
+
certificate_id: {
|
|
19
|
+
type: "text",
|
|
20
|
+
write: true,
|
|
21
|
+
required: true,
|
|
22
|
+
filterable: true,
|
|
23
|
+
lookup: {
|
|
24
|
+
table: "surveyor.certificates",
|
|
25
|
+
value: "certificate_id",
|
|
26
|
+
text: "number_certificate",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
certificate_type: { type: "string", write: false, dictionary: accountTypes.code },
|
|
30
|
+
first_name: { type: "string", write: true, required: true, searchable: true },
|
|
31
|
+
last_name: { type: "string", write: true, required: true, searchable: true },
|
|
32
|
+
middle_name: { type: "string", write: true },
|
|
33
|
+
email: { type: "string", write: true, required: true, searchable: true },
|
|
34
|
+
phone: { type: "string", write: true, searchable: true },
|
|
35
|
+
password_hash: { type: "string", read: false, write: false },
|
|
36
|
+
registration_token_hash: { type: "string", read: false, write: false },
|
|
37
|
+
registered_at: { type: "timestamp", write: false },
|
|
38
|
+
password_changed_at: { type: "timestamp", write: false },
|
|
39
|
+
last_login_at: { type: "timestamp", write: false },
|
|
40
|
+
enabled: { type: "boolean", write: true, filterable: true, dictionary: "yes-no" },
|
|
41
|
+
org_ids: { type: "text", read: true, filterable: true, array: true, lookup: { table: "surveyor.organizations", value: "org_id", text: "name" } },
|
|
42
|
+
created_by: { type: "string", write: false, lookup: userLookup },
|
|
43
|
+
updated_by: { type: "string", write: false, lookup: userLookup },
|
|
44
|
+
created_at: { type: "timestamp", write: false, sortable: true },
|
|
45
|
+
updated_at: { type: "timestamp", write: false, sortable: true },
|
|
46
|
+
uid: { type: "string", write: false, filterable: true, lookup: userLookup },
|
|
47
|
+
},
|
|
48
|
+
joins: [{
|
|
49
|
+
sql: `LEFT JOIN LATERAL (select array_agg(org_id) as org_ids from surveyor.organization_surveyors s where s.surveyor_id = t.surveyor_id) as s on true`
|
|
50
|
+
}, {
|
|
51
|
+
sql: `LEFT JOIN LATERAL (select certificate_type from surveyor.certificates c where c.certificate_id = t.certificate_id) as c on true`
|
|
52
|
+
}],
|
|
53
|
+
relations: {
|
|
54
|
+
certificate: { resource: "certificates", localKey: "certificate_id" },
|
|
55
|
+
organizations: {
|
|
56
|
+
resource: "organizations",
|
|
57
|
+
junctionTable: "surveyor.organization_surveyors",
|
|
58
|
+
junctionLocalKey: "surveyor_id",
|
|
59
|
+
junctionForeignKey: "org_id",
|
|
60
|
+
fields: [
|
|
61
|
+
't."org_id"',
|
|
62
|
+
't."name"',
|
|
63
|
+
't."legal_address"',
|
|
64
|
+
't."phone"',
|
|
65
|
+
't."email"',
|
|
66
|
+
'j."enabled" AS "membership_enabled"',
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
applications: { resource: "applications", localKey: "surveyor_id", foreignKey: "surveyor_id" },
|
|
70
|
+
},
|
|
71
|
+
} satisfies ResourceContract;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ResourceContract } from "@opengis/fcore";
|
|
2
|
+
import applicationStatus from "../../dictionaries/surveyor/application_status.js";
|
|
3
|
+
import { actorLookup } from "../helpers/actor_lookup.js";
|
|
4
|
+
|
|
5
|
+
const applicationStatusCodes = applicationStatus.items.map(({ code }) => code);
|
|
6
|
+
|
|
7
|
+
// Business services write history in the same transaction as a status change.
|
|
8
|
+
export default {
|
|
9
|
+
version: 1,
|
|
10
|
+
name: "public_application_status_history",
|
|
11
|
+
module: "surveyor",
|
|
12
|
+
title: "Історія статусів заявок",
|
|
13
|
+
table: "surveyor.application_status_history",
|
|
14
|
+
key: "history_id",
|
|
15
|
+
access: "user",
|
|
16
|
+
operations: ["read"],
|
|
17
|
+
where: `EXISTS (
|
|
18
|
+
SELECT 1
|
|
19
|
+
FROM surveyor.applications AS application
|
|
20
|
+
WHERE application.app_id = t.application_id
|
|
21
|
+
AND application.surveyor_id = :uid
|
|
22
|
+
)`,
|
|
23
|
+
fields: {
|
|
24
|
+
history_id: { type: "text", write: false },
|
|
25
|
+
application_id: {
|
|
26
|
+
type: "text",
|
|
27
|
+
write: false,
|
|
28
|
+
filterable: true,
|
|
29
|
+
lookup: { table: "surveyor.applications", value: "app_id", text: "number" },
|
|
30
|
+
},
|
|
31
|
+
status_from: {
|
|
32
|
+
type: "string",
|
|
33
|
+
write: false,
|
|
34
|
+
nullable: true,
|
|
35
|
+
dictionary: applicationStatus.code,
|
|
36
|
+
enum: applicationStatusCodes,
|
|
37
|
+
},
|
|
38
|
+
status_to: {
|
|
39
|
+
type: "string",
|
|
40
|
+
write: false,
|
|
41
|
+
dictionary: applicationStatus.code,
|
|
42
|
+
enum: applicationStatusCodes,
|
|
43
|
+
},
|
|
44
|
+
reason: { type: "text", write: false },
|
|
45
|
+
file: { type: "file", write: false },
|
|
46
|
+
changed_by: { type: "string", write: false, lookup: actorLookup },
|
|
47
|
+
created_at: { type: "timestamp", write: false, sortable: true },
|
|
48
|
+
},
|
|
49
|
+
relations: {
|
|
50
|
+
application: { resource: "public_applications", localKey: "application_id" },
|
|
51
|
+
},
|
|
52
|
+
} satisfies ResourceContract;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import type { ResourceContract } from "@opengis/fcore";
|
|
2
|
+
import applicationStatus from "../../dictionaries/surveyor/application_status.js";
|
|
3
|
+
import workTypes from "../../dictionaries/surveyor/work_types.js";
|
|
4
|
+
import { addressLookup } from "../helpers/address_lookup.js";
|
|
5
|
+
import { actorLookup } from "../helpers/actor_lookup.js";
|
|
6
|
+
import { settlementLookup } from "../helpers/settlement_lookup.js";
|
|
7
|
+
import { userLookup } from "../helpers/user_lookup.js";
|
|
8
|
+
|
|
9
|
+
const applicationStatusCodes = applicationStatus.items.map(({ code }) => code);
|
|
10
|
+
const workTypeCodes = workTypes.items.map(({ code }) => code);
|
|
11
|
+
|
|
12
|
+
// Status changes, area checks, and file workflow belong to Business API services.
|
|
13
|
+
export default {
|
|
14
|
+
version: 1,
|
|
15
|
+
name: "public_applications",
|
|
16
|
+
module: "surveyor",
|
|
17
|
+
title: "Заявки на геодезичні роботи",
|
|
18
|
+
table: "surveyor.applications",
|
|
19
|
+
key: "app_id",
|
|
20
|
+
access: "user",
|
|
21
|
+
operations: ["read", "create"],
|
|
22
|
+
where: `EXISTS (
|
|
23
|
+
SELECT 1
|
|
24
|
+
FROM surveyor.organization_surveyors AS membership
|
|
25
|
+
WHERE membership.org_id = t.org_id
|
|
26
|
+
AND membership.surveyor_id = :uid
|
|
27
|
+
AND membership.enabled = true
|
|
28
|
+
)`,
|
|
29
|
+
searchable: ["number", "location", "description"],
|
|
30
|
+
capabilities: ["notes", "files"],
|
|
31
|
+
summary: {
|
|
32
|
+
awaitingData: { aggregate: "count", where: "t.status = 'awaitingData'" },
|
|
33
|
+
dataIssued: { aggregate: "count", where: "t.status = 'dataIssued'" },
|
|
34
|
+
reserve: { aggregate: "count", where: "t.status = 'reserve'" },
|
|
35
|
+
underReview: { aggregate: "count", where: "t.status = 'underReview'" },
|
|
36
|
+
verified: { aggregate: "count", where: "t.status = 'verified'" },
|
|
37
|
+
completed: { aggregate: "count", where: "t.status = 'completed'" },
|
|
38
|
+
cancelled: { aggregate: "count", where: "t.status = 'cancelled'" },
|
|
39
|
+
},
|
|
40
|
+
fields: {
|
|
41
|
+
app_id: { type: "text", write: false, filterable: true, sortable: true },
|
|
42
|
+
number: { type: "string", write: false, searchable: true, sortable: true },
|
|
43
|
+
org_id: {
|
|
44
|
+
type: "text",
|
|
45
|
+
write: false,
|
|
46
|
+
filterable: true,
|
|
47
|
+
lookup: { table: "surveyor.organizations", value: "org_id", text: "name" },
|
|
48
|
+
},
|
|
49
|
+
surveyor_id: {
|
|
50
|
+
type: "text",
|
|
51
|
+
write: false,
|
|
52
|
+
filterable: true,
|
|
53
|
+
lookup: { table: "surveyor.surveyors", value: "surveyor_id", text: "email" },
|
|
54
|
+
},
|
|
55
|
+
status: {
|
|
56
|
+
type: "string",
|
|
57
|
+
write: false,
|
|
58
|
+
filterable: true,
|
|
59
|
+
dictionary: applicationStatus.code,
|
|
60
|
+
enum: applicationStatusCodes,
|
|
61
|
+
},
|
|
62
|
+
work_type: {
|
|
63
|
+
type: "string",
|
|
64
|
+
write: false,
|
|
65
|
+
filterable: true,
|
|
66
|
+
dictionary: workTypes.code,
|
|
67
|
+
enum: workTypeCodes,
|
|
68
|
+
},
|
|
69
|
+
description: { type: "text", write: false, searchable: true },
|
|
70
|
+
execution_basis: { type: "text", write: false },
|
|
71
|
+
settlement_id: {
|
|
72
|
+
type: "string",
|
|
73
|
+
write: false,
|
|
74
|
+
filterable: true,
|
|
75
|
+
lookup: settlementLookup,
|
|
76
|
+
},
|
|
77
|
+
is_found_address_id: { type: "boolean", write: false, filterable: true, dictionary: "yes-no" },
|
|
78
|
+
address_id: { type: "string", write: false, filterable: true, lookup: addressLookup },
|
|
79
|
+
location: { type: "text", write: false, searchable: true },
|
|
80
|
+
area: { type: "number", write: false, sortable: true },
|
|
81
|
+
geom: { type: "geometry", write: false },
|
|
82
|
+
file_output: { type: "file", write: false },
|
|
83
|
+
file_geodetic_survey: { type: "file", write: false },
|
|
84
|
+
file_corrected_geodetic_survey: { type: "file", write: false },
|
|
85
|
+
note_4_file_corrected_geodetic_survey: { type: "text", write: false },
|
|
86
|
+
notes: { type: "text", write: false },
|
|
87
|
+
signature: { type: "text", write: false },
|
|
88
|
+
cancel_reason: { type: "text", write: false },
|
|
89
|
+
source_data_issued_at: { type: "timestamp", write: false, sortable: true },
|
|
90
|
+
survey_uploaded_at: { type: "timestamp", write: false, sortable: true },
|
|
91
|
+
verified_at: { type: "timestamp", write: false, sortable: true },
|
|
92
|
+
integrated_at: { type: "timestamp", write: false, sortable: true },
|
|
93
|
+
cancelled_at: { type: "timestamp", write: false, sortable: true },
|
|
94
|
+
verified_by: { type: "string", write: false, lookup: userLookup },
|
|
95
|
+
integrated_by: { type: "string", write: false, lookup: userLookup },
|
|
96
|
+
cancelled_by: { type: "string", write: false, lookup: userLookup },
|
|
97
|
+
created_by: { type: "string", write: false, lookup: actorLookup },
|
|
98
|
+
updated_by: { type: "string", write: false, lookup: actorLookup },
|
|
99
|
+
created_at: { type: "timestamp", write: false, sortable: true },
|
|
100
|
+
updated_at: { type: "timestamp", write: false, sortable: true },
|
|
101
|
+
},
|
|
102
|
+
relations: {
|
|
103
|
+
comments: {
|
|
104
|
+
type: "many",
|
|
105
|
+
resource: "application_comments",
|
|
106
|
+
localKey: "app_id",
|
|
107
|
+
foreignKey: "resource_id",
|
|
108
|
+
where: "t.resource IN ('applications', 'public_applications')",
|
|
109
|
+
},
|
|
110
|
+
organization: { resource: "public_organizations", localKey: "org_id" },
|
|
111
|
+
surveyor: {
|
|
112
|
+
resource: "public_surveyors",
|
|
113
|
+
localKey: "surveyor_id",
|
|
114
|
+
fields: [
|
|
115
|
+
't."surveyor_id"',
|
|
116
|
+
't."certificate_id"',
|
|
117
|
+
't."first_name"',
|
|
118
|
+
't."last_name"',
|
|
119
|
+
't."middle_name"',
|
|
120
|
+
't."email"',
|
|
121
|
+
't."phone"',
|
|
122
|
+
't."enabled"',
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
history: {
|
|
126
|
+
resource: "public_application_status_history",
|
|
127
|
+
localKey: "app_id",
|
|
128
|
+
foreignKey: "application_id",
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
} satisfies ResourceContract;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { ResourceContract } from "@opengis/fcore";
|
|
2
|
+
import accountTypes from "../../dictionaries/surveyor/account_types.js";
|
|
3
|
+
import { userLookup } from "../helpers/user_lookup.js";
|
|
4
|
+
|
|
5
|
+
const accountTypeCodes = accountTypes.items.map(({ code }) => code);
|
|
6
|
+
|
|
7
|
+
// Certificates are imported from the external registry, so Resource API only reads them.
|
|
8
|
+
export default {
|
|
9
|
+
version: 1,
|
|
10
|
+
name: "public_certificates",
|
|
11
|
+
module: "surveyor",
|
|
12
|
+
title: "Сертифікати",
|
|
13
|
+
table: "surveyor.certificates",
|
|
14
|
+
key: "certificate_id",
|
|
15
|
+
display: ["surveyor_name", "number_certificate"],
|
|
16
|
+
access: "user",
|
|
17
|
+
operations: ["read"],
|
|
18
|
+
where: `EXISTS (
|
|
19
|
+
SELECT 1
|
|
20
|
+
FROM surveyor.surveyors AS surveyor
|
|
21
|
+
WHERE surveyor.certificate_id = t.certificate_id
|
|
22
|
+
AND surveyor.surveyor_id = :uid
|
|
23
|
+
)`,
|
|
24
|
+
searchable: ["surveyor_name","last_name","first_name", "number_certificate"],
|
|
25
|
+
fields: {
|
|
26
|
+
certificate_id: { type: "text", write: false, filterable: true },
|
|
27
|
+
certificate_type: {
|
|
28
|
+
type: "string",
|
|
29
|
+
write: false,
|
|
30
|
+
filterable: true,
|
|
31
|
+
dictionary: accountTypes.code,
|
|
32
|
+
enum: accountTypeCodes,
|
|
33
|
+
},
|
|
34
|
+
surveyor_name: { type: "string", write: false, searchable: true },
|
|
35
|
+
last_name: { type: "string", write: false, searchable: true },
|
|
36
|
+
first_name: { type: "string", write: false, searchable: true },
|
|
37
|
+
middle_name: { type: "string", write: false },
|
|
38
|
+
surveyor_phone: { type: "string", write: false },
|
|
39
|
+
surveyor_email: { type: "string", write: false },
|
|
40
|
+
date_certificate: { type: "date", write: false, filterable: true, sortable: true },
|
|
41
|
+
number_certificate: { type: "string", write: false, searchable: true },
|
|
42
|
+
name_school: { type: "text", write: false },
|
|
43
|
+
date_protocol: { type: "date", write: false },
|
|
44
|
+
number_protocol: { type: "string", write: false },
|
|
45
|
+
certificate_increase: { type: "text", write: false },
|
|
46
|
+
certificate_stopping: { type: "text", write: false },
|
|
47
|
+
certificate_suspension: { type: "date", write: false },
|
|
48
|
+
certificate_renewal: { type: "text", write: false },
|
|
49
|
+
work_place: { type: "text", write: false },
|
|
50
|
+
economic_activity: { type: "text", write: false },
|
|
51
|
+
created_by: { type: "string", write: false, lookup: userLookup },
|
|
52
|
+
created_at: { type: "timestamp", write: false, sortable: true },
|
|
53
|
+
updated_by: { type: "string", write: false, lookup: userLookup },
|
|
54
|
+
updated_at: { type: "timestamp", write: false, sortable: true },
|
|
55
|
+
is_membership: { type: "boolean", write: false, filterable: true, dictionary: "yes-no" },
|
|
56
|
+
membership: { type: "text", write: false },
|
|
57
|
+
last_qualification_date: { type: "date", write: false },
|
|
58
|
+
isvalid: { type: "boolean", write: false, filterable: true },
|
|
59
|
+
qualification_level: { type: "string", write: false },
|
|
60
|
+
},
|
|
61
|
+
relations: {
|
|
62
|
+
surveyors: {
|
|
63
|
+
resource: "public_surveyors",
|
|
64
|
+
localKey: "certificate_id",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
} satisfies ResourceContract;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ResourceContract } from "@opengis/fcore";
|
|
2
|
+
import { userLookup } from "../helpers/user_lookup.js";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
version: 1,
|
|
6
|
+
name: "public_organizations",
|
|
7
|
+
module: "surveyor",
|
|
8
|
+
title: "Організації",
|
|
9
|
+
table: "surveyor.organizations",
|
|
10
|
+
key: "org_id",
|
|
11
|
+
access: "user",
|
|
12
|
+
operations: ["read"],
|
|
13
|
+
where: `EXISTS (
|
|
14
|
+
SELECT 1
|
|
15
|
+
FROM surveyor.organization_surveyors AS membership
|
|
16
|
+
WHERE membership.org_id = t.org_id
|
|
17
|
+
AND membership.surveyor_id = :uid
|
|
18
|
+
AND membership.enabled = true
|
|
19
|
+
)`,
|
|
20
|
+
searchable: ["name", "email", "phone"],
|
|
21
|
+
fields: {
|
|
22
|
+
org_id: { type: "text", write: false, filterable: true },
|
|
23
|
+
name: { type: "string", write: false, required: true, searchable: true, sortable: true },
|
|
24
|
+
legal_address: { type: "text", write: false },
|
|
25
|
+
phone: { type: "string", write: false, required: true, searchable: true },
|
|
26
|
+
email: { type: "string", write: false, required: true, searchable: true },
|
|
27
|
+
scan_path: { type: "file", write: false },
|
|
28
|
+
created_by: { type: "string", write: false, lookup: userLookup },
|
|
29
|
+
updated_by: { type: "string", write: false, lookup: userLookup },
|
|
30
|
+
created_at: { type: "timestamp", write: false, sortable: true },
|
|
31
|
+
updated_at: { type: "timestamp", write: false, sortable: true },
|
|
32
|
+
},
|
|
33
|
+
relations: {
|
|
34
|
+
organizations: {
|
|
35
|
+
resource: "organization_surveyors",
|
|
36
|
+
localKey: "org_id",
|
|
37
|
+
},
|
|
38
|
+
applications: { resource: "public_applications", localKey: "org_id", foreignKey: "org_id" },
|
|
39
|
+
},
|
|
40
|
+
} satisfies ResourceContract;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ResourceContract } from "@opengis/fcore";
|
|
2
|
+
import { userLookup } from "../helpers/user_lookup.js";
|
|
3
|
+
|
|
4
|
+
// Registration and password changes are Business API operations.
|
|
5
|
+
export default {
|
|
6
|
+
version: 1,
|
|
7
|
+
name: "public_surveyors",
|
|
8
|
+
module: "surveyor",
|
|
9
|
+
title: "Геодезисти",
|
|
10
|
+
table: "surveyor.surveyors",
|
|
11
|
+
key: "surveyor_id",
|
|
12
|
+
access: "public",
|
|
13
|
+
operations: ["read"],
|
|
14
|
+
where: "t.surveyor_id::text = :uid",
|
|
15
|
+
searchable: ["first_name", "last_name", "email", "phone"],
|
|
16
|
+
fields: {
|
|
17
|
+
surveyor_id: { type: "text", write: false, filterable: true },
|
|
18
|
+
certificate_id: {
|
|
19
|
+
type: "text",
|
|
20
|
+
write: false,
|
|
21
|
+
required: true,
|
|
22
|
+
filterable: true,
|
|
23
|
+
lookup: {
|
|
24
|
+
table: "surveyor.certificates",
|
|
25
|
+
value: "certificate_id",
|
|
26
|
+
text: "number_certificate",
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
first_name: { type: "string", write: false, required: true, searchable: true },
|
|
30
|
+
last_name: { type: "string", write: false, required: true, searchable: true },
|
|
31
|
+
middle_name: { type: "string", write: false },
|
|
32
|
+
email: { type: "string", write: false, required: true, searchable: true },
|
|
33
|
+
phone: { type: "string", write: false, searchable: true },
|
|
34
|
+
password_hash: { type: "string", read: false, write: false },
|
|
35
|
+
registration_token_hash: { type: "string", read: false, write: false },
|
|
36
|
+
registered_at: { type: "timestamp", write: false },
|
|
37
|
+
password_changed_at: { type: "timestamp", write: false },
|
|
38
|
+
last_login_at: { type: "timestamp", write: false },
|
|
39
|
+
enabled: { type: "boolean", write: false, filterable: true, dictionary: "yes-no" },
|
|
40
|
+
created_by: { type: "string", write: false, lookup: userLookup },
|
|
41
|
+
updated_by: { type: "string", write: false, lookup: userLookup },
|
|
42
|
+
created_at: { type: "timestamp", write: false, sortable: true },
|
|
43
|
+
updated_at: { type: "timestamp", write: false, sortable: true },
|
|
44
|
+
uid: { type: "string", write: false, filterable: true, lookup: userLookup },
|
|
45
|
+
},
|
|
46
|
+
relations: {
|
|
47
|
+
certificate: { resource: "public_certificates", localKey: "certificate_id" },
|
|
48
|
+
organizations: {
|
|
49
|
+
resource: "public_organizations",
|
|
50
|
+
junctionTable: "surveyor.organization_surveyors",
|
|
51
|
+
junctionLocalKey: "surveyor_id",
|
|
52
|
+
junctionForeignKey: "org_id",
|
|
53
|
+
fields: [
|
|
54
|
+
't."org_id"',
|
|
55
|
+
't."name"',
|
|
56
|
+
't."legal_address"',
|
|
57
|
+
't."phone"',
|
|
58
|
+
't."email"',
|
|
59
|
+
't."scan_path"',
|
|
60
|
+
'j."enabled" AS "membership_enabled"',
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
applications: {
|
|
64
|
+
resource: "public_applications",
|
|
65
|
+
localKey: "surveyor_id",
|
|
66
|
+
foreignKey: "surveyor_id",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
} satisfies ResourceContract;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SuggestContract } from "@opengis/fcore";
|
|
2
|
+
|
|
3
|
+
const suggests: SuggestContract[] = [
|
|
4
|
+
{
|
|
5
|
+
name: "gis-layers",
|
|
6
|
+
module: "admin",
|
|
7
|
+
key: "id",
|
|
8
|
+
query: `
|
|
9
|
+
SELECT style_id as id, style_name as text FROM gis.style
|
|
10
|
+
WHERE style_name ILIKE '%' || :search || '%'
|
|
11
|
+
union all
|
|
12
|
+
SELECT dataset_id as id, dataset_name as text FROM gis.dataset
|
|
13
|
+
WHERE dataset_name ILIKE '%' || :search || '%'
|
|
14
|
+
`,
|
|
15
|
+
}
|
|
16
|
+
];
|
|
17
|
+
export default suggests;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { DefineComponent, Plugin } from 'vue'
|
|
2
|
+
|
|
3
|
+
export declare const Map: DefineComponent
|
|
4
|
+
export declare const Requests: DefineComponent
|
|
5
|
+
export declare const Organisations: DefineComponent
|
|
6
|
+
export declare const Certificates: DefineComponent
|
|
7
|
+
export declare const Users: DefineComponent
|
|
8
|
+
export declare const MapLayers: DefineComponent
|
|
9
|
+
export declare const CabinetRequests: DefineComponent
|
|
10
|
+
export declare const CabinetProfile: DefineComponent
|
|
11
|
+
|
|
12
|
+
export interface SurveyorHostPaths {
|
|
13
|
+
map?: string
|
|
14
|
+
requests?: string
|
|
15
|
+
organizations?: string
|
|
16
|
+
certificates?: string
|
|
17
|
+
users?: string
|
|
18
|
+
mapLayers?: string
|
|
19
|
+
cabinetRequests?: string
|
|
20
|
+
cabinetProfile?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface SurveyorPluginOptions {
|
|
24
|
+
paths?: SurveyorHostPaths
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export declare const defaultSurveyorPaths: SurveyorHostPaths
|
|
28
|
+
export declare const SURVEYOR_PATHS_KEY: symbol
|
|
29
|
+
|
|
30
|
+
export declare function createSurveyorPlugin(options?: SurveyorPluginOptions): Plugin
|