From 145827ab6d4dc80e5c29196409a2d2ca6a9cec4b Mon Sep 17 00:00:00 2001 From: popovspiridon99 Date: Fri, 1 Aug 2025 11:08:33 +0900 Subject: [PATCH] nestjs rewrite --- .gitignore | 6 +- client/.env.example | 4 +- client/package-lock.json | 60 +-- client/package.json | 2 +- client/public/template_1.docx | Bin 0 -> 13592 bytes client/public/template_table_1.docx | Bin 0 -> 14187 bytes client/src/components/Tree/ObjectTree.tsx | 2 +- client/src/components/map/MapComponent.tsx | 283 ++--------- .../components/map/MapLegend/MapLegend.tsx | 58 ++- client/src/components/map/MapLineTest.tsx | 125 +++++ .../src/components/map/MapPrint/MapPrint.tsx | 234 +++++++++ client/src/components/map/ObjectData.tsx | 2 +- client/src/components/map/ObjectParameter.tsx | 2 +- .../map/ObjectParameters/ObjectParameters.tsx | 2 +- client/src/constants/app.tsx | 24 +- client/src/dto/fuel/fuel.dto.ts | 29 ++ client/src/http/axiosInstanceNest.ts | 27 ++ client/src/layouts/MainLayout.tsx | 2 - client/src/main.tsx | 7 +- client/src/pages/Fuel.tsx | 207 ++++++++ client/src/pages/MapTest.tsx | 4 +- client/src/pages/PrintReport.tsx | 162 +++---- client/src/store/map.ts | 13 +- client/yarn.lock | 46 +- ems/DATABASE.md | 35 ++ ems/package-lock.json | 448 +++++++++++------- ems/src/api/general/index.ts | 29 +- ems/src/api/gis/index.ts | 30 +- 28 files changed, 1220 insertions(+), 623 deletions(-) create mode 100644 client/public/template_1.docx create mode 100644 client/public/template_table_1.docx create mode 100644 client/src/components/map/MapLineTest.tsx create mode 100644 client/src/components/map/MapPrint/MapPrint.tsx create mode 100644 client/src/dto/fuel/fuel.dto.ts create mode 100644 client/src/http/axiosInstanceNest.ts create mode 100644 client/src/pages/Fuel.tsx create mode 100644 ems/DATABASE.md diff --git a/.gitignore b/.gitignore index 34037ff..7c7c2d0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,8 @@ __pycache__ .env redis_data -psql_data \ No newline at end of file +psql_data +postgis_db +tools/import_bounds/*/*.geojson +tools/import_bounds/*/*.md +storage \ No newline at end of file diff --git a/client/.env.example b/client/.env.example index dc03d37..b3c7dbd 100644 --- a/client/.env.example +++ b/client/.env.example @@ -11,4 +11,6 @@ VITE_API_FUEL_URL= VITE_API_SERVERS_URL= # API EMS -VITE_API_EMS_URL= \ No newline at end of file +VITE_API_EMS_URL= + +VITE_API_NEST_URL= \ No newline at end of file diff --git a/client/package-lock.json b/client/package-lock.json index 09c7289..fe51df0 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -37,12 +37,12 @@ "@tiptap/starter-kit": "^2.7.3", "@types/ol-ext": "npm:@siedlerchr/types-ol-ext@^3.5.0", "@uidotdev/usehooks": "^2.4.1", + "ag-grid-react": "^33.3.2", "autoprefixer": "^10.4.19", "axios": "^1.7.2", "buffer": "^6.0.3", "dayjs": "^1.11.13", "docx-templates": "^4.13.0", - "easy-template-x": "^5.1.0", "embla-carousel-react": "^8.3.0", "file-type": "^19.0.0", "html2canvas": "^1.4.1", @@ -4259,15 +4259,6 @@ "vite": "^4 || ^5" } }, - "node_modules/@xmldom/xmldom": { - "version": "0.8.10", - "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", - "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==", - "license": "MIT", - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/@zeit/schemas": { "version": "2.36.0", "resolved": "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.36.0.tgz", @@ -4308,6 +4299,35 @@ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, + "node_modules/ag-charts-types": { + "version": "11.3.2", + "resolved": "https://registry.npmjs.org/ag-charts-types/-/ag-charts-types-11.3.2.tgz", + "integrity": "sha512-trPGqgGYiTeLgtf9nLuztDYOPOFOLbqHn1g2D99phf7QowcwdX0TPx0wfWG8Hm90LjB8IH+G2s3AZe2vrdAtMQ==", + "license": "MIT" + }, + "node_modules/ag-grid-community": { + "version": "33.3.2", + "resolved": "https://registry.npmjs.org/ag-grid-community/-/ag-grid-community-33.3.2.tgz", + "integrity": "sha512-9bx0e/+ykOyLvUxHqmdy0cRVANH6JAtv0yZdnBZEXYYqBAwN+G5a4NY+2I1KvoOCYzbk8SnStG7y4hCdVAAWOQ==", + "license": "MIT", + "dependencies": { + "ag-charts-types": "11.3.2" + } + }, + "node_modules/ag-grid-react": { + "version": "33.3.2", + "resolved": "https://registry.npmjs.org/ag-grid-react/-/ag-grid-react-33.3.2.tgz", + "integrity": "sha512-5bv4JIJvGov23sduIUIyQTqpa/qhoQrRkQm5pFOQb7RMwusfx6xBPrkLwIIlCJiQ8g0OOinxWzZ2kQ2Zml6tLw==", + "license": "MIT", + "dependencies": { + "ag-grid-community": "33.3.2", + "prop-types": "^15.8.1" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", @@ -5972,18 +5992,6 @@ "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", "dev": true }, - "node_modules/easy-template-x": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/easy-template-x/-/easy-template-x-5.1.0.tgz", - "integrity": "sha512-vypMbIMLWLXoooA9rsL3SVN2oQtZwmmx1m4H8gi6JfbEXQQ5VLHGOUHYi9APbvN9R8Gx93r1fphdSFRHxozeYw==", - "license": "MIT", - "dependencies": { - "@xmldom/xmldom": "0.8.10", - "json5": "2.2.3", - "jszip": "3.10.1", - "lodash.get": "4.4.2" - } - }, "node_modules/ejs": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", @@ -7872,6 +7880,7 @@ "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, "bin": { "json5": "lib/cli.js" }, @@ -8067,13 +8076,6 @@ "integrity": "sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==", "dev": true }, - "node_modules/lodash.get": { - "version": "4.4.2", - "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", - "integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ==", - "deprecated": "This package is deprecated. Use the optional chaining (?.) operator instead.", - "license": "MIT" - }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", diff --git a/client/package.json b/client/package.json index 3c5cddd..cdedae8 100644 --- a/client/package.json +++ b/client/package.json @@ -40,12 +40,12 @@ "@tiptap/starter-kit": "^2.7.3", "@types/ol-ext": "npm:@siedlerchr/types-ol-ext@^3.5.0", "@uidotdev/usehooks": "^2.4.1", + "ag-grid-react": "^33.3.2", "autoprefixer": "^10.4.19", "axios": "^1.7.2", "buffer": "^6.0.3", "dayjs": "^1.11.13", "docx-templates": "^4.13.0", - "easy-template-x": "^5.1.0", "embla-carousel-react": "^8.3.0", "file-type": "^19.0.0", "html2canvas": "^1.4.1", diff --git a/client/public/template_1.docx b/client/public/template_1.docx new file mode 100644 index 0000000000000000000000000000000000000000..9f6330caff0859e475665f869761bbdbb85d7a3b GIT binary patch literal 13592 zcmeH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zID-|M+)mn*%x*AyX1}uiM-xZHhq+)6RMkPCsv`eYRSoUzei^v`)l}eX177J$LvlbS zRtwn$lHzH(av-b_o_aCH=1*x$ShJy3a?D8U1;~kZGvUSPFg(7KVGnVZPhE$lEDP_0 zi!6xA2Vod~^0?HFfNpVQjx9f(4-{)i=7WqhA7POZYi54#(%Ib!x$S?o}KhoxWI z`kogN!(}xj@VO+5)p17&%E~y$K{8p&wI3@9&N2d7Pb44)?F0Jxu0N?vw?fAc48eX8 zn(ZMP12pJ{RXjS;+?7jlx`6NsxrM8!jWQxA_Eu2zkKvbO`?Y%z->Cwjtf7d61>5}1 z{m)N2mO~6^f;!lG_Uaf>{9aJMyJTP`ZqIAPta>g#3|c?R;)}@*NcMinSS-hirPayE z&tNr>rlqdt=fZ|*EW&~*Oe)e`%H~>qSlYk4N#NdH~H-_KC|2?YS+fQ-byoT&I6_&d4$PiPG=F8D91`S0+* z^B(^M0|4sq|Aznnupobz^g9>sPg!4qoBsdEjQd^0?<|2oMbrb?b$^KXD`(($`0tx; zf5HoK{{#R3w%~pT{~qrC3AUj5H~6>U_jd`u$76p=fTjDlgug{+zvKVzm;Xcq07Ae3 q@V~tD@9@9d%D=)-nEnF)x8+ojhWN!>1fJJ{19SkbYdq_(-2VaFIcAgq literal 0 HcmV?d00001 diff --git a/client/src/components/Tree/ObjectTree.tsx b/client/src/components/Tree/ObjectTree.tsx index 408879d..93ebf98 100644 --- a/client/src/components/Tree/ObjectTree.tsx +++ b/client/src/components/Tree/ObjectTree.tsx @@ -1,4 +1,4 @@ -import { useEffect, useMemo, useState } from 'react' +import { useMemo, useState } from 'react' import useSWR from 'swr' import { fetcher } from '../../http/axiosInstance' import { BASE_URL } from '../../constants' diff --git a/client/src/components/map/MapComponent.tsx b/client/src/components/map/MapComponent.tsx index 356e255..e23b726 100644 --- a/client/src/components/map/MapComponent.tsx +++ b/client/src/components/map/MapComponent.tsx @@ -1,5 +1,4 @@ import { useEffect, useRef, useState } from 'react' -import { jsPDF } from "jspdf" import 'ol/ol.css' import { Modify } from 'ol/interaction' import { ImageStatic, Vector as VectorSource } from 'ol/source' @@ -8,20 +7,20 @@ import { IRectCoords, SatelliteMapsProvider } from '../../interfaces/map' import { Extent, getCenter } from 'ol/extent' import { highlightStyleRed, highlightStyleYellow } from './MapStyles' import { customMapSource, googleMapsSatelliteSource, yandexMapsSatelliteSource } from './MapSources' -import { Geometry, LineString, SimpleGeometry } from 'ol/geom' +import { Geometry, SimpleGeometry } from 'ol/geom' import { fromExtent } from 'ol/geom/Polygon' import { Coordinate } from 'ol/coordinate' import { addInteractions, handleImageDrop, loadFeatures, processFigure, processLine } from './mapUtils' import useSWR, { SWRConfiguration } from 'swr' import { fetcher } from '../../http/axiosInstance' import { BASE_URL } from '../../constants' -import { ActionIcon, Autocomplete, CloseButton, Flex, Select as MantineSelect, MantineStyleProp, rem, useMantineColorScheme, Portal, Menu, Button, Group, Divider, LoadingOverlay, Stack, Container, Modal, Transition, Text, Select, Switch, Checkbox, Radio, ScrollAreaAutosize } from '@mantine/core' -import { IconArrowsMaximize, IconArrowsMinimize, IconBoxMultiple, IconBoxPadding, IconChevronCompactLeft, IconChevronDown, IconChevronLeft, IconChevronsDown, IconHelp, IconPlus, IconSearch, IconUpload, IconWindowMaximize, IconWindowMinimize } from '@tabler/icons-react' +import { ActionIcon, Autocomplete, CloseButton, Flex, Select as MantineSelect, MantineStyleProp, rem, useMantineColorScheme, Portal, Menu, Button, Group, Divider, LoadingOverlay, Stack, Container, Transition, } from '@mantine/core' +import { IconBoxMultiple, IconBoxPadding, IconChevronDown, IconChevronLeft, IconPlus, IconSearch, IconUpload, } from '@tabler/icons-react' import { ICitySettings, IFigure, ILine } from '../../interfaces/gis' import axios from 'axios' import MapToolbar from './MapToolbar/MapToolbar' import MapStatusbar from './MapStatusbar/MapStatusbar' -import { setAlignMode, setSatMapsProvider, setTypeRoles, useMapStore, setMapLabel, clearPrintArea, setPreviousView, setMode, setPrintScale, PrintScale, setPrintScaleLine } from '../../store/map' +import { setAlignMode, setSatMapsProvider, setTypeRoles, useMapStore, setMapLabel, } from '../../store/map' import { useThrottle } from '@uidotdev/usehooks' import ObjectTree from '../Tree/ObjectTree' import { setCurrentObjectId, setSelectedDistrict, setSelectedRegion, setSelectedYear, useObjectsStore } from '../../store/objects' @@ -33,11 +32,8 @@ import GeoJSON from 'ol/format/GeoJSON' import MapLegend from './MapLegend/MapLegend' import GisService from '../../services/GisService' import MapMode from './MapMode' -import ScaleLine from 'ol/control/ScaleLine' -import { getPointResolution } from 'ol/proj' -import { PrintFormat, PrintOrientation, printResolutions, setPrintOrientation, setPrintResolution, usePrintStore } from '../../store/print' -import { printDimensions, satMapsProviders, scaleOptions, schemas } from '../../constants/map' -import { modals } from "@mantine/modals"; +import { satMapsProviders, schemas } from '../../constants/map' +import MapPrint from './MapPrint/MapPrint' const swrOptions: SWRConfiguration = { revalidateOnFocus: false @@ -69,17 +65,23 @@ const MapComponent = ({ mode, map, currentTool, alignMode, satMapsProvider, selectedObjectType, file, measureDraw, polygonExtent, rectCoords, draw, snap, translate, - nodeLayerSource, drawingLayerSource, + drawingLayerSource, satLayer, staticMapLayer, figuresLayer, linesLayer, regionsLayer, districtBoundLayer, baseLayer, - previousView, printArea, printSource, printAreaDraw, printScale, printScaleLine, + printAreaDraw, } = useMapStore().id[id] - const { printOrientation, printResolution, printFormat } = usePrintStore() - // Tab settings - const objectsPane: ITabsPane[] = [{ title: 'Объекты', value: 'objects', view: }, { title: 'Неразмещенные', value: 'unplaced', view: <> }, { title: 'Другие', value: 'other', view: <> },] - const paramsPane: ITabsPane[] = [{ title: 'История изменений', value: 'history', view: <> }, { title: 'Параметры', value: 'parameters', view: }, { title: 'Вычисляемые', value: 'calculated', view: <> }] + const objectsPane: ITabsPane[] = [ + { title: 'Объекты', value: 'objects', view: }, + { title: 'Неразмещенные', value: 'unplaced', view: <> }, + { title: 'Другие', value: 'other', view: <> }, + ] + const paramsPane: ITabsPane[] = [ + { title: 'История изменений', value: 'history', view: <> }, + { title: 'Параметры', value: 'parameters', view: }, + { title: 'Вычисляемые', value: 'calculated', view: <> } + ] // Map const mapElement = useRef(null) @@ -124,7 +126,6 @@ const MapComponent = ({ // map.current?.setView(new View({ // extent: bounds.getExtent() // })) - console.log(bounds.getFeatures().length) }) } }, [selectedDistrict, selectedYear]) @@ -183,26 +184,26 @@ const MapComponent = ({ backdropFilter: 'blur(8px)', } - const { data: nodes } = useSWR('/nodes/all', () => fetcher('/nodes/all', BASE_URL.ems), { revalidateOnFocus: false }) + // const { data: nodes } = useSWR('/nodes/all', () => fetcher('/nodes/all', BASE_URL.ems), { revalidateOnFocus: false }) - useEffect(() => { - // Draw features based on database data - if (Array.isArray(nodes)) { - nodes.map(node => { - if (node.shape_type === 'LINE') { - const coordinates: Coordinate[] = [] - if (Array.isArray(node.shape)) { - node.shape.map((point: { x: number, y: number }) => { - const coordinate = [point.x as number, point.y as number] as Coordinate - coordinates.push(coordinate) - }) - } - //console.log(coordinates) - nodeLayerSource.addFeature(new Feature({ geometry: new LineString(coordinates) })) - } - }) - } - }, [nodes, nodeLayerSource]) + // useEffect(() => { + // // Draw features based on database data + // if (Array.isArray(nodes)) { + // nodes.map(node => { + // if (node.shape_type === 'LINE') { + // const coordinates: Coordinate[] = [] + // if (Array.isArray(node.shape)) { + // node.shape.map((point: { x: number, y: number }) => { + // const coordinate = [point.x as number, point.y as number] as Coordinate + // coordinates.push(coordinate) + // }) + // } + // //console.log(coordinates) + // nodeLayerSource.addFeature(new Feature({ geometry: new LineString(coordinates) })) + // } + // }) + // } + // }, [nodes, nodeLayerSource]) const [searchObject, setSearchObject] = useState("") const throttledSearchObject = useThrottle(searchObject, 500) @@ -271,11 +272,15 @@ const MapComponent = ({ } }, [currentObjectId]) - const { data: regionsData } = useSWR(`/general/regions/all`, (url) => fetcher(url, BASE_URL.ems), swrOptions) + const { data: regionsData } = useSWR(`/general/regions`, (url) => fetcher(url, BASE_URL.ems), swrOptions) - const { data: districtsData } = useSWR(selectedRegion ? `/general/districts/all?region_id=${selectedRegion}` : null, (url) => fetcher(url, BASE_URL.ems), swrOptions) + const { data: districtsData } = useSWR(selectedRegion ? `/general/districts/?region_id=${selectedRegion}` : null, (url) => fetcher(url, BASE_URL.ems), swrOptions) - const { data: searchData } = useSWR(throttledSearchObject !== "" && selectedDistrict && selectedYear ? `/general/search/objects?q=${throttledSearchObject}&id_city=${selectedDistrict}&year=${selectedYear}` : null, (url) => fetcher(url, BASE_URL.ems), swrOptions) + const { data: searchData } = useSWR( + throttledSearchObject !== "" && selectedDistrict && selectedYear ? `/general/search/objects?q=${throttledSearchObject}&id_city=${selectedDistrict}&year=${selectedYear}` : null, + (url) => fetcher(url, BASE_URL.ems), + swrOptions + ) const { data: figuresData, isValidating: figuresValidating } = useSWR( selectedDistrict && selectedYear ? `/gis/figures/all?city_id=${selectedDistrict}&year=${selectedYear}&offset=0&limit=${10000}` : null, @@ -385,7 +390,7 @@ const MapComponent = ({ if (selectedDistrict && districtData) { const settings = getCitySettings() - const imageUrl = `${import.meta.env.VITE_API_EMS_URL}/static/${selectedDistrict}` + const imageUrl = `${import.meta.env.VITE_API_EMS_URL}/tiles/static/${selectedDistrict}` const img = new Image() img.src = imageUrl img.onload = () => { @@ -420,6 +425,8 @@ const MapComponent = ({ } }, [selectedDistrict, districtData, staticMapLayer]) + + // Light/dark theme useEffect(() => { if (baseLayer) { baseLayer.on('prerender', function (e) { @@ -446,12 +453,6 @@ const MapComponent = ({ } }, [colorScheme]) - const scaleLine = useRef(new ScaleLine({ - bar: true, - text: true, - minWidth: 125 - })) - useEffect(() => { if (map) { if (mode === 'print') { @@ -462,197 +463,9 @@ const MapComponent = ({ } }, [mode, map, printAreaDraw]) - useEffect(() => { - if (printArea) { - // backup view before entering print mode - setPreviousView(id, map?.getView()) - - map?.setTarget('print-portal') - - printSource.clear() - map?.getView().setCenter(getCenter(printArea)) - map?.getView().fit(printArea, { - size: printOrientation === 'horizontal' ? [594, 420] : [420, 594] - }) - map?.removeInteraction(printAreaDraw) - } - }, [printArea, map]) - - const exportToPDF = (format: PrintFormat, resolution: number, orientation: PrintOrientation) => { - const dim = printDimensions[format] - - const width = Math.round((dim[orientation === 'horizontal' ? 0 : 1] * resolution) / 25.4) - const height = Math.round((dim[orientation === 'horizontal' ? 1 : 0] * resolution) / 25.4) - - if (!map) return - - // Store original size and scale - const originalSize = map.getSize() - const originalResolution = map.getView().getResolution() - - if (!originalSize || !originalResolution) return - - // Calculate new resolution to fit high DPI - const scaleFactor = width / originalSize[0] - const newResolution = originalResolution / scaleFactor - - // console.log(`New resolution: ${newResolution}`) - - const center = map.getView().getCenter() - let scaleResolution - if (center) { - scaleResolution = Number(printScale) / getPointResolution(map.getView().getProjection(), Number(resolution) / 25.4, center) - // console.log(`Scaled resolution: ${scaleResolution}`) - } - - console.log(width, height) - // Set new high-resolution rendering - map.setSize([width, height]) - map.getView().setResolution(newResolution) - map.renderSync() - - map.once("rendercomplete", function () { - const mapCanvas = document.createElement("canvas") - mapCanvas.width = width - mapCanvas.height = height - const mapContext = mapCanvas.getContext("2d") - - if (!mapContext) return - - const canvas = document.querySelector('canvas') - if (canvas) { - if (canvas.width > 0) { - const opacity = canvas.parentElement?.style.opacity || "1" - mapContext.globalAlpha = parseFloat(opacity) - - const transform = canvas.style.transform - const matrixMatch = transform.match(/^matrix\(([^)]+)\)$/) - if (matrixMatch) { - const matrix = matrixMatch[1].split(",").map(Number) - mapContext.setTransform(...matrix as [number, number, number, number, number, number]) - } - - mapContext.drawImage(canvas, 0, 0) - } - } - - mapContext.globalAlpha = 1 - mapContext.setTransform(1, 0, 0, 1, 0, 0) - - // Restore original map settings - map.setSize(originalSize) - map.getView().setResolution(originalResolution) - map.renderSync() - - // Generate PDF - const pdf = new jsPDF(orientation === 'horizontal' ? "landscape" : 'portrait', undefined, format) - pdf.addImage(mapCanvas.toDataURL("image/jpeg"), "JPEG", 0, 0, orientation === 'horizontal' ? dim[0] : dim[1], orientation === 'horizontal' ? dim[1] : dim[0]) - - const filename = `${selectedYear}-${selectedRegion}-${selectedDistrict}-${new Date().toISOString()}.pdf` - pdf.save(filename, { - returnPromise: true - }).then(() => { - - }) - }) - } - - useEffect(() => { - if (printScaleLine) { - map?.addControl(scaleLine.current) - } else { - map?.removeControl(scaleLine.current) - } - }, [printScaleLine]) - - const [fullscreen, setFullscreen] = useState(false) - return ( <> - { - clearPrintArea(id) - map?.setTarget(mapElement.current as HTMLDivElement) - map?.addInteraction(printAreaDraw) - }} fullScreen={fullscreen}> - - - - - Предпросмотр области печати - - - - - - - setFullscreen(!fullscreen)}> - {fullscreen ? : } - - - - - - - Область печати можно передвигать. - - - - - setPrintOrientation(value as PrintOrientation)} - > - - - - - - - setPrintScale(id, value as PrintScale)} - /> - - setPrintScaleLine(id, event.currentTarget.checked)} - /> - - - - - - - - - - + {active && diff --git a/client/src/components/map/MapLegend/MapLegend.tsx b/client/src/components/map/MapLegend/MapLegend.tsx index cc5a05d..7384f71 100644 --- a/client/src/components/map/MapLegend/MapLegend.tsx +++ b/client/src/components/map/MapLegend/MapLegend.tsx @@ -1,7 +1,9 @@ -import { Accordion, ColorSwatch, Flex, MantineStyleProp, ScrollAreaAutosize, Stack, Text, useMantineColorScheme } from '@mantine/core' -import useSWR from 'swr'; -import { fetcher } from '../../../http/axiosInstance'; -import { BASE_URL } from '../../../constants'; +import { Accordion, ActionIcon, Collapse, ColorSwatch, Flex, MantineStyleProp, ScrollAreaAutosize, Stack, Text, useMantineColorScheme } from '@mantine/core' +import useSWR from 'swr' +import { fetcher } from '../../../http/axiosInstance' +import { BASE_URL } from '../../../constants' +import { useDisclosure } from '@mantine/hooks' +import { IconChevronDown } from '@tabler/icons-react' const MapLegend = ({ selectedDistrict, @@ -12,7 +14,7 @@ const MapLegend = ({ selectedYear: number | null, style: MantineStyleProp }) => { - const { colorScheme } = useMantineColorScheme(); + const { colorScheme } = useMantineColorScheme() const { data: existingObjectsList } = useSWR( selectedYear && selectedDistrict ? `/general/objects/list?year=${selectedYear}&city_id=${selectedDistrict}&planning=0` : null, @@ -30,28 +32,38 @@ const MapLegend = ({ } ) + const [opened, { toggle }] = useDisclosure(false) + return ( - + - - Легенда - + + + Легенда + - - - Существующие - - {existingObjectsList && } - - + + + + - - Планируемые - - {planningObjectsList && } - - - + + + + Существующие + + {existingObjectsList && } + + + + + Планируемые + + {planningObjectsList && } + + + + ) diff --git a/client/src/components/map/MapLineTest.tsx b/client/src/components/map/MapLineTest.tsx new file mode 100644 index 0000000..90efb61 --- /dev/null +++ b/client/src/components/map/MapLineTest.tsx @@ -0,0 +1,125 @@ +import { useEffect, useRef } from 'react' +import 'ol/ol.css' +import { Container, Stack, Tabs } from '@mantine/core' +import OlMap from 'ol/Map' +import { v4 as uuidv4 } from 'uuid' +import TileLayer from 'ol/layer/Tile' +import { OSM } from 'ol/source' +import View from 'ol/View' +import { transform } from 'ol/proj' +import VectorLayer from 'ol/layer/Vector' +import VectorSource from 'ol/source/Vector' +import Feature from 'ol/Feature' +import { LineString } from 'ol/geom' +import { Stroke, Style, Text } from 'ol/style' + +const center = [14443331.466543002, 8878970.176309839] + +const style = new Style({ + stroke: new Stroke({ color: 'blue', width: 2 }), + text: new Text({ + font: 'bold 14px', + placement: 'line', + offsetY: -14 + }), +}) + +const MapLineTest = () => { + const lines = [ + { name: 'A', points: [[100, 100], [200, 200]] }, + { name: 'B', points: [[200, 200], [300, 200]] }, + { name: 'X', points: [[200, 200], [300, 300]] }, + { name: 'L', points: [[300, 300], [350, 300]] }, + { name: 'N', points: [[300, 300], [250, 300]] }, + { name: 'I', points: [[300, 200], [300, 100]] }, + { name: 'J', points: [[300, 100], [250, 50]] }, + { name: 'C', points: [[300, 200], [400, 150]] }, + { name: 'D', points: [[400, 150], [400, 100]] }, + ] + + const map = useRef(null) + const vectorLayer = useRef(new VectorLayer({ + source: new VectorSource(), + style: feature => { + style.getText()?.setText(feature.get('label')) + return style + } + })) + + const mapElement = useRef(null) + + useEffect(() => { + map.current = new OlMap({ + controls: [], + layers: [ + new TileLayer({ source: new OSM(), properties: { id: uuidv4(), name: 'OpenStreetMap' } }), + vectorLayer.current + ] + }) + map.current.setTarget(mapElement.current as HTMLDivElement) + map.current.setView(new View({ + center: transform([129.7466541, 62.083504], 'EPSG:4326', 'EPSG:3857'), + zoom: 16, + maxZoom: 21, + })) + }, []) + + useEffect(() => { + if (map.current) { + const graph = new Map() + + // build graph adjacency list + lines.forEach(({ points }) => { + const [start, end] = points.map(pt => pt.join(',')) + const distance = Math.hypot(points[1][0] - points[0][0], points[1][1] - points[0][1]) + + if (!graph.has(start)) graph.set(start, []) + if (!graph.has(end)) graph.set(end, []) + + graph.get(start)?.push({ node: end, distance }) + graph.get(end)?.push({ node: start, distance }) + }) + + // perform DFS to calculate distances from "A" + const startNode = lines[0].points[0].join(',') + const distances = new Map() + const dfs = (node: string, currentDist: number) => { + if (distances.has(node) && distances.get(node)! <= currentDist) return + distances.set(node, currentDist) + for (const { node: neighbor, distance } of graph.get(node) || []) { + dfs(neighbor, currentDist + distance) + } + } + dfs(startNode, 0) + + // render features + lines.forEach(({ name, points }) => { + const lineCoords = points.map(point => [point[0] + center[0], point[1] + center[1]]) + const feature = new Feature(new LineString(lineCoords)) + + const lastNode = points[1].join(',') + const label = `${name} ${feature.getGeometry()?.getLength().toFixed(2)} (${distances.get(lastNode)?.toFixed(1) ?? '∞'})` + + feature.set('label', label) + vectorLayer.current.getSource()?.addFeature(feature) + }) + } + }, []) + + return ( + + + + + Map + + + + + + + + ) +} + +export default MapLineTest diff --git a/client/src/components/map/MapPrint/MapPrint.tsx b/client/src/components/map/MapPrint/MapPrint.tsx new file mode 100644 index 0000000..391af83 --- /dev/null +++ b/client/src/components/map/MapPrint/MapPrint.tsx @@ -0,0 +1,234 @@ +import { ActionIcon, Button, Checkbox, Flex, Modal, Radio, ScrollAreaAutosize, Select, Stack, Text } from '@mantine/core' +import { IconHelp, IconWindowMaximize, IconWindowMinimize } from '@tabler/icons-react' +import React, { useEffect, useRef, useState } from 'react' +import { clearPrintArea, PrintScale, setPreviousView, setPrintScale, setPrintScaleLine, useMapStore } from '../../../store/map' +import { PrintFormat, PrintOrientation, printResolutions, setPrintOrientation, setPrintResolution, usePrintStore } from '../../../store/print' +import { printDimensions, scaleOptions } from '../../../constants/map' +import { useObjectsStore } from '../../../store/objects' +// import { getPointResolution } from 'ol/proj' +import jsPDF from 'jspdf' +import { getCenter } from 'ol/extent' +import ScaleLine from 'ol/control/ScaleLine' + +const MapPrint = ({ + id, + mapElement +}: { + id: string + mapElement: React.MutableRefObject +}) => { + const [fullscreen, setFullscreen] = useState(false) + const { printOrientation, printResolution, printFormat } = usePrintStore() + const { selectedYear, selectedRegion, selectedDistrict } = useObjectsStore().id[id] + + const { + map, + previousView, printArea, printSource, printAreaDraw, printScale, printScaleLine, + } = useMapStore().id[id] + + const exportToPDF = (format: PrintFormat, resolution: number, orientation: PrintOrientation) => { + const dim = printDimensions[format] + + const width = Math.round((dim[orientation === 'horizontal' ? 0 : 1] * resolution) / 25.4) + const height = Math.round((dim[orientation === 'horizontal' ? 1 : 0] * resolution) / 25.4) + + if (!map) return + + // Store original size and scale + const originalSize = map.getSize() + const originalResolution = map.getView().getResolution() + + if (!originalSize || !originalResolution) return + + // Calculate new resolution to fit high DPI + const scaleFactor = width / originalSize[0] + const newResolution = originalResolution / scaleFactor + + // console.log(`New resolution: ${newResolution}`) + + // const center = map.getView().getCenter() + // let scaleResolution = 1 + // if (center) { + // scaleResolution = Number(printScale) / getPointResolution(map.getView().getProjection(), Number(resolution) / 25.4, center) + // // console.log(`Scaled resolution: ${scaleResolution}`) + // } + + console.log(width, height) + // Set new high-resolution rendering + map.setSize([width, height]) + map.getView().setResolution(newResolution) + map.renderSync() + + map.once("rendercomplete", function () { + const mapCanvas = document.createElement("canvas") + mapCanvas.width = width + mapCanvas.height = height + const mapContext = mapCanvas.getContext("2d") + + if (!mapContext) return + + const canvas = document.querySelector('canvas') + if (canvas) { + if (canvas.width > 0) { + const opacity = canvas.parentElement?.style.opacity || "1" + mapContext.globalAlpha = parseFloat(opacity) + + const transform = canvas.style.transform + const matrixMatch = transform.match(/^matrix\(([^)]+)\)$/) + if (matrixMatch) { + const matrix = matrixMatch[1].split(",").map(Number) + mapContext.setTransform(...matrix as [number, number, number, number, number, number]) + } + + mapContext.drawImage(canvas, 0, 0) + } + } + + mapContext.globalAlpha = 1 + mapContext.setTransform(1, 0, 0, 1, 0, 0) + + // Restore original map settings + map.setSize(originalSize) + map.getView().setResolution(originalResolution) + map.renderSync() + + const dimensions = { + w: orientation === 'horizontal' ? dim[0] : dim[1], + h: orientation === 'horizontal' ? dim[1] : dim[0] + } + + // Generate PDF + const pdf = new jsPDF(orientation === 'horizontal' ? "landscape" : 'portrait', undefined, format) + pdf.addImage(mapCanvas.toDataURL("image/jpeg"), "JPEG", 0, 0, dimensions.w, dimensions.h) + + const filename = `${selectedYear}-${selectedRegion}-${selectedDistrict}-${new Date().toISOString()}.pdf` + pdf.save(filename, { + returnPromise: true + }).then(() => { + + }) + }) + } + + const scaleLine = useRef(new ScaleLine({ + bar: true, + text: true, + minWidth: 125 + })) + + useEffect(() => { + if (printArea) { + // backup view before entering print mode + setPreviousView(id, map?.getView()) + + map?.setTarget('print-portal') + + printSource.clear() + map?.getView().setCenter(getCenter(printArea)) + map?.getView().fit(printArea, { + size: printOrientation === 'horizontal' ? [594, 420] : [420, 594] + }) + map?.removeInteraction(printAreaDraw) + } + }, [printArea, map]) + + useEffect(() => { + if (printScaleLine && printArea) { + map?.addControl(scaleLine.current) + } else { + map?.removeControl(scaleLine.current) + } + }, [printScaleLine, printArea]) + + return ( + { + clearPrintArea(id) + map?.setTarget(mapElement.current as HTMLDivElement) + map?.addInteraction(printAreaDraw) + }} fullScreen={fullscreen}> + + + + + Предпросмотр области печати + + + + + + + setFullscreen(!fullscreen)}> + {fullscreen ? : } + + + + + + + Область печати можно передвигать. + + + + + setPrintOrientation(value as PrintOrientation)} + > + + + + + + + setPrintScale(id, value as PrintScale)} + /> + + setPrintScaleLine(id, event.currentTarget.checked)} + /> + + + + + + + + + + ) +} + +export default MapPrint \ No newline at end of file diff --git a/client/src/components/map/ObjectData.tsx b/client/src/components/map/ObjectData.tsx index 18e0b44..382759d 100644 --- a/client/src/components/map/ObjectData.tsx +++ b/client/src/components/map/ObjectData.tsx @@ -6,7 +6,7 @@ import { BASE_URL } from '../../constants' const ObjectData = (object_data: IObjectData) => { const { data: typeData } = useSWR( - object_data.type ? `/general/types/all` : null, + object_data.type ? `/general/types` : null, (url) => fetcher(url, BASE_URL.ems), { revalidateOnFocus: false diff --git a/client/src/components/map/ObjectParameter.tsx b/client/src/components/map/ObjectParameter.tsx index 17efba5..0f76a41 100644 --- a/client/src/components/map/ObjectParameter.tsx +++ b/client/src/components/map/ObjectParameter.tsx @@ -16,7 +16,7 @@ const ObjectParameter = ({ map_id }: ObjectParameterProps) => { const { data: paramData } = useSWR( - `/general/params/all?param_id=${param.id_param}`, + `/general/params/?param_id=${param.id_param}`, (url) => fetcher(url, BASE_URL.ems).then(res => res[0] as IParam), { revalidateOnFocus: false, diff --git a/client/src/components/map/ObjectParameters/ObjectParameters.tsx b/client/src/components/map/ObjectParameters/ObjectParameters.tsx index dc900c3..06be0cc 100644 --- a/client/src/components/map/ObjectParameters/ObjectParameters.tsx +++ b/client/src/components/map/ObjectParameters/ObjectParameters.tsx @@ -15,7 +15,7 @@ const ObjectParameters = ({ const { currentObjectId } = useObjectsStore().id[map_id] const { data: valuesData, isValidating: valuesValidating } = useSWR( - currentObjectId ? `/general/values/all?object_id=${currentObjectId}` : null, + currentObjectId ? `/general/values/?object_id=${currentObjectId}` : null, (url) => fetcher(url, BASE_URL.ems), { revalidateOnFocus: false, diff --git a/client/src/constants/app.tsx b/client/src/constants/app.tsx index a880d7b..7589915 100644 --- a/client/src/constants/app.tsx +++ b/client/src/constants/app.tsx @@ -1,4 +1,4 @@ -import { IconBuildingFactory2, IconComponents, IconDeviceDesktopAnalytics, IconFiles, IconHome, IconLogin, IconLogin2, IconMap, IconPassword, IconReport, IconServer, IconSettings, IconShield, IconUsers } from "@tabler/icons-react"; +import { IconBuildingFactory2, IconComponents, IconDeviceDesktopAnalytics, IconFiles, IconFlame, IconHome, IconLogin, IconLogin2, IconMap, IconPassword, IconReport, icons, IconServer, IconSettings, IconShield, IconUsers } from "@tabler/icons-react"; import SignIn from "../pages/auth/SignIn"; import SignUp from "../pages/auth/SignUp"; import PasswordReset from "../pages/auth/PasswordReset"; @@ -15,6 +15,8 @@ import Boilers from "../pages/Boilers"; import MapTest from "../pages/MapTest"; import PrintReport from "../pages/PrintReport"; import DBManager from "../pages/DBManager"; +import MapLineTest from "../components/map/MapLineTest"; +import FuelPage from "../pages/Fuel"; // Определение страниц с путями и компонентом для рендера @@ -127,6 +129,15 @@ const pages = [ dashboard: true, enabled: true, }, + { + label: "Map line test", + path: "/map-line-test", + icon: , + component: , + drawer: true, + dashboard: true, + enabled: true, + }, { label: "Монитор", path: "/monitor", @@ -152,7 +163,7 @@ const pages = [ component: , drawer: true, dashboard: true, - enabled: false, + enabled: true, }, { label: "Тест БД", @@ -163,6 +174,15 @@ const pages = [ dashboard: true, enabled: true, }, + { + label: 'Fuel', + path: '/fuel', + icon: , + component: , + drawer: true, + dashboard: true, + enabled: true + } ] export { diff --git a/client/src/dto/fuel/fuel.dto.ts b/client/src/dto/fuel/fuel.dto.ts new file mode 100644 index 0000000..7e5489e --- /dev/null +++ b/client/src/dto/fuel/fuel.dto.ts @@ -0,0 +1,29 @@ +export class FuelExpenseDto { + id_boiler?: string + id_fuel?: number + date?: Date + value?: number +} + +export const FuelExpenseDtoHeaders = { + id_boiler: 'Boiler ID', + id_fuel: 'Fuel ID', + date: 'Date', + value: 'Value', +} + +export class FuelLimitDto { + id_boiler?: string + id_fuel?: number + month?: Date + year?: number + value?: number +} + +export const FuelLimitDtoHeaders = { + id_boiler: 'Boiler ID', + id_fuel: 'Fuel ID', + month: 'Month', + year: 'Year', + value: 'Value' +} \ No newline at end of file diff --git a/client/src/http/axiosInstanceNest.ts b/client/src/http/axiosInstanceNest.ts new file mode 100644 index 0000000..01fc82b --- /dev/null +++ b/client/src/http/axiosInstanceNest.ts @@ -0,0 +1,27 @@ +import axios, { ResponseType } from 'axios'; +import { useAuthStore } from '../store/auth'; + +const axiosInstance = axios.create(); + +axiosInstance.interceptors.request.use( + (config) => { + const token = useAuthStore.getState().token; + if (token) { + config.headers['Authorization'] = `Bearer ${token}`; + } + return config; + }, + (error) => { + return Promise.reject(error); + } +); + +export const fetcher = (url: string, baseURL?: string, responseType?: ResponseType) => axiosInstance.get(url, { + baseURL: baseURL || import.meta.env.VITE_API_NEST_URL, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + responseType: responseType ? responseType : "json" +}).then(res => res.data) + +export default axiosInstance; \ No newline at end of file diff --git a/client/src/layouts/MainLayout.tsx b/client/src/layouts/MainLayout.tsx index 45a838c..c180b1a 100644 --- a/client/src/layouts/MainLayout.tsx +++ b/client/src/layouts/MainLayout.tsx @@ -1,5 +1,3 @@ -// Layout for fullscreen pages - import { Flex } from "@mantine/core"; import { Outlet } from "react-router-dom"; diff --git a/client/src/main.tsx b/client/src/main.tsx index 68a77fb..7f7f42a 100644 --- a/client/src/main.tsx +++ b/client/src/main.tsx @@ -1,10 +1,13 @@ import "@fontsource/inter"; import '@mantine/core/styles.css'; +import '@mantine/dates/styles.css'; import React from 'react' import ReactDOM from 'react-dom/client' import App from './App.tsx' import './index.css' import { createTheme, DEFAULT_THEME, MantineProvider, mergeMantineTheme } from '@mantine/core'; +import 'dayjs/locale/ru'; +import { DatesProvider } from "@mantine/dates"; const overrides = createTheme({ // Set this color to `--mantine-color-body` CSS variable @@ -19,7 +22,9 @@ const theme = mergeMantineTheme(DEFAULT_THEME, overrides); ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( - + + + , ) \ No newline at end of file diff --git a/client/src/pages/Fuel.tsx b/client/src/pages/Fuel.tsx new file mode 100644 index 0000000..e0f5900 --- /dev/null +++ b/client/src/pages/Fuel.tsx @@ -0,0 +1,207 @@ +import { ActionIcon, Button, Flex, Input, Loader, LoadingOverlay, Modal, Overlay, Table, Tabs, TextInput, useMantineColorScheme } from "@mantine/core"; +import { IconMathMax, IconPlus, IconTableMinus, IconTablePlus } from "@tabler/icons-react"; +import { FuelExpenseDto, FuelExpenseDtoHeaders, FuelLimitDto, FuelLimitDtoHeaders } from "../dto/fuel/fuel.dto"; +import useSWR from "swr"; +import { fetcher } from "../http/axiosInstanceNest"; +import { useEffect, useState } from "react"; +import { useDisclosure } from "@mantine/hooks"; +import { DateInput, DatePicker } from '@mantine/dates' +import { SubmitHandler, useForm } from "react-hook-form"; + +import { AgGridReact } from "ag-grid-react"; +import { AllCommunityModule, ColDef, ModuleRegistry } from 'ag-grid-community' + +ModuleRegistry.registerModules([AllCommunityModule]) + +type FieldType = 'text' | 'number' | 'select' | 'date' + +interface IPostInclude { + field: string + field_type: FieldType +} + +interface ITableSchema { + label: string + value: string + get: string + post: string + headers: { [key: string]: string } + post_include: IPostInclude[] + icon: JSX.Element +} + +export default function FuelPage() { + const tables: ITableSchema[] = [ + { + label: 'Расходы', + value: 'expenses', + get: '/fuel/expenses', + post: '/fuel/expenses', + headers: FuelExpenseDtoHeaders, + post_include: [ + { + field: 'id_boiler', + field_type: 'text' + }, + { + field: 'id_fuel', + field_type: 'text' + }, + { + field: 'date', + field_type: 'date' + }, + { + field: 'value', + field_type: 'text' + } + ], + icon: + }, + { + label: 'Лимиты', + value: 'limits', + get: '/fuel/limits', + post: '/fuel/limits', + headers: FuelLimitDtoHeaders, + post_include: [ + { + field: 'id_boiler', + field_type: 'text' + }, + { + field: 'id_fuel', + field_type: 'text' + }, + { + field: 'month', + field_type: 'number' + }, + { + field: 'year', + field_type: 'number' + }, + { + field: 'value', + field_type: 'text' + } + ], + icon: , + } + ] + + const [currentTab, setCurrentTab] = useState(tables[0]) + + const { data, isLoading } = useSWR(currentTab.get, () => fetcher(currentTab.get), { revalidateOnFocus: false }) + + const [openedCreateModal, { open: openCreateModal, close: closeCreateModal }] = useDisclosure(false) + + const { colorScheme } = useMantineColorScheme() + + useEffect(() => { + if (colorScheme === 'dark') { + document.body.dataset.agThemeMode = 'dark' + } else { + document.body.dataset.agThemeMode = 'light' + } + }, [colorScheme]) + + return ( + <> + + + setCurrentTab(tables.find(table => table.value === tab) || tables[0])}> + + {tables.map((table, index) => ( + + {table.label} + + ))} + + + + + + + {tables.map((table, index) => ( + + {isLoading ? + + + + : + <> + ({ ...obj, [key]: 'test' }), {}), + Object.keys(table.headers).reduce((obj, key) => ({ ...obj, [key]: 'test' }), {}) + ]} + columnDefs={Object.keys(table.headers).map((header) => ({ + field: header + })) as ColDef[]} + defaultColDef={{ + flex: 1, + }} + /> + + } + + ))} + + + ) +} + +const ModalCreate = ({ + openedCreateModal, + closeCreateModal, + currentTab +}: { + openedCreateModal: boolean + closeCreateModal: () => void + currentTab: ITableSchema +}) => { + const { register, handleSubmit, reset, watch, formState: { errors, isSubmitting, dirtyFields, isValid } } = useForm({ + mode: 'onChange', + }) + + const onSubmit: SubmitHandler = async (values: any) => { + console.log('Values to submit:', values) + } + + return ( + + + + + {currentTab.post_include.map((header, index) => { + switch (header.field_type) { + case 'date': + return ( + + ) + case 'text': + return ( + + ) + default: + return ( + + ) + } + })} + + + + + ) +} \ No newline at end of file diff --git a/client/src/pages/MapTest.tsx b/client/src/pages/MapTest.tsx index e6d61a6..e6cde0f 100644 --- a/client/src/pages/MapTest.tsx +++ b/client/src/pages/MapTest.tsx @@ -13,9 +13,9 @@ function MapTest() { const tabs = [ { id: uuidv4(), - year: 2023, + year: 2018, region: 11, - district: 145, + district: 146, }, // { // id: uuidv4(), diff --git a/client/src/pages/PrintReport.tsx b/client/src/pages/PrintReport.tsx index f310f8f..bdd61bd 100644 --- a/client/src/pages/PrintReport.tsx +++ b/client/src/pages/PrintReport.tsx @@ -1,11 +1,10 @@ -import { ActionIcon, Button, Flex, Group, Input, Stack, Text, TextInput } from "@mantine/core" +import { ActionIcon, Button, Flex, Group, Stack, Text, TextInput } from "@mantine/core" import { useEffect, useState } from "react" import createReport, { listCommands } from 'docx-templates' -import { Dropzone, DropzoneProps, IMAGE_MIME_TYPE, MS_WORD_MIME_TYPE } from '@mantine/dropzone' -import { IconFile, IconFileTypeDocx, IconPhoto, IconPlus, IconUpload, IconX } from "@tabler/icons-react" +import { Dropzone, IMAGE_MIME_TYPE } from '@mantine/dropzone' +import { IconFileTypeDocx, IconPlus, IconUpload, IconX } from "@tabler/icons-react" import { CommandSummary } from "docx-templates/lib/types" import { Control, Controller, FieldValues, SubmitHandler, useFieldArray, useForm, UseFormRegister } from "react-hook-form" -import { TemplateHandler } from 'easy-template-x' const xslTemplate = ` @@ -962,54 +961,6 @@ const handleGenerateExcel = () => { URL.revokeObjectURL(url) } -const TemplateFormET = ({ - templateUrl -}: { - templateUrl: string -}) => { - const [templateUint8Array, setTemplateUint8Array] = useState(null) - const [loading, setLoading] = useState(false) - - const loadTemplate = async (templateUrl: string) => { - setLoading(true) - try { - const response = await fetch(templateUrl) - const templateArrayBuffer = await response.arrayBuffer() - - setTemplateUint8Array(new Uint8Array(templateArrayBuffer)) - } catch (error) { - console.error("Error generating DOCX:", error) - } finally { - setLoading(false) - } - } - - const loadTags = async (templateUint8Array: Uint8Array) => { - const handler = new TemplateHandler() - const tags = await handler.parseTags(templateUint8Array) - - console.log(tags) - } - - useEffect(() => { - if (templateUint8Array) { - loadTags(templateUint8Array) - } - }, [templateUint8Array]) - - useEffect(() => { - if (templateUrl) { - loadTemplate(templateUrl) - } - }, [templateUrl]) - - return ( -
- -
- ) -} - interface TemplateCommand extends CommandSummary { children?: CommandSummary[] } @@ -1098,6 +1049,7 @@ const FormLoop = ({ )) } + { if (command.children) { append(command.children.map(c => c.code).reduce((acc, key) => { @@ -1132,51 +1084,51 @@ const renderCommand = ( if (command.type === 'IMAGE') { return ( - ( - console.log('rejected files', files)} - onDrop={(files) => { - console.log(files[0]) - files[0].arrayBuffer().then(res => { - onChange({ - width: 6, - height: 6, - data: new Uint8Array(res), - extension: files[0]?.path?.match(/\.[^.]+$/)?.[0] || "" + + {command.code} + ( + console.log('rejected files', files)} + onDrop={(files) => { + console.log(files[0]) + files[0].arrayBuffer().then(res => { + onChange({ + width: 6, + height: 6, + data: new Uint8Array(res), + extension: files[0]?.path?.match(/\.[^.]+$/)?.[0] || "" + }) }) - }) - }} - maxFiles={1} - > - - - - - - - - - - + }} + maxFiles={1} + > + + + + + + + + + + -
- - Drag files here or click to select files - - - Attach as many files as you like, each file should not exceed 5mb - -
-
-
- )} - /> +
+ + Перетащите файлы сюда или нажмите, чтобы выбрать их + +
+ +
+ )} + /> + ) } } @@ -1186,7 +1138,7 @@ const TemplateForm = ({ }: { templateUrl: string, }) => { - const { register, control, handleSubmit, reset, watch, formState } = useForm({ + const { register, control, handleSubmit } = useForm({ mode: 'onChange', }) @@ -1276,6 +1228,15 @@ const TemplateForm = ({ } }, [templateUrl]) + useEffect(() => { + console.log(loading) + }, [loading]) + + useEffect(() => { + console.log(saving) + }, [saving]) + + if (commandList) { return (
@@ -1283,13 +1244,16 @@ const TemplateForm = ({ {commandList.map(command => { if (command.type === 'FOR') { return ( - + + {command.code} + + ) } else { return renderCommand(control, register, command, command.code, command.code, command.code) } })} - + ) @@ -1297,8 +1261,6 @@ const TemplateForm = ({ } const PrintReport = () => { - const [loading, setLoading] = useState(false) - return ( diff --git a/client/src/store/map.ts b/client/src/store/map.ts index 648f033..46898b3 100644 --- a/client/src/store/map.ts +++ b/client/src/store/map.ts @@ -235,7 +235,7 @@ export const initializeMapState = ( const printAreaDraw = new Draw({ source: printSource, type: 'Circle', - style: (feature) => { + style: () => { return new Style({ fill: new Fill({ color: "rgba(0, 0, 255, 0.3)", // Semi-transparent blue fill @@ -331,12 +331,13 @@ export const initializeMapState = ( if (pixel) { map?.forEachFeatureAtPixel(pixel, function (feature, layer) { - if (layer.get('type') === 'region') { - console.log("clicked on region") - zoomToFeature(id, feature as Feature) + if (layer) { + if (layer.get('type') === 'region') { + zoomToFeature(id, feature as Feature) - if (feature.get('entity_id')) { - setSelectedRegion(id, feature.get('entity_id')) + if (feature.get('entity_id')) { + setSelectedRegion(id, feature.get('entity_id')) + } } } }) diff --git a/client/yarn.lock b/client/yarn.lock index e35451d..f9119f8 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -1869,11 +1869,6 @@ dependencies: "@swc/core" "^1.5.7" -"@xmldom/xmldom@0.8.10": - version "0.8.10" - resolved "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz" - integrity sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw== - "@zeit/schemas@2.36.0": version "2.36.0" resolved "https://registry.npmjs.org/@zeit/schemas/-/schemas-2.36.0.tgz" @@ -1897,6 +1892,26 @@ acorn-jsx@^5.3.2: resolved "https://registry.npmjs.org/acorn/-/acorn-8.11.3.tgz" integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== +ag-charts-types@11.3.2: + version "11.3.2" + resolved "https://registry.npmjs.org/ag-charts-types/-/ag-charts-types-11.3.2.tgz" + integrity sha512-trPGqgGYiTeLgtf9nLuztDYOPOFOLbqHn1g2D99phf7QowcwdX0TPx0wfWG8Hm90LjB8IH+G2s3AZe2vrdAtMQ== + +ag-grid-community@33.3.2: + version "33.3.2" + resolved "https://registry.npmjs.org/ag-grid-community/-/ag-grid-community-33.3.2.tgz" + integrity sha512-9bx0e/+ykOyLvUxHqmdy0cRVANH6JAtv0yZdnBZEXYYqBAwN+G5a4NY+2I1KvoOCYzbk8SnStG7y4hCdVAAWOQ== + dependencies: + ag-charts-types "11.3.2" + +ag-grid-react@^33.3.2: + version "33.3.2" + resolved "https://registry.npmjs.org/ag-grid-react/-/ag-grid-react-33.3.2.tgz" + integrity sha512-5bv4JIJvGov23sduIUIyQTqpa/qhoQrRkQm5pFOQb7RMwusfx6xBPrkLwIIlCJiQ8g0OOinxWzZ2kQ2Zml6tLw== + dependencies: + ag-grid-community "33.3.2" + prop-types "^15.8.1" + ajv@^6.12.4: version "6.12.6" resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" @@ -2937,16 +2952,6 @@ eastasianwidth@^0.2.0: resolved "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz" integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== -easy-template-x@^5.1.0: - version "5.1.0" - resolved "https://registry.npmjs.org/easy-template-x/-/easy-template-x-5.1.0.tgz" - integrity sha512-vypMbIMLWLXoooA9rsL3SVN2oQtZwmmx1m4H8gi6JfbEXQQ5VLHGOUHYi9APbvN9R8Gx93r1fphdSFRHxozeYw== - dependencies: - "@xmldom/xmldom" "0.8.10" - json5 "2.2.3" - jszip "3.10.1" - lodash.get "4.4.2" - ejs@^3.1.6: version "3.1.10" resolved "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz" @@ -4071,7 +4076,7 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== -json5@^2.2.0, json5@^2.2.3, json5@2.2.3: +json5@^2.2.0, json5@^2.2.3: version "2.2.3" resolved "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz" integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== @@ -4105,7 +4110,7 @@ jspdf@^2.5.1, jspdf@^2.5.2: dompurify "^2.5.4" html2canvas "^1.0.0-rc.5" -jszip@^3.10.1, jszip@3.10.1: +jszip@^3.10.1: version "3.10.1" resolved "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz" integrity sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g== @@ -4191,11 +4196,6 @@ lodash.debounce@^4.0.8: resolved "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz" integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow== -lodash.get@4.4.2: - version "4.4.2" - resolved "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz" - integrity sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ== - lodash.merge@^4.6.2: version "4.6.2" resolved "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz" @@ -5136,7 +5136,7 @@ rc@^1.0.1, rc@^1.1.6: minimist "^1.2.0" strip-json-comments "~2.0.1" -"react-dom@^0.14 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", "react-dom@^16.0.0 || ^17.0.0 || ^18.0.0", "react-dom@^16.8.0 || ^17.0.0 || ^18.0.0", "react-dom@^17.0.0 || ^18.0.0", react-dom@^18.0.0, react-dom@^18.2.0, react-dom@>=16.6.0, react-dom@>=16.8, react-dom@>=16.8.0, react-dom@>=18.0.0: +"react-dom@^0.14 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", "react-dom@^16.0.0 || ^17.0.0 || ^18.0.0", "react-dom@^16.8.0 || ^17.0.0 || ^18.0.0", "react-dom@^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom@^17.0.0 || ^18.0.0", react-dom@^18.0.0, react-dom@^18.2.0, react-dom@>=16.6.0, react-dom@>=16.8, react-dom@>=16.8.0, react-dom@>=18.0.0: version "18.3.1" resolved "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz" integrity sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw== diff --git a/ems/DATABASE.md b/ems/DATABASE.md new file mode 100644 index 0000000..c5442bb --- /dev/null +++ b/ems/DATABASE.md @@ -0,0 +1,35 @@ +Make sure to use PostGIS + +Create tables first: + +```sql +CREATE TABLE IF NOT EXISTS bounds ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + entity_id INT NOT NULL, + entity_type TEXT NOT NULL, + geometry GEOMETRY(MULTIPOLYGON, 3857) NOT NULL, + UNIQUE (entity_id, entity_type) +); +``` + +```sql +CREATE TABLE IF NOT EXISTS lines ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + object_id UUID NOT NULL, + geometry GEOMETRY(LINESTRING, 3857) NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP DEFAULT NOW(), + schema TEXT NOT NULL +); +``` + +```sql +CREATE TABLE IF NOT EXISTS shapes ( + id UUID PRIMARY KEY DEFAULT gen_random_uuid(), + object_id UUID NOT NULL, + geometry GEOMETRY(POLYGON, 3857) NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT NOW(), + updated_at TIMESTAMP DEFAULT NOW(), + schema TEXT NOT NULL +); +``` \ No newline at end of file diff --git a/ems/package-lock.json b/ems/package-lock.json index f6492c8..af6f9e1 100644 --- a/ems/package-lock.json +++ b/ems/package-lock.json @@ -683,48 +683,53 @@ } }, "node_modules/@prisma/debug": { - "version": "5.19.1", - "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.19.1.tgz", - "integrity": "sha512-lAG6A6QnG2AskAukIEucYJZxxcSqKsMK74ZFVfCTOM/7UiyJQi48v6TQ47d6qKG3LbMslqOvnTX25dj/qvclGg==", - "devOptional": true + "version": "5.22.0", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.22.0.tgz", + "integrity": "sha512-AUt44v3YJeggO2ZU5BkXI7M4hu9BF2zzH2iF2V5pyXT/lRTyWiElZ7It+bRH1EshoMRxHgpYg4VB6rCM+mG5jQ==", + "devOptional": true, + "license": "Apache-2.0" }, "node_modules/@prisma/engines": { - "version": "5.19.1", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.19.1.tgz", - "integrity": "sha512-kR/PoxZDrfUmbbXqqb8SlBBgCjvGaJYMCOe189PEYzq9rKqitQ2fvT/VJ8PDSe8tTNxhc2KzsCfCAL+Iwm/7Cg==", + "version": "5.22.0", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.22.0.tgz", + "integrity": "sha512-UNjfslWhAt06kVL3CjkuYpHAWSO6L4kDCVPegV6itt7nD1kSJavd3vhgAEhjglLJJKEdJ7oIqDJ+yHk6qO8gPA==", "devOptional": true, "hasInstallScript": true, + "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "5.19.1", - "@prisma/engines-version": "5.19.1-2.69d742ee20b815d88e17e54db4a2a7a3b30324e3", - "@prisma/fetch-engine": "5.19.1", - "@prisma/get-platform": "5.19.1" + "@prisma/debug": "5.22.0", + "@prisma/engines-version": "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2", + "@prisma/fetch-engine": "5.22.0", + "@prisma/get-platform": "5.22.0" } }, "node_modules/@prisma/engines-version": { - "version": "5.19.1-2.69d742ee20b815d88e17e54db4a2a7a3b30324e3", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.19.1-2.69d742ee20b815d88e17e54db4a2a7a3b30324e3.tgz", - "integrity": "sha512-xR6rt+z5LnNqTP5BBc+8+ySgf4WNMimOKXRn6xfNRDSpHvbOEmd7+qAOmzCrddEc4Cp8nFC0txU14dstjH7FXA==", - "devOptional": true + "version": "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2.tgz", + "integrity": "sha512-2PTmxFR2yHW/eB3uqWtcgRcgAbG1rwG9ZriSvQw+nnb7c4uCr3RAcGMb6/zfE88SKlC1Nj2ziUvc96Z379mHgQ==", + "devOptional": true, + "license": "Apache-2.0" }, "node_modules/@prisma/fetch-engine": { - "version": "5.19.1", - "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.19.1.tgz", - "integrity": "sha512-pCq74rtlOVJfn4pLmdJj+eI4P7w2dugOnnTXpRilP/6n5b2aZiA4ulJlE0ddCbTPkfHmOL9BfaRgA8o+1rfdHw==", + "version": "5.22.0", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.22.0.tgz", + "integrity": "sha512-bkrD/Mc2fSvkQBV5EpoFcZ87AvOgDxbG99488a5cexp5Ccny+UM6MAe/UFkUC0wLYD9+9befNOqGiIJhhq+HbA==", "devOptional": true, + "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "5.19.1", - "@prisma/engines-version": "5.19.1-2.69d742ee20b815d88e17e54db4a2a7a3b30324e3", - "@prisma/get-platform": "5.19.1" + "@prisma/debug": "5.22.0", + "@prisma/engines-version": "5.22.0-44.605197351a3c8bdd595af2d2a9bc3025bca48ea2", + "@prisma/get-platform": "5.22.0" } }, "node_modules/@prisma/get-platform": { - "version": "5.19.1", - "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.19.1.tgz", - "integrity": "sha512-sCeoJ+7yt0UjnR+AXZL7vXlg5eNxaFOwC23h0KvW1YIXUoa7+W2ZcAUhoEQBmJTW4GrFqCuZ8YSP0mkDa4k3Zg==", + "version": "5.22.0", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.22.0.tgz", + "integrity": "sha512-pHhpQdr1UPFpt+zFfnPazhulaZYCUqeIcPpJViYoq9R+D/yw4fjE+CtnsnKzPYm0ddUbeXUzjGVGIRVgPDCk4Q==", "devOptional": true, + "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "5.19.1" + "@prisma/debug": "5.22.0" } }, "node_modules/@redis/bloom": { @@ -1145,9 +1150,10 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/axios": { - "version": "1.7.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz", - "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.4.tgz", + "integrity": "sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==", + "license": "MIT", "dependencies": { "follow-redirects": "^1.15.6", "form-data": "^4.0.0", @@ -1226,9 +1232,10 @@ } }, "node_modules/body-parser": { - "version": "1.20.2", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.2.tgz", - "integrity": "sha512-ml9pReCu3M61kGlqoTm2umSXTlRTuGTx0bfYj+uIUKKYycG5NtSbeetV3faSU6R7ajOPw0g/J1PvK4qNy7s5bA==", + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.3.tgz", + "integrity": "sha512-7rAxByjUMqQ3/bHJy7D6OGXvx/MMc4IqBn/X0fcM1QUcAItpZrBEYhWGem+tzXH90c+G01ypMcYJBO9Y30203g==", + "license": "MIT", "dependencies": { "bytes": "3.1.2", "content-type": "~1.0.5", @@ -1238,7 +1245,7 @@ "http-errors": "2.0.0", "iconv-lite": "0.4.24", "on-finished": "2.4.1", - "qs": "6.11.0", + "qs": "6.13.0", "raw-body": "2.5.2", "type-is": "~1.6.18", "unpipe": "1.0.0" @@ -1322,16 +1329,27 @@ "node": ">= 0.8" } }, - "node_modules/call-bind": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.7.tgz", - "integrity": "sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==", + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", "dependencies": { - "es-define-property": "^1.0.0", "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "set-function-length": "^1.2.1" + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" }, "engines": { "node": ">= 0.4" @@ -1468,9 +1486,10 @@ } }, "node_modules/cookie": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.6.0.tgz", - "integrity": "sha512-U71cyTamuh1CRNCfpGY6to28lxvNwPG4Guz/EVjgf3Jmzv0vlDp1atT9eS5dDjMYHucpHbWns6Lwf3BKz6svdw==", + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.1.tgz", + "integrity": "sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -1519,22 +1538,6 @@ "ms": "2.0.0" } }, - "node_modules/define-data-property": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.4.tgz", - "integrity": "sha512-rBMvIzlpA8v6E+SJZoo++HAYqsLrkg7MSfIinMPFhmkorw7X+dOXVJQs+QT69zGkzMyfDnIMN2Wid1+NbL3T+A==", - "dependencies": { - "es-define-property": "^1.0.0", - "es-errors": "^1.3.0", - "gopd": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/define-lazy-prop": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz", @@ -1604,6 +1607,20 @@ "url": "https://dotenvx.com" } }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -1618,9 +1635,10 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", "engines": { "node": ">= 0.8" } @@ -1634,12 +1652,10 @@ } }, "node_modules/es-define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", - "integrity": "sha512-jxayLKShrEqqzJ0eumQbVhTYQM27CfT1T35+gCgDFoL82JLsXqTJ76zv6A0YLOgEnLUMvLzsDsGIrl8NFpT2gQ==", - "dependencies": { - "get-intrinsic": "^1.2.4" - }, + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", "engines": { "node": ">= 0.4" } @@ -1648,6 +1664,19 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, "engines": { "node": ">= 0.4" } @@ -1655,12 +1684,14 @@ "node_modules/escape-html": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==" + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" }, "node_modules/etag": { "version": "1.8.1", "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -1682,36 +1713,37 @@ } }, "node_modules/express": { - "version": "4.19.2", - "resolved": "https://registry.npmjs.org/express/-/express-4.19.2.tgz", - "integrity": "sha512-5T6nhjsT+EOMzuck8JjBHARTHfMht0POzlA60WV2pMD3gyXw2LZnZ+ueGdNxG+0calOJcWKbpFcuzLZ91YWq9Q==", + "version": "4.21.2", + "resolved": "https://registry.npmjs.org/express/-/express-4.21.2.tgz", + "integrity": "sha512-28HqgMZAmih1Czt9ny7qr6ek2qddF4FclbMzwhCREB6OFfH+rXAnuNCwo1/wFvrtbgsQDb4kSbX9de9lFbrXnA==", + "license": "MIT", "dependencies": { "accepts": "~1.3.8", "array-flatten": "1.1.1", - "body-parser": "1.20.2", + "body-parser": "1.20.3", "content-disposition": "0.5.4", "content-type": "~1.0.4", - "cookie": "0.6.0", + "cookie": "0.7.1", "cookie-signature": "1.0.6", "debug": "2.6.9", "depd": "2.0.0", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "etag": "~1.8.1", - "finalhandler": "1.2.0", + "finalhandler": "1.3.1", "fresh": "0.5.2", "http-errors": "2.0.0", - "merge-descriptors": "1.0.1", + "merge-descriptors": "1.0.3", "methods": "~1.1.2", "on-finished": "2.4.1", "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", + "path-to-regexp": "0.1.12", "proxy-addr": "~2.0.7", - "qs": "6.11.0", + "qs": "6.13.0", "range-parser": "~1.2.1", "safe-buffer": "5.2.1", - "send": "0.18.0", - "serve-static": "1.15.0", + "send": "0.19.0", + "serve-static": "1.16.2", "setprototypeof": "1.2.0", "statuses": "2.0.1", "type-is": "~1.6.18", @@ -1720,6 +1752,10 @@ }, "engines": { "node": ">= 0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/express-validator": { @@ -1747,12 +1783,13 @@ } }, "node_modules/finalhandler": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.2.0.tgz", - "integrity": "sha512-5uXcUVftlQMFnWC9qu/svkWv3GTd2PfUhK/3PLkYNAe7FbqJMt3515HaxE6eRL74GdsriiwujiawdaB1BpEISg==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.1.tgz", + "integrity": "sha512-6BN9trH7bp3qvnrRyzsBz+g3lZxTNZTbVO2EV1CS0WIcDbawYVdYvGflME/9QP0h0pYlCDBCTjYa9nZzMDpyxQ==", + "license": "MIT", "dependencies": { "debug": "2.6.9", - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "on-finished": "2.4.1", "parseurl": "~1.3.3", @@ -1807,6 +1844,7 @@ "version": "0.5.2", "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", "integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -1829,6 +1867,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -1843,15 +1882,21 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", - "integrity": "sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" }, "engines": { "node": ">= 0.4" @@ -1860,6 +1905,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -1873,11 +1931,12 @@ } }, "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dependencies": { - "get-intrinsic": "^1.1.3" + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" }, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -1892,32 +1951,11 @@ "node": ">=4" } }, - "node_modules/has-property-descriptors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.2.tgz", - "integrity": "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==", - "dependencies": { - "es-define-property": "^1.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-proto": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.3.tgz", - "integrity": "sha512-SJ1amZAJUiZS+PhsVLf5tGydlaVB8EdFpaSO4gmiUKUOxk8qzn5AIy4ZeJUmh22znIdk/uMAUT2pl3FxzVUH+Q==", - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -1929,6 +1967,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", "dependencies": { "function-bind": "^1.1.2" }, @@ -2317,6 +2356,15 @@ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, "node_modules/md5": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/md5/-/md5-2.3.0.tgz", @@ -2336,9 +2384,13 @@ } }, "node_modules/merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", + "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, "node_modules/methods": { "version": "1.1.2", @@ -2352,6 +2404,7 @@ "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "license": "MIT", "bin": { "mime": "cli.js" }, @@ -2513,9 +2566,10 @@ } }, "node_modules/object-inspect": { - "version": "1.13.2", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz", - "integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==", + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", "engines": { "node": ">= 0.4" }, @@ -2568,14 +2622,16 @@ "version": "1.3.3", "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", "engines": { "node": ">= 0.8" } }, "node_modules/path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==" + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.12.tgz", + "integrity": "sha512-RA1GjUVMnvYFxuqovrEqZoxxW5NUZqbwKtYz/Tt7nXerk0LbLblQmrsgdeOxV5SFHf0UDggjS/bSeOZwt1pmEQ==", + "license": "MIT" }, "node_modules/pg": { "version": "8.13.1", @@ -2721,13 +2777,14 @@ "dev": true }, "node_modules/prisma": { - "version": "5.19.1", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.19.1.tgz", - "integrity": "sha512-c5K9MiDaa+VAAyh1OiYk76PXOme9s3E992D7kvvIOhCrNsBQfy2mP2QAQtX0WNj140IgG++12kwZpYB9iIydNQ==", + "version": "5.22.0", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.22.0.tgz", + "integrity": "sha512-vtpjW3XuYCSnMsNVBjLMNkTj6OZbudcPPTPYHqX0CJfpcdWciI1dM8uHETwmDxxiqEwCIE6WvXucWUetJgfu/A==", "devOptional": true, "hasInstallScript": true, + "license": "Apache-2.0", "dependencies": { - "@prisma/engines": "5.19.1" + "@prisma/engines": "5.22.0" }, "bin": { "prisma": "build/index.js" @@ -2785,11 +2842,12 @@ } }, "node_modules/qs": { - "version": "6.11.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.0.tgz", - "integrity": "sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q==", + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.13.0.tgz", + "integrity": "sha512-+38qI9SOr8tfZ4QmJNplMUxqjbe7LKvvZgWdExBOmd+egZTtjLB67Gu0HRX3u/XOq7UU2Nx6nsjvS16Z9uwfpg==", + "license": "BSD-3-Clause", "dependencies": { - "side-channel": "^1.0.4" + "side-channel": "^1.0.6" }, "engines": { "node": ">=0.6" @@ -2802,6 +2860,7 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", "engines": { "node": ">= 0.6" } @@ -2923,9 +2982,10 @@ } }, "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", + "license": "MIT", "dependencies": { "debug": "2.6.9", "depd": "2.0.0", @@ -2945,41 +3005,36 @@ "node": ">= 0.8.0" } }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/send/node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" }, "node_modules/serve-static": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.15.0.tgz", - "integrity": "sha512-XGuRDNjXUijsUL0vl6nSD7cwURuzEgglbOaFuZM9g3kwDXOWVTck0jLzjPzGD+TazWbboZYu52/9/XPdUgne9g==", + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", + "license": "MIT", "dependencies": { - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.18.0" + "send": "0.19.0" }, "engines": { "node": ">= 0.8.0" } }, - "node_modules/set-function-length": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", - "integrity": "sha512-pgRc4hJ4/sNjWCSS9AmnS40x3bNMDTknHgL5UaMBTMyJnU90EgWh1Rz+MC9eFu4BuN/UwZjKQuY/1v3rM7HMfg==", - "dependencies": { - "define-data-property": "^1.1.4", - "es-errors": "^1.3.0", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", @@ -3024,14 +3079,69 @@ } }, "node_modules/side-channel": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.6.tgz", - "integrity": "sha512-fDW/EZ6Q9RiO8eFG8Hj+7u/oW+XrPTIChwCOM2+th2A6OblDtYYIpve9m+KvI9Z4C9qSEXlaGR6bTEYHReuglA==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", "dependencies": { - "call-bind": "^1.0.7", "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4", - "object-inspect": "^1.13.1" + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" }, "engines": { "node": ">= 0.4" diff --git a/ems/src/api/general/index.ts b/ems/src/api/general/index.ts index 513c61f..41e9492 100644 --- a/ems/src/api/general/index.ts +++ b/ems/src/api/general/index.ts @@ -3,6 +3,7 @@ import { tediousQuery } from '../../utils/tedious'; import { GeneralDB, GisDB } from '../../constants/db'; const router = express.Router() +// ✅ router.get('/regions/all', async (req: Request, res: Response) => { try { const result = await tediousQuery( @@ -16,6 +17,7 @@ router.get('/regions/all', async (req: Request, res: Response) => { } }) +// ✅ router.get('/districts/all', async (req: Request, res: Response) => { try { const { region_id } = req.query @@ -34,6 +36,7 @@ router.get('/districts/all', async (req: Request, res: Response) => { } }) +// ✅ router.get('/cities/all', async (req: Request, res: Response) => { try { const { offset, limit, search, id } = req.query @@ -54,6 +57,7 @@ router.get('/cities/all', async (req: Request, res: Response) => { } }) +// ✅ router.get('/types/all', async (req: Request, res: Response) => { try { const result = await tediousQuery( @@ -68,6 +72,7 @@ router.get('/types/all', async (req: Request, res: Response) => { } }) +// ✅ router.get('/objects/all', async (req: Request, res: Response) => { try { const { offset, limit, city_id } = req.query @@ -87,31 +92,13 @@ router.get('/objects/all', async (req: Request, res: Response) => { } }) +// ✅ router.get('/objects/list', async (req: Request, res: Response) => { try { const { city_id, year, planning, type } = req.query if (type) { const result = await tediousQuery( - // ` - // SELECT - // * - // FROM - // vObjects - // WHERE - // vObjects.id_city = ${city_id} - // AND vObjects.year = ${year} - // AND type = ${type} - // AND - // ( - // CASE - // WHEN TRY_CAST(vObjects.planning AS BIT) IS NOT NULL THEN TRY_CAST(vObjects.planning AS BIT) - // WHEN vObjects.planning = 'TRUE' THEN 1 - // WHEN vObjects.planning = 'FALSE' THEN 0 - // ELSE NULL - // END - // ) = ${planning}; - // ` ` WITH cte_split(type_id, split_value, caption_params) AS ( @@ -226,6 +213,7 @@ router.get('/objects/:id([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F } }) +// ✅ router.get('/values/all', async (req: Request, res: Response) => { try { const { object_id } = req.query @@ -257,6 +245,7 @@ router.get('/values/all', async (req: Request, res: Response) => { } }) +// ✅ router.get('/params/all', async (req: Request, res: Response) => { try { const { param_id } = req.query @@ -289,6 +278,7 @@ const tcbParamQuery = (vtable: string, id_city: string) => { } } +// ✅ // Get value from TCB parameter router.get('/params/tcb', async (req: Request, res: Response) => { try { @@ -323,6 +313,7 @@ router.get('/params/tcb', async (req: Request, res: Response) => { } }) +// ✅ router.get('/search/objects', async (req: Request, res: Response) => { try { const { q, id_city, year } = req.query diff --git a/ems/src/api/gis/index.ts b/ems/src/api/gis/index.ts index 8537ad9..a456d80 100644 --- a/ems/src/api/gis/index.ts +++ b/ems/src/api/gis/index.ts @@ -2,8 +2,22 @@ import express, { Request, Response } from 'express'; import { tediousQuery } from '../../utils/tedious'; import { GeneralDB, GisDB } from '../../constants/db'; import { pgQuery } from '../../utils/postgres'; + const router = express.Router() +router.get('/migrate/lines', async (req: Request, res: Response) => { + try { + const result = await tediousQuery( + ` + SELECT * FROM ${GisDB}..lines + ` + ) + } catch (error) { + res.status(500) + } +}) + +// ✅ router.get('/type-roles', async (req: Request, res: Response) => { try { const result = await tediousQuery( @@ -17,13 +31,15 @@ router.get('/type-roles', async (req: Request, res: Response) => { } }) + +// ✅ router.get('/bounds/:entity_type', async (req: Request, res: Response) => { try { const { entity_type } = req.params const result = await pgQuery( ` - SELECT * FROM bounds + SELECT entity_id, entity_type, ST_AsGeoJSON(geometry)::JSON AS geometry FROM bounds WHERE entity_type = $1 `, [entity_type] @@ -31,7 +47,7 @@ router.get('/bounds/:entity_type', async (req: Request, res: Response) => { if (Array.isArray(result)) { if (result.length > 0) { - const geometries = result.map((bound: { id: number, entity_id: number, entity_type: string, geometry: JSON, published_at: string, deleted_at: string | null }) => { + const geometries = result.map((bound: { id: string, entity_id: number, entity_type: string, geometry: JSON, published_at: string, deleted_at: string | null }) => { return { ...bound.geometry, properties: { @@ -54,14 +70,15 @@ router.get('/bounds/:entity_type', async (req: Request, res: Response) => { } }) +// ✅ router.get('/bounds/:entity_type/:entity_id', async (req: Request, res: Response) => { try { const { entity_type, entity_id } = req.params const result = await pgQuery( ` - SELECT * FROM bounds - WHERE entity_type = $1 + SELECT entity_id, entity_type, ST_AsGeoJSON(geometry)::JSON AS geometry FROM bounds + WHERE entity_type = $1 AND entity_id = $2 `, [entity_type, entity_id] @@ -81,6 +98,7 @@ router.get('/bounds/:entity_type/:entity_id', async (req: Request, res: Response } }) +// ✅ router.get('/images/all', async (req: Request, res: Response) => { try { const { offset, limit, city_id } = req.query @@ -100,7 +118,7 @@ router.get('/images/all', async (req: Request, res: Response) => { } }) - +// ✅ // Get figures by year and city id router.get('/figures/all', async (req: Request, res: Response) => { try { @@ -121,6 +139,7 @@ router.get('/figures/all', async (req: Request, res: Response) => { } }) +// ✅ // Get lines by year and city id router.get('/lines/all', async (req: Request, res: Response) => { try { @@ -138,6 +157,7 @@ router.get('/lines/all', async (req: Request, res: Response) => { } }) +// ✅ router.get('/regions/borders', async (req: Request, res: Response) => { try { const result = await tediousQuery(