@opengis/surveyor 0.0.20 → 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.
Files changed (55) hide show
  1. package/dist/chunks/{AppIcon-Di5F4Bu_.js → AppIcon-CCLzEE-_.js} +1 -1
  2. package/dist/chunks/{AppealDetailField-CWayoaII.js → AppealDetailField-BUkzf_fd.js} +2 -2
  3. package/dist/chunks/{AppealStatusBadge-DRWZst3M.js → AppealStatusBadge-ClFdtWGr.js} +9 -9
  4. package/dist/chunks/{AppealStatusBadge-z77wwkFD.js → AppealStatusBadge-CzzI6x8I.js} +2 -2
  5. package/dist/chunks/{ApplicationGeometryExportModal-CH9VrqxO.js → ApplicationGeometryExportModal-jLas6-rv.js} +7 -7
  6. package/dist/chunks/{BaseModal-X-hzV_I2.js → BaseModal-BvHbtINw.js} +2 -2
  7. package/dist/chunks/{FormFilePicker-D5fAUE0Z.js → FormFilePicker-Dss6pGmO.js} +2 -2
  8. package/dist/chunks/{MapLayerMenu-CyVxRSNX.js → MapLayerMenu-BeherGz6.js} +1 -1
  9. package/dist/chunks/{RegistryForm-J7R4RWO3.js → RegistryForm-CRd2gUjs.js} +1 -1
  10. package/dist/chunks/{RegistryFormModal-B_EDwu9O.js → RegistryFormModal-BhYsDr2N.js} +3 -3
  11. package/dist/chunks/{RegistryToolbar-BDVaZ2Rf.js → RegistryToolbar-BOBzfY5O.js} +5 -5
  12. package/dist/chunks/{SurveyorTeleport-Y-NJhfsb.js → SurveyorTeleport-CHkB_uiv.js} +1 -1
  13. package/dist/chunks/{TablePagination-CZhRgCVr.js → TablePagination-vMlynwhO.js} +2 -2
  14. package/dist/chunks/{UserAccessBadge-B5Q1LvNv.js → UserAccessBadge-D8JfgGfN.js} +1 -1
  15. package/dist/chunks/{UserTypeBadge-CuAMctTK.js → UserTypeBadge-YIwwoCho.js} +1 -1
  16. package/dist/chunks/{VerifiedBadge-D6L7mCdp.js → VerifiedBadge-B__Vs_ce.js} +2 -2
  17. package/dist/chunks/{card-Dy333mEd.js → card-Bg2s2sUj.js} +5 -5
  18. package/dist/chunks/{card-Cll0FQ0z.js → card-BlhHWS3W.js} +6 -6
  19. package/dist/chunks/{card-Bw_EXY3D.js → card-CR1YmWBu.js} +4 -4
  20. package/dist/chunks/{card-DMt5SAoD.js → card-DxYRpS4g.js} +5 -5
  21. package/dist/chunks/{card-VMoiAe7V.js → card-Yp61N7At.js} +58 -52
  22. package/dist/chunks/{card-BMe6jQRR.js → card-pMk7mIJk.js} +10 -10
  23. package/dist/chunks/{certificates-URuwsRqg.js → certificates-CtLcclid.js} +6 -6
  24. package/dist/chunks/{create-CJXITPL0.js → create-Do1oraFc.js} +9 -9
  25. package/dist/chunks/{forgot-JFlAKndO.js → forgot-Ch4FUFpq.js} +2 -2
  26. package/dist/chunks/{login-Bd6krLDP.js → login-C3w9BK6L.js} +2 -2
  27. package/dist/chunks/{map-CNPzf0wE.js → map-CecGe6bQ.js} +11 -11
  28. package/dist/chunks/{map-layers-BgK6h6AD.js → map-layers-DGRdYvYA.js} +6 -6
  29. package/dist/chunks/{organizations-BLYhVQwf.js → organizations-DJ5vdt9m.js} +7 -7
  30. package/dist/chunks/{profile-F7mr0poI.js → profile-BI_RIHN1.js} +3 -3
  31. package/dist/chunks/{registration-DIA4xV-t.js → registration-Bi_Z4Os3.js} +2 -2
  32. package/dist/chunks/{requests-CPVQ1Yy_.js → requests-D19RKr0i.js} +5 -5
  33. package/dist/chunks/{requests-D-QPPUe4.js → requests-fCA3ykNT.js} +6 -6
  34. package/dist/chunks/{reset-DR3GXwrH.js → reset-DYBGrvE-.js} +2 -2
  35. package/dist/chunks/{useEntityPath-8s0Y1tjA.js → useEntityPath-n7hCq8zh.js} +1 -1
  36. package/dist/chunks/{users-BsWV3iTt.js → users-BxDdMbAB.js} +7 -7
  37. package/dist/index.js +40 -40
  38. package/migrations/20261016120000_map_layers.sql +156 -156
  39. package/migrations/20261016150000_password_reset.sql +15 -15
  40. package/migrations/20261016180000_settlement_lookup.sql +16 -16
  41. package/migrations/20261105120000_user_lookup.sql +15 -15
  42. package/package.json +1 -1
  43. package/server/dictionaries/index.ts +17 -17
  44. package/server/dictionaries/surveyor/map_layer_components.ts +11 -11
  45. package/server/dictionaries/surveyor/map_layer_groups.ts +10 -10
  46. package/server/dictionaries/surveyor/map_layer_types.ts +11 -11
  47. package/server/modules/surveyor/services/changeApplicationStatus.ts +100 -100
  48. package/server/modules/surveyor/services/createApplication.ts +2 -2
  49. package/server/modules/surveyor/services/mapLayers.ts +61 -61
  50. package/server/modules/surveyor/utils/templates/ds.surveyor_admin_password.pt.hbs +79 -79
  51. package/server/modules/surveyor/utils/templates/ds.surveyor_password_reset.pt.hbs +79 -79
  52. package/server/resources/helpers/settlement_lookup.ts +7 -7
  53. package/server/resources/surveyor-admin/applications.ts +126 -126
  54. package/server/resources/surveyor-admin/certificates.ts +113 -113
  55. package/server/resources/surveyor-admin/organization_surveyors.ts +31 -31
@@ -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
+ };
@@ -1,126 +1,126 @@
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
- // Generic update covers descriptive fields and replacing issued source data (file_output);
14
- // workflow fields (status, files, signature, area/geom, dates) stay read-only.
15
- export default {
16
- version: 1,
17
- name: "applications",
18
- module: "surveyor",
19
- title: "Заявки на геодезичні роботи",
20
- table: "surveyor.applications",
21
- key: "app_id",
22
- access: "user",
23
- operations: ["read", "update"],
24
- searchable: ["number", "location", "description"],
25
- capabilities: ["notes", "files"],
26
- summary: {
27
- awaitingData: { aggregate: "count", where: "t.status = 'awaitingData'" },
28
- dataIssued: { aggregate: "count", where: "t.status = 'dataIssued'" },
29
- reserve: { aggregate: "count", where: "t.status = 'reserve'" },
30
- underReview: { aggregate: "count", where: "t.status = 'underReview'" },
31
- verified: { aggregate: "count", where: "t.status = 'verified'" },
32
- completed: { aggregate: "count", where: "t.status = 'completed'" },
33
- cancelled: { aggregate: "count", where: "t.status = 'cancelled'" },
34
- },
35
- fields: {
36
- app_id: { type: "text", write: false, filterable: true, sortable: true },
37
- number: { type: "string", write: false, searchable: true, sortable: true },
38
- org_id: {
39
- type: "text",
40
- write: false,
41
- filterable: true,
42
- lookup: { table: "surveyor.organizations", value: "org_id", text: "name" },
43
- },
44
- surveyor_id: {
45
- type: "text",
46
- write: false,
47
- filterable: true,
48
- lookup: { table: "surveyor.surveyors", value: "surveyor_id", text: "email" },
49
- },
50
- status: {
51
- type: "string",
52
- write: false,
53
- filterable: true,
54
- dictionary: applicationStatus.code,
55
- enum: applicationStatusCodes,
56
- },
57
- work_type: {
58
- type: "string",
59
- write: true,
60
- filterable: true,
61
- dictionary: workTypes.code,
62
- enum: workTypeCodes,
63
- },
64
- description: { type: "text", write: true, searchable: true },
65
- execution_basis: { type: "text", write: true },
66
- settlement_id: {
67
- type: "string",
68
- write: true,
69
- filterable: true,
70
- lookup: settlementLookup,
71
- },
72
- is_found_address_id: { type: "boolean", write: true, filterable: true, dictionary: "yes-no" },
73
- address_id: { type: "string", write: true, filterable: true, lookup: addressLookup },
74
- location: { type: "text", write: true, searchable: true },
75
- area: { type: "number", write: false, sortable: true },
76
- geom: { type: "geometry", write: false },
77
- file_output: { type: "file", write: true },
78
- file_geodetic_survey: { type: "file", write: false },
79
- file_corrected_geodetic_survey: { type: "file", write: false },
80
- note_4_file_corrected_geodetic_survey: { type: "text", write: false },
81
- notes: { type: "text", write: true },
82
- signature: { type: "text", write: true },
83
- cancel_reason: { type: "text", write: false },
84
- source_data_issued_at: { type: "timestamp", write: false, sortable: true },
85
- survey_uploaded_at: { type: "timestamp", write: false, sortable: true },
86
- verified_at: { type: "timestamp", write: false, sortable: true },
87
- integrated_at: { type: "timestamp", write: false, sortable: true },
88
- cancelled_at: { type: "timestamp", write: false, sortable: true },
89
- verified_by: { type: "string", write: false, lookup: userLookup },
90
- integrated_by: { type: "string", write: false, lookup: userLookup },
91
- cancelled_by: { type: "string", write: false, lookup: userLookup },
92
- created_by: { type: "string", write: false, lookup: actorLookup },
93
- updated_by: { type: "string", write: false, lookup: actorLookup },
94
- created_at: { type: "timestamp", write: false, filterable: true, sortable: true },
95
- updated_at: { type: "timestamp", write: false, sortable: true },
96
- },
97
- relations: {
98
- comments: {
99
- type: "many",
100
- resource: "application_comments",
101
- localKey: "app_id",
102
- foreignKey: "resource_id",
103
- where: "t.resource IN ('applications', 'public_applications')",
104
- },
105
- organization: { resource: "organizations", localKey: "org_id" },
106
- surveyor: {
107
- resource: "surveyors",
108
- localKey: "surveyor_id",
109
- fields: [
110
- 't."surveyor_id"',
111
- 't."certificate_id"',
112
- 't."first_name"',
113
- 't."last_name"',
114
- 't."middle_name"',
115
- 't."email"',
116
- 't."phone"',
117
- 't."enabled"',
118
- ],
119
- },
120
- status_history: {
121
- resource: "application_status_history",
122
- localKey: "app_id",
123
- foreignKey: "application_id",
124
- },
125
- },
126
- } satisfies ResourceContract;
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
+ // Generic update covers descriptive fields and replacing issued source data (file_output);
14
+ // workflow fields (status, files, signature, area/geom, dates) stay read-only.
15
+ export default {
16
+ version: 1,
17
+ name: "applications",
18
+ module: "surveyor",
19
+ title: "Заявки на геодезичні роботи",
20
+ table: "surveyor.applications",
21
+ key: "app_id",
22
+ access: "user",
23
+ operations: ["read", "update"],
24
+ searchable: ["number", "location", "description"],
25
+ capabilities: ["notes", "files"],
26
+ summary: {
27
+ awaitingData: { aggregate: "count", where: "t.status = 'awaitingData'" },
28
+ dataIssued: { aggregate: "count", where: "t.status = 'dataIssued'" },
29
+ reserve: { aggregate: "count", where: "t.status = 'reserve'" },
30
+ underReview: { aggregate: "count", where: "t.status = 'underReview'" },
31
+ verified: { aggregate: "count", where: "t.status = 'verified'" },
32
+ completed: { aggregate: "count", where: "t.status = 'completed'" },
33
+ cancelled: { aggregate: "count", where: "t.status = 'cancelled'" },
34
+ },
35
+ fields: {
36
+ app_id: { type: "text", write: false, filterable: true, sortable: true },
37
+ number: { type: "string", write: false, searchable: true, sortable: true },
38
+ org_id: {
39
+ type: "text",
40
+ write: false,
41
+ filterable: true,
42
+ lookup: { table: "surveyor.organizations", value: "org_id", text: "name" },
43
+ },
44
+ surveyor_id: {
45
+ type: "text",
46
+ write: false,
47
+ filterable: true,
48
+ lookup: { table: "surveyor.surveyors", value: "surveyor_id", text: "email" },
49
+ },
50
+ status: {
51
+ type: "string",
52
+ write: false,
53
+ filterable: true,
54
+ dictionary: applicationStatus.code,
55
+ enum: applicationStatusCodes,
56
+ },
57
+ work_type: {
58
+ type: "string",
59
+ write: true,
60
+ filterable: true,
61
+ dictionary: workTypes.code,
62
+ enum: workTypeCodes,
63
+ },
64
+ description: { type: "text", write: true, searchable: true },
65
+ execution_basis: { type: "text", write: true },
66
+ settlement_id: {
67
+ type: "string",
68
+ write: true,
69
+ filterable: true,
70
+ lookup: settlementLookup,
71
+ },
72
+ is_found_address_id: { type: "boolean", write: true, filterable: true, dictionary: "yes-no" },
73
+ address_id: { type: "string", write: true, filterable: true, lookup: addressLookup },
74
+ location: { type: "text", write: true, searchable: true },
75
+ area: { type: "number", write: false, sortable: true },
76
+ geom: { type: "geometry", write: false },
77
+ file_output: { type: "file", write: true },
78
+ file_geodetic_survey: { type: "file", write: false },
79
+ file_corrected_geodetic_survey: { type: "file", write: false },
80
+ note_4_file_corrected_geodetic_survey: { type: "text", write: false },
81
+ notes: { type: "text", write: true },
82
+ signature: { type: "text", write: true },
83
+ cancel_reason: { type: "text", write: false },
84
+ source_data_issued_at: { type: "timestamp", write: false, sortable: true },
85
+ survey_uploaded_at: { type: "timestamp", write: false, sortable: true },
86
+ verified_at: { type: "timestamp", write: false, sortable: true },
87
+ integrated_at: { type: "timestamp", write: false, sortable: true },
88
+ cancelled_at: { type: "timestamp", write: false, sortable: true },
89
+ verified_by: { type: "string", write: false, lookup: userLookup },
90
+ integrated_by: { type: "string", write: false, lookup: userLookup },
91
+ cancelled_by: { type: "string", write: false, lookup: userLookup },
92
+ created_by: { type: "string", write: false, lookup: actorLookup },
93
+ updated_by: { type: "string", write: false, lookup: actorLookup },
94
+ created_at: { type: "timestamp", write: false, filterable: true, sortable: true },
95
+ updated_at: { type: "timestamp", write: false, sortable: true },
96
+ },
97
+ relations: {
98
+ comments: {
99
+ type: "many",
100
+ resource: "application_comments",
101
+ localKey: "app_id",
102
+ foreignKey: "resource_id",
103
+ where: "t.resource IN ('applications', 'public_applications')",
104
+ },
105
+ organization: { resource: "organizations", localKey: "org_id" },
106
+ surveyor: {
107
+ resource: "surveyors",
108
+ localKey: "surveyor_id",
109
+ fields: [
110
+ 't."surveyor_id"',
111
+ 't."certificate_id"',
112
+ 't."first_name"',
113
+ 't."last_name"',
114
+ 't."middle_name"',
115
+ 't."email"',
116
+ 't."phone"',
117
+ 't."enabled"',
118
+ ],
119
+ },
120
+ status_history: {
121
+ resource: "application_status_history",
122
+ localKey: "app_id",
123
+ foreignKey: "application_id",
124
+ },
125
+ },
126
+ } satisfies ResourceContract;
@@ -1,113 +1,113 @@
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
- import { certificateStatusSql } from "../../modules/surveyor/utils/certificateStatus.js";
5
-
6
- const accountTypeCodes = accountTypes.items.map(({ code }) => code);
7
-
8
- // Сертифікати імпортуються із зовнішнього реєстру, але адміністратор може додавати та редагувати їх вручну.
9
- export default {
10
- version: 1,
11
- name: "certificates",
12
- module: "surveyor",
13
- title: "Сертифікати",
14
- table: "surveyor.certificates",
15
- key: "certificate_id",
16
- display: ["surveyor_name", "number_certificate"],
17
- // Форма додавання користувача бере з /list статус сертифіката та наявний обліковий запис.
18
- displayFields: [
19
- "number_certificate",
20
- "surveyor_phone",
21
- "surveyor_email",
22
- `${certificateStatusSql("t")} AS certificate_status`,
23
- "account_id",
24
- "account_name",
25
- "account_email",
26
- "account_phone",
27
- "account_registered_at",
28
- ],
29
- access: "user",
30
- operations: ["read", "create", "update"],
31
- searchable: ["surveyor_name", "last_name", "first_name", "number_certificate"],
32
- fields: {
33
- certificate_id: {
34
- type: "text",
35
- write: false,
36
- filterable: true,
37
- lookup: {
38
- table: "surveyor.certificates",
39
- value: "certificate_id",
40
- text: "surveyor_name",
41
- fields: ["surveyor_email", "surveyor_phone", "number_certificate"],
42
- },
43
- },
44
- certificate_type: {
45
- type: "string",
46
- write: true,
47
- filterable: true,
48
- dictionary: accountTypes.code,
49
- enum: accountTypeCodes,
50
- },
51
- surveyor_name: {
52
- type: "string",
53
- write: true,
54
- searchable: true,
55
- },
56
- last_name: { type: "string", write: true, searchable: true },
57
- first_name: { type: "string", write: true, searchable: true },
58
- middle_name: { type: "string", write: true },
59
- surveyor_phone: { type: "string", write: true },
60
- surveyor_email: { type: "string", write: true },
61
- date_certificate: {
62
- type: "date",
63
- write: true,
64
- filterable: true,
65
- sortable: true,
66
- },
67
- number_certificate: { type: "string", write: true, searchable: true },
68
- name_school: { type: "text", write: true },
69
- date_protocol: { type: "date", write: true },
70
- number_protocol: { type: "string", write: true },
71
- certificate_increase: { type: "text", write: true },
72
- certificate_stopping: { type: "text", write: true },
73
- certificate_suspension: { type: "date", write: true },
74
- certificate_renewal: { type: "text", write: true },
75
- work_place: { type: "text", write: true },
76
- economic_activity: { type: "text", write: true },
77
- created_by: { type: "string", write: false, lookup: userLookup },
78
- created_at: { type: "timestamp", write: false, sortable: true },
79
- updated_by: { type: "string", write: false, lookup: userLookup },
80
- updated_at: { type: "timestamp", write: false, sortable: true },
81
- is_membership: {
82
- type: "boolean",
83
- write: true,
84
- filterable: true,
85
- dictionary: "yes-no",
86
- },
87
- membership: { type: "text", write: true },
88
- last_qualification_date: { type: "date", write: true },
89
- isvalid: { type: "boolean", write: true, filterable: true },
90
- qualification_level: { type: "string", write: true },
91
- },
92
- // Колонки мають префікс account_, щоб не конфліктувати з полями сертифіката.
93
- // scope "item" не додає join до основного списку сертифікатів.
94
- joins: [{
95
- scope: "item",
96
- sql: `LEFT JOIN LATERAL (
97
- SELECT s.surveyor_id AS account_id,
98
- concat_ws(' ', s.last_name, s.first_name, s.middle_name) AS account_name,
99
- s.email AS account_email,
100
- s.phone AS account_phone,
101
- s.registered_at AS account_registered_at
102
- FROM surveyor.surveyors s
103
- WHERE s.certificate_id = t.certificate_id
104
- ) AS account ON true`,
105
- }],
106
- relations: {
107
- surveyors: {
108
- resource: "surveyors",
109
- localKey: "certificate_id"
110
-
111
- },
112
- },
113
- } satisfies ResourceContract;
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
+ import { certificateStatusSql } from "../../modules/surveyor/utils/certificateStatus.js";
5
+
6
+ const accountTypeCodes = accountTypes.items.map(({ code }) => code);
7
+
8
+ // Сертифікати імпортуються із зовнішнього реєстру, але адміністратор може додавати та редагувати їх вручну.
9
+ export default {
10
+ version: 1,
11
+ name: "certificates",
12
+ module: "surveyor",
13
+ title: "Сертифікати",
14
+ table: "surveyor.certificates",
15
+ key: "certificate_id",
16
+ display: ["surveyor_name", "number_certificate"],
17
+ // Форма додавання користувача бере з /list статус сертифіката та наявний обліковий запис.
18
+ displayFields: [
19
+ "number_certificate",
20
+ "surveyor_phone",
21
+ "surveyor_email",
22
+ `${certificateStatusSql("t")} AS certificate_status`,
23
+ "account_id",
24
+ "account_name",
25
+ "account_email",
26
+ "account_phone",
27
+ "account_registered_at",
28
+ ],
29
+ access: "user",
30
+ operations: ["read", "create", "update"],
31
+ searchable: ["surveyor_name", "last_name", "first_name", "number_certificate"],
32
+ fields: {
33
+ certificate_id: {
34
+ type: "text",
35
+ write: false,
36
+ filterable: true,
37
+ lookup: {
38
+ table: "surveyor.certificates",
39
+ value: "certificate_id",
40
+ text: "surveyor_name",
41
+ fields: ["surveyor_email", "surveyor_phone", "number_certificate"],
42
+ },
43
+ },
44
+ certificate_type: {
45
+ type: "string",
46
+ write: true,
47
+ filterable: true,
48
+ dictionary: accountTypes.code,
49
+ enum: accountTypeCodes,
50
+ },
51
+ surveyor_name: {
52
+ type: "string",
53
+ write: true,
54
+ searchable: true,
55
+ },
56
+ last_name: { type: "string", write: true, searchable: true },
57
+ first_name: { type: "string", write: true, searchable: true },
58
+ middle_name: { type: "string", write: true },
59
+ surveyor_phone: { type: "string", write: true },
60
+ surveyor_email: { type: "string", write: true },
61
+ date_certificate: {
62
+ type: "date",
63
+ write: true,
64
+ filterable: true,
65
+ sortable: true,
66
+ },
67
+ number_certificate: { type: "string", write: true, searchable: true },
68
+ name_school: { type: "text", write: true },
69
+ date_protocol: { type: "date", write: true },
70
+ number_protocol: { type: "string", write: true },
71
+ certificate_increase: { type: "text", write: true },
72
+ certificate_stopping: { type: "text", write: true },
73
+ certificate_suspension: { type: "date", write: true },
74
+ certificate_renewal: { type: "text", write: true },
75
+ work_place: { type: "text", write: true },
76
+ economic_activity: { type: "text", write: true },
77
+ created_by: { type: "string", write: false, lookup: userLookup },
78
+ created_at: { type: "timestamp", write: false, sortable: true },
79
+ updated_by: { type: "string", write: false, lookup: userLookup },
80
+ updated_at: { type: "timestamp", write: false, sortable: true },
81
+ is_membership: {
82
+ type: "boolean",
83
+ write: true,
84
+ filterable: true,
85
+ dictionary: "yes-no",
86
+ },
87
+ membership: { type: "text", write: true },
88
+ last_qualification_date: { type: "date", write: true },
89
+ isvalid: { type: "boolean", write: true, filterable: true },
90
+ qualification_level: { type: "string", write: true },
91
+ },
92
+ // Колонки мають префікс account_, щоб не конфліктувати з полями сертифіката.
93
+ // scope "item" не додає join до основного списку сертифікатів.
94
+ joins: [{
95
+ scope: "item",
96
+ sql: `LEFT JOIN LATERAL (
97
+ SELECT s.surveyor_id AS account_id,
98
+ concat_ws(' ', s.last_name, s.first_name, s.middle_name) AS account_name,
99
+ s.email AS account_email,
100
+ s.phone AS account_phone,
101
+ s.registered_at AS account_registered_at
102
+ FROM surveyor.surveyors s
103
+ WHERE s.certificate_id = t.certificate_id
104
+ ) AS account ON true`,
105
+ }],
106
+ relations: {
107
+ surveyors: {
108
+ resource: "surveyors",
109
+ localKey: "certificate_id"
110
+
111
+ },
112
+ },
113
+ } satisfies ResourceContract;
@@ -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;