@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.
Files changed (139) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/README.md +188 -3
  3. package/dist/chunks/AppIcon-CIR6y5uE.js +85 -0
  4. package/dist/chunks/AppealDetailField-CI-1qhs3.js +58 -0
  5. package/dist/chunks/AppealStatusBadge-CSXnfarR.js +132 -0
  6. package/dist/chunks/AppealStatusBadge-DYBe9hqP.js +171 -0
  7. package/dist/chunks/ApplicationHistorySection-C0wwhwA4.js +769 -0
  8. package/dist/chunks/BaseModal-C7PVYz0m.js +85 -0
  9. package/dist/chunks/FormFilePicker-C3XQw50i.js +76 -0
  10. package/dist/chunks/MapLayerMenu-DjYCxEc3.js +145 -0
  11. package/dist/chunks/RegistryForm-CEUqFmsF.js +99 -0
  12. package/dist/chunks/RegistryFormModal-DfY4z_7r.js +85 -0
  13. package/dist/chunks/RegistryToolbar-BV4mYVAc.js +452 -0
  14. package/dist/chunks/UserAccessBadge-D8JfgGfN.js +44 -0
  15. package/dist/chunks/UserTypeBadge-YIwwoCho.js +188 -0
  16. package/dist/chunks/VerifiedBadge-Bba8WnuB.js +34 -0
  17. package/dist/chunks/_plugin-vue_export-helper-B3ysoDQm.js +8 -0
  18. package/dist/chunks/account-types-Br7gx_D_.js +35 -0
  19. package/dist/chunks/account_types-DLL1w122.js +25 -0
  20. package/dist/chunks/appealMapLayers-CQMK3rrz.js +115 -0
  21. package/dist/chunks/application_status-BhNGiY2I.js +45 -0
  22. package/dist/chunks/applications-BB9JRcgl.js +132 -0
  23. package/dist/chunks/buildSchema-CccjX9TJ.js +37 -0
  24. package/dist/chunks/card-B-ftozcq.js +739 -0
  25. package/dist/chunks/card-BctFHFZe.js +538 -0
  26. package/dist/chunks/card-CKD1N0QD.js +330 -0
  27. package/dist/chunks/card-CiNZxAd5.js +297 -0
  28. package/dist/chunks/card-DUtDfwMk.js +607 -0
  29. package/dist/chunks/card-fL26_Gvc.js +1189 -0
  30. package/dist/chunks/certificates-BSd1i0un.js +424 -0
  31. package/dist/chunks/create-DxMC_IL1.js +1033 -0
  32. package/dist/chunks/filterQuery-CvfZrkTC.js +99 -0
  33. package/dist/chunks/form-Bh6i5n1U.js +315 -0
  34. package/dist/chunks/form-DDjELqZ9.js +89 -0
  35. package/dist/chunks/geometry-DyhIVRcw.js +67 -0
  36. package/dist/chunks/map-Z57iMvFb.js +2763 -0
  37. package/dist/chunks/map-layers-DnmkOEld.js +400 -0
  38. package/dist/chunks/mapLayersApi-CWoQ2be-.js +251 -0
  39. package/dist/chunks/organizations-BO1_JETm.js +476 -0
  40. package/dist/chunks/organizations-BbYipLwk.js +14 -0
  41. package/dist/chunks/profile-ByahbF4B.js +164 -0
  42. package/dist/chunks/profile-Dwwn_4Pr.js +243 -0
  43. package/dist/chunks/requests-BCin936Z.js +232 -0
  44. package/dist/chunks/requests-CFv5wwAN.js +530 -0
  45. package/dist/chunks/resendSurveyorRegistration-BHTTVIw1.js +27 -0
  46. package/dist/chunks/resources-2e8RFqWR.js +129 -0
  47. package/dist/chunks/rolldown-runtime-Dy4uBu1J.js +11 -0
  48. package/dist/chunks/surveyorAccount-C7UiiIYg.js +78 -0
  49. package/dist/chunks/users-DtTYsgMb.js +291 -0
  50. package/dist/chunks/work_types-Hwme-FEX.js +34 -0
  51. package/dist/index.css +3 -0
  52. package/dist/index.js +336 -0
  53. package/migrations/20260924120000_surveyor_schema.sql +450 -0
  54. package/migrations/20261008170000_address_lookup.sql +20 -0
  55. package/migrations/20261016120000_map_layers.sql +156 -0
  56. package/migrations/20261016150000_password_reset.sql +15 -0
  57. package/migrations/20261016170000_address_lookup_format.sql +37 -0
  58. package/migrations/20261016180000_settlement_lookup.sql +16 -0
  59. package/migrations/20261019170000_actor_lookup.sql +15 -0
  60. package/package.json +86 -6
  61. package/plugin.d.ts +15 -0
  62. package/plugin.js +8 -0
  63. package/server/app.ts +51 -0
  64. package/server/dictionaries/index.ts +17 -0
  65. package/server/dictionaries/surveyor/account_types.ts +12 -0
  66. package/server/dictionaries/surveyor/application_status.ts +16 -0
  67. package/server/dictionaries/surveyor/map_layer_components.ts +11 -0
  68. package/server/dictionaries/surveyor/map_layer_groups.ts +10 -0
  69. package/server/dictionaries/surveyor/map_layer_types.ts +11 -0
  70. package/server/dictionaries/surveyor/work_types.ts +15 -0
  71. package/server/dictionaries/surveyor/yes_no.ts +11 -0
  72. package/server/fastify.d.ts +12 -0
  73. package/server/index.ts +23 -0
  74. package/server/modules/surveyor/route.ts +410 -0
  75. package/server/modules/surveyor/schema.ts +439 -0
  76. package/server/modules/surveyor/services/applicationTile.ts +53 -0
  77. package/server/modules/surveyor/services/cancelApplication.ts +74 -0
  78. package/server/modules/surveyor/services/changeSurveyorPassword.ts +52 -0
  79. package/server/modules/surveyor/services/changeSurveyorPasswordByAdmin.ts +41 -0
  80. package/server/modules/surveyor/services/completeApplication.ts +46 -0
  81. package/server/modules/surveyor/services/completeSurveyorRegistration.ts +48 -0
  82. package/server/modules/surveyor/services/createApplication.ts +169 -0
  83. package/server/modules/surveyor/services/geometryExport.ts +34 -0
  84. package/server/modules/surveyor/services/geometryImport.ts +66 -0
  85. package/server/modules/surveyor/services/getSurveyorUser.ts +56 -0
  86. package/server/modules/surveyor/services/identifyApplications.ts +82 -0
  87. package/server/modules/surveyor/services/issueSourceData.ts +55 -0
  88. package/server/modules/surveyor/services/loginSurveyor.ts +67 -0
  89. package/server/modules/surveyor/services/mapLayers.ts +61 -0
  90. package/server/modules/surveyor/services/rasterExport.ts +15 -0
  91. package/server/modules/surveyor/services/registerSurveyor.ts +161 -0
  92. package/server/modules/surveyor/services/requestPasswordReset.ts +49 -0
  93. package/server/modules/surveyor/services/resendRegistration.ts +42 -0
  94. package/server/modules/surveyor/services/resetSurveyorPassword.ts +53 -0
  95. package/server/modules/surveyor/services/searchApplications.ts +63 -0
  96. package/server/modules/surveyor/services/submitSurvey.ts +70 -0
  97. package/server/modules/surveyor/services/updateSurveyorAccountStatus.ts +52 -0
  98. package/server/modules/surveyor/services/updateSurveyorStatus.ts +53 -0
  99. package/server/modules/surveyor/services/vectorExport.ts +86 -0
  100. package/server/modules/surveyor/services/verifyApplication.ts +59 -0
  101. package/server/modules/surveyor/utils/accessibleApplication.ts +37 -0
  102. package/server/modules/surveyor/utils/application.ts +68 -0
  103. package/server/modules/surveyor/utils/export.ts +39 -0
  104. package/server/modules/surveyor/utils/firstBoundary.ts +48 -0
  105. package/server/modules/surveyor/utils/mail.ts +161 -0
  106. package/server/modules/surveyor/utils/permissions.ts +29 -0
  107. package/server/modules/surveyor/utils/registration.ts +33 -0
  108. package/server/modules/surveyor/utils/shared.ts +305 -0
  109. package/server/modules/surveyor/utils/templates/ds.surveyor_admin_password.pt.hbs +79 -0
  110. package/server/modules/surveyor/utils/templates/ds.surveyor_password_reset.pt.hbs +79 -0
  111. package/server/modules/surveyor/utils/templates/ds.surveyor_registration.pt.hbs +80 -0
  112. package/server/modules/surveyor/utils/templates/ds.surveyor_send_mail.pt.hbs +79 -0
  113. package/server/modules/surveyor/utils/vectorLayer.ts +41 -0
  114. package/server/plugins/convertVector.ts +74 -0
  115. package/server/plugins/proto/convertVector.proto +21 -0
  116. package/server/plugins/swagger.ts +54 -0
  117. package/server/plugins/vite.dev.ts +52 -0
  118. package/server/plugins/vite.prod.ts +55 -0
  119. package/server/resources/helpers/actor_lookup.ts +5 -0
  120. package/server/resources/helpers/address_lookup.ts +8 -0
  121. package/server/resources/helpers/settlement_lookup.ts +7 -0
  122. package/server/resources/helpers/user_lookup.ts +5 -0
  123. package/server/resources/index.ts +30 -0
  124. package/server/resources/surveyor-admin/application_comments.ts +24 -0
  125. package/server/resources/surveyor-admin/application_status_history.ts +46 -0
  126. package/server/resources/surveyor-admin/applications.ts +125 -0
  127. package/server/resources/surveyor-admin/certificates.ts +87 -0
  128. package/server/resources/surveyor-admin/map_layers.ts +69 -0
  129. package/server/resources/surveyor-admin/organization_surveyors.ts +32 -0
  130. package/server/resources/surveyor-admin/organizations.ts +61 -0
  131. package/server/resources/surveyor-admin/surveyors.ts +71 -0
  132. package/server/resources/surveyor-user/application_status_history.ts +52 -0
  133. package/server/resources/surveyor-user/applications.ts +131 -0
  134. package/server/resources/surveyor-user/certificates.ts +67 -0
  135. package/server/resources/surveyor-user/organizations.ts +40 -0
  136. package/server/resources/surveyor-user/surveyors.ts +69 -0
  137. package/server/suggests/index.ts +17 -0
  138. package/server/tsconfig.json +3 -0
  139. package/surveyor-types.d.ts +30 -0
@@ -0,0 +1,16 @@
1
+ -- Settlement lookup labels with the settlement type: "м. Львів", "с. Лисиничі".
2
+ CREATE OR REPLACE VIEW surveyor.settlement_lookup AS
3
+ SELECT
4
+ settlement.katottg,
5
+ settlement.level,
6
+ concat_ws(' ',
7
+ CASE settlement.type
8
+ WHEN 201 THEN 'м.'
9
+ WHEN 501 THEN 'м.'
10
+ WHEN 503 THEN 'смт'
11
+ WHEN 504 THEN 'с.'
12
+ WHEN 505 THEN 'с-ще'
13
+ END,
14
+ trim(settlement.name)
15
+ ) AS settlement_text
16
+ FROM data_address.atu AS settlement;
@@ -0,0 +1,15 @@
1
+ -- Shared lookup for actions performed by administrators and surveyors.
2
+ -- Actor IDs must identify the same person unambiguously across both tables.
3
+ CREATE OR REPLACE VIEW surveyor.actor_lookup AS
4
+ SELECT uid AS actor_id, login AS actor_text
5
+ FROM admin.users
6
+
7
+ UNION ALL
8
+
9
+ SELECT
10
+ surveyor_id AS actor_id,
11
+ COALESCE(
12
+ NULLIF(trim(concat_ws(' ', last_name, first_name, middle_name)), ''),
13
+ email
14
+ ) AS actor_text
15
+ FROM surveyor.surveyors;
package/package.json CHANGED
@@ -1,6 +1,86 @@
1
- {
2
- "name": "@opengis/surveyor",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
1
+ {
2
+ "name": "@opengis/surveyor",
3
+ "version": "0.0.2",
4
+ "type": "module",
5
+ "author": "Softpro",
6
+ "description": "Surveyor admin and geodesist cabinet UI for embedded host applications",
7
+ "main": "./dist/index.js",
8
+ "types": "./surveyor-types.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./surveyor-types.d.ts",
12
+ "import": "./dist/index.js"
13
+ },
14
+ "./style.css": "./dist/index.css",
15
+ "./plugin": {
16
+ "types": "./plugin.d.ts",
17
+ "import": "./plugin.js"
18
+ },
19
+ "./plugin.js": {
20
+ "types": "./plugin.d.ts",
21
+ "import": "./plugin.js"
22
+ }
23
+ },
24
+ "files": [
25
+ "dist",
26
+ "plugin.js",
27
+ "plugin.d.ts",
28
+ "server",
29
+ "migrations",
30
+ "README.md",
31
+ "CHANGELOG.md",
32
+ "surveyor-types.d.ts"
33
+ ],
34
+ "scripts": {
35
+ "build:lib": "vite build --config vite.lib.config.ts",
36
+ "build:admin": "vue-tsc --noEmit -p admin/tsconfig.json && vite build --config admin/vite.config.ts",
37
+ "build:cabinet": "vue-tsc --noEmit -p cabinet/tsconfig.json && vite build --config cabinet/vite.config.ts",
38
+ "build": "bun run build:lib && bun run build:admin && bun run build:cabinet",
39
+ "prepublishOnly": "bun run build:lib",
40
+ "start": "bun server/index.ts",
41
+ "admin": "bun server/index.ts --admin",
42
+ "cabinet": "bun server/index.ts --cabinet",
43
+ "prod": "bun server/index.ts --production",
44
+ "prod:cabinet": "bun server/index.ts --production --cabinet",
45
+ "server:typecheck": "bunx tsc --noEmit -p tsconfig.server.json",
46
+ "migrate": "bunx fcore-migrate"
47
+ },
48
+ "peerDependencies": {
49
+ "@opengis/core": "^0.0.37",
50
+ "@opengis/filter": "^0.1.59",
51
+ "@opengis/form": "^0.1.32",
52
+ "vue": "^3.5.0",
53
+ "vue-router": "^4.6.0",
54
+ "lucide-vue-next": "^0.446.0"
55
+ },
56
+ "dependencies": {
57
+ "@fastify/static": "9.3.0",
58
+ "@fastify/swagger": "9.9.0",
59
+ "@grpc/grpc-js": "1.14.5",
60
+ "@grpc/proto-loader": "0.8.1",
61
+ "@opengis/fcore": "0.0.42",
62
+ "fastify": "^5.12.3",
63
+ "fastify-plugin": "^5.0.1",
64
+ "nodemailer": "^10.0.12"
65
+ },
66
+ "devDependencies": {
67
+ "@opengis/core": "^0.0.37",
68
+ "@opengis/filter": "^0.1.59",
69
+ "@opengis/form": "^0.1.32",
70
+ "@tailwindcss/vite": "^4.3.3",
71
+ "@types/node": "^26.4.1",
72
+ "@vitejs/plugin-vue": "^6.0.1",
73
+ "@vue/tsconfig": "^0.8.1",
74
+ "lucide-vue-next": "0.446.0",
75
+ "tailwindcss": "^4.3.3",
76
+ "typescript": "~6.0.2",
77
+ "vite": "^8.2.2",
78
+ "vue": "^3.5.22",
79
+ "vue-router": "^4.6.4",
80
+ "vue-tsc": "^3.0.8"
81
+ },
82
+ "repository": {
83
+ "type": "git",
84
+ "url": "https://git.softpro.ua/product/surveyor.git"
85
+ }
86
+ }
package/plugin.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import type {
2
+ AfterUserHook,
3
+ AppContext,
4
+ DictionaryDefinition,
5
+ ResourceContract,
6
+ SuggestContract,
7
+ } from '@opengis/fcore';
8
+ import type { FastifyPluginAsync } from 'fastify';
9
+
10
+ export declare const resourcesSurveyor: ResourceContract[];
11
+ export declare const dictionariesSurveyor: DictionaryDefinition[];
12
+ export declare const suggestsSurveyor: SuggestContract[];
13
+ export declare const afterSurveyorUser: AfterUserHook;
14
+ export declare const surveyorPermissions: string[];
15
+ export declare function createSurveyorRoutes(ctx: AppContext): FastifyPluginAsync;
package/plugin.js ADDED
@@ -0,0 +1,8 @@
1
+ export { createSurveyorRoutes } from './server/modules/surveyor/route.ts';
2
+ export { default as resourcesSurveyor } from './server/resources/index.ts';
3
+ export { default as dictionariesSurveyor } from './server/dictionaries/index.ts';
4
+ export { default as suggestsSurveyor } from './server/suggests/index.ts';
5
+ export {
6
+ afterSurveyorUser,
7
+ surveyorPermissions,
8
+ } from './server/modules/surveyor/utils/permissions.ts';
package/server/app.ts ADDED
@@ -0,0 +1,51 @@
1
+ import Fastify from 'fastify';
2
+ import { createFCore, type AppContext } from '@opengis/fcore';
3
+ //import { createFCore, type AppContext } from '../../../npm/fcore/src/index.js';
4
+
5
+ import fcoreFastify from '@opengis/fcore/fastify';
6
+ //import fcoreFastify from '../../../npm/fcore/src/fastify.js';
7
+
8
+ import dictionaries from './dictionaries/index.js';
9
+ import suggests from './suggests/index.js';
10
+ import resources from './resources/index.js';
11
+ import { createSurveyorRoutes } from './modules/surveyor/route.js';
12
+ import { afterSurveyorUser } from './modules/surveyor/utils/permissions.js';
13
+ import { registerSwaggerPlugin, registerSwaggerRoutes } from "./plugins/swagger.js";
14
+ import viteDevPlugin from './plugins/vite.dev.js';
15
+ import viteProdPlugin from './plugins/vite.prod.js';
16
+
17
+ export default async function createApp() {
18
+ const ctx = await createFCore({ resources, dictionaries, suggests, hooks: { afterUser: afterSurveyorUser } }) as AppContext;
19
+ const app = Fastify({
20
+ loggerInstance: ctx.logger,
21
+ routerOptions: { maxParamLength: 2048 },
22
+ });
23
+
24
+ // Swagger must observe routes as they are registered.
25
+ await registerSwaggerPlugin(app);
26
+
27
+ // Invoke both plugins on this instance so FCore's authentication and access hooks
28
+ // also protect application-specific business routes.
29
+ await fcoreFastify(ctx)(app as any, {});
30
+ await createSurveyorRoutes(ctx)(app as any, {});
31
+
32
+ // Register documentation after FCore installs its route access hooks.
33
+ registerSwaggerRoutes(app);
34
+
35
+ const env = process.env.NODE_ENV?.toLowerCase() || 'production';
36
+
37
+ if (env === 'production') {
38
+ await viteProdPlugin(app, 'admin', '/admin/', ['admin']); // part, base, user_type
39
+ await viteProdPlugin(app, 'cabinet');
40
+ } else if(['admin', 'cabinet'].includes(env)){
41
+ await viteDevPlugin(app, env);
42
+ }
43
+
44
+ //await viteProdPlugin(app);
45
+
46
+ app.addHook('onClose', async () => {
47
+ await ctx.close();
48
+ });
49
+
50
+ return app;
51
+ }
@@ -0,0 +1,17 @@
1
+ import applicationStatus from "./surveyor/application_status.js";
2
+ import workTypes from "./surveyor/work_types.js";
3
+ import accountTypes from "./surveyor/account_types.js";
4
+ import yesNo from "./surveyor/yes_no.js";
5
+ import mapLayerGroups from "./surveyor/map_layer_groups.js";
6
+ import mapLayerTypes from "./surveyor/map_layer_types.js";
7
+ import mapLayerComponents from "./surveyor/map_layer_components.js";
8
+
9
+ export default [
10
+ applicationStatus,
11
+ workTypes,
12
+ accountTypes,
13
+ yesNo,
14
+ mapLayerGroups,
15
+ mapLayerTypes,
16
+ mapLayerComponents,
17
+ ];
@@ -0,0 +1,12 @@
1
+ import type { DictionaryDefinition } from "@opengis/fcore";
2
+
3
+ export default {
4
+ code: "account-types",
5
+ name: "Типи сертифікатів",
6
+ checked: true,
7
+ items: [
8
+ { code: "1", name: "Реєстр геодезистів", color: "#32a852" },
9
+ { code: "2", name: "Реєстр землевпорядників", color: "#570b99" },
10
+ { code: "3", name: "Реєстр інженерів-проектувальників", color: "#453ec9" },
11
+ ],
12
+ } satisfies DictionaryDefinition;
@@ -0,0 +1,16 @@
1
+ import type { DictionaryDefinition } from "@opengis/fcore";
2
+
3
+ export default {
4
+ code: "application-status",
5
+ name: "Статуси заявок",
6
+ checked: true,
7
+ items: [
8
+ { code: "awaitingData", name: "На видачу вихідних даних", color: "#979da6" },
9
+ { code: "dataIssued", name: "Видано вихідні дані", color: "#ed8c15" },
10
+ { code: "reserve", name: "Резерв", color: "#800000" },
11
+ { code: "underReview", name: "На перевірці", color: "#861aeb" },
12
+ { code: "verified", name: "Перевірено", color: "#3687e3" },
13
+ { code: "completed", name: "Внесено в ЄЦТО", color: "#03800b" },
14
+ { code: "cancelled", name: "Скасовано", color: "#ff0000" },
15
+ ],
16
+ } satisfies DictionaryDefinition;
@@ -0,0 +1,11 @@
1
+ import type { DictionaryDefinition } from "@opengis/fcore";
2
+
3
+ export default {
4
+ code: "map-layer-components",
5
+ name: "Компоненти карти",
6
+ items: [
7
+ { code: "map", name: "Карта" },
8
+ { code: "application-form", name: "Форма окреслення геометрії заявки" },
9
+ { code: "application-card", name: "Картка заявки" },
10
+ ],
11
+ } satisfies DictionaryDefinition;
@@ -0,0 +1,10 @@
1
+ import type { DictionaryDefinition } from "@opengis/fcore";
2
+
3
+ export default {
4
+ code: "map-layer-groups",
5
+ name: "Групи шарів карти",
6
+ items: [
7
+ { code: "base", name: "Базовий шар" },
8
+ { code: "overlay", name: "Додатковий шар" },
9
+ ],
10
+ } satisfies DictionaryDefinition;
@@ -0,0 +1,11 @@
1
+ import type { DictionaryDefinition } from "@opengis/fcore";
2
+
3
+ export default {
4
+ code: "map-layer-types",
5
+ name: "Типи шарів карти",
6
+ items: [
7
+ { code: "raster", name: "Растрові тайли" },
8
+ { code: "vector", name: "Векторні тайли" },
9
+ { code: "applications", name: "Заявки" },
10
+ ],
11
+ } satisfies DictionaryDefinition;
@@ -0,0 +1,15 @@
1
+ import type { DictionaryDefinition } from "@opengis/fcore";
2
+
3
+ export default {
4
+ code: "work-types",
5
+ name: "Види робіт",
6
+ checked: true,
7
+ items: [
8
+ { code: "1", name: "Топографічне знімання" },
9
+ { code: "2", name: "Інший вид робіт" },
10
+ { code: "3", name: "Інженерні вишукування" },
11
+ { code: "6", name: "Виконавче знімання" },
12
+ { code: "8", name: "Топографо-геодезичне знімання" },
13
+ { code: "9", name: "План земельної ділянки" },
14
+ ],
15
+ } satisfies DictionaryDefinition;
@@ -0,0 +1,11 @@
1
+ import type { DictionaryDefinition } from "@opengis/fcore";
2
+
3
+ export default {
4
+ code: "yes-no",
5
+ name: "Так або ні",
6
+ checked: true,
7
+ items: [
8
+ { code: "true", name: "Так", color: "green" },
9
+ { code: "false", name: "Ні", color: "red" },
10
+ ],
11
+ } satisfies DictionaryDefinition;
@@ -0,0 +1,12 @@
1
+ import type { User } from '@opengis/fcore';
2
+
3
+ declare module 'fastify' {
4
+ interface FastifySchema {
5
+ access?: 'public' | 'user' | 'admin';
6
+ permissions?: string[];
7
+ tags?: string[];
8
+ }
9
+ interface FastifyRequest {
10
+ user?: User;
11
+ }
12
+ }
@@ -0,0 +1,23 @@
1
+ import createApp from './app.js';
2
+
3
+ if (process.argv.includes('--admin')) process.env.NODE_ENV = 'admin';
4
+ else if (process.argv.includes('--cabinet')) process.env.NODE_ENV = 'cabinet';
5
+ else if (process.argv.includes('--production')) process.env.NODE_ENV = 'production';
6
+
7
+ const app = await createApp();
8
+ const port = Number(process.env.PORT ?? 3000);
9
+
10
+ const shutdown = async () => {
11
+ await app.close();
12
+ };
13
+
14
+ process.once('SIGINT', shutdown);
15
+ process.once('SIGTERM', shutdown);
16
+
17
+ try {
18
+ await app.listen({ host: '0.0.0.0', port });
19
+ app.log.info(`Server started listening on port ${port}`);
20
+ } catch (error) {
21
+ app.log.error(error);
22
+ process.exit(1);
23
+ }