first commit
8
.idea/.gitignore
generated
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
8
.idea/modules.xml
generated
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/yantar.iml" filepath="$PROJECT_DIR$/.idea/yantar.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
7
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/backend" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$/frontend" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
12
.idea/yantar.iml
generated
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
176
backend/.gitignore
vendored
Normal file
@ -0,0 +1,176 @@
|
||||
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
|
||||
|
||||
# Logs
|
||||
|
||||
logs
|
||||
_.log
|
||||
npm-debug.log_
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# Caches
|
||||
|
||||
.cache
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
|
||||
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
|
||||
|
||||
# Runtime data
|
||||
|
||||
pids
|
||||
_.pid
|
||||
_.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# Snowpack dependency directory (https://snowpack.dev/)
|
||||
|
||||
web_modules/
|
||||
|
||||
# TypeScript cache
|
||||
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
|
||||
.eslintcache
|
||||
|
||||
# Optional stylelint cache
|
||||
|
||||
.stylelintcache
|
||||
|
||||
# Microbundle cache
|
||||
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variable files
|
||||
|
||||
.env
|
||||
.env.development.local
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
.env.local
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
|
||||
.parcel-cache
|
||||
|
||||
# Next.js build output
|
||||
|
||||
.next
|
||||
out
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
|
||||
.vuepress/dist
|
||||
|
||||
# vuepress v2.x temp and cache directory
|
||||
|
||||
.temp
|
||||
|
||||
# Docusaurus cache and generated files
|
||||
|
||||
.docusaurus
|
||||
|
||||
# Serverless directories
|
||||
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
|
||||
.vscode-test
|
||||
|
||||
# yarn v2
|
||||
|
||||
.yarn/cache
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
# IntelliJ based IDEs
|
||||
.idea
|
||||
|
||||
# Finder (MacOS) folder config
|
||||
.DS_Store
|
||||
db.sqlite
|
||||
24
backend/Dockerfile
Normal file
@ -0,0 +1,24 @@
|
||||
FROM debian:bullseye-slim
|
||||
|
||||
# Обновляем apt-get и устанавливаем зависимости: curl, git, bash, unzip
|
||||
RUN apt-get update && \
|
||||
apt-get install -y curl git bash unzip python3 build-essential && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
||||
ENV PYTHON=/usr/bin/python3
|
||||
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
# Устанавливаем Bun через официальный скрипт (использует bash и unzip)
|
||||
RUN curl -fsSL https://bun.sh/install | bash
|
||||
|
||||
# Добавляем Bun в PATH (Bun обычно устанавливается в /root/.bun)
|
||||
ENV PATH="/root/.bun/bin:${PATH}"
|
||||
|
||||
# Устанавливаем зависимости проекта через Bun
|
||||
RUN bun install
|
||||
|
||||
EXPOSE 3030
|
||||
CMD ["bun", "index.ts"]
|
||||
15
backend/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
# bun-api
|
||||
|
||||
To install dependencies:
|
||||
|
||||
```bash
|
||||
bun install
|
||||
```
|
||||
|
||||
To run:
|
||||
|
||||
```bash
|
||||
bun run index.ts
|
||||
```
|
||||
|
||||
This project was created using `bun init` in bun v1.1.27. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
||||
BIN
backend/bun.lockb
Normal file
3
backend/docker-compose.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
services:
|
||||
yantar_backend:
|
||||
image: yantar_backend:1.0.00.0
|
||||
26
backend/index.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import { Elysia } from 'elysia';
|
||||
import { cors } from '@elysiajs/cors';
|
||||
import { runMigrations, runSeeders } from './src/db/migrations';
|
||||
import { errorResolveRoutes } from './src/endpoints/errorResolve';
|
||||
import { errorsRoutes } from './src/endpoints/errors';
|
||||
import { sensorDetailsRoutes } from './src/endpoints/sensorDetails';
|
||||
import { sensorsRoutes } from './src/endpoints/sensors';
|
||||
|
||||
runMigrations();
|
||||
runSeeders();
|
||||
|
||||
const app = new Elysia()
|
||||
.use(cors())
|
||||
.group("/api/v2", (group) => {
|
||||
sensorsRoutes(group as any);
|
||||
errorsRoutes(group as any);
|
||||
errorResolveRoutes(group as any);
|
||||
sensorDetailsRoutes(group as any);
|
||||
return group;
|
||||
})
|
||||
.listen(3030);
|
||||
|
||||
console.log(`Server running on http://localhost:3030`);
|
||||
|
||||
// Импортируем periodicUpdates как побочный эффект:
|
||||
import "./src/periodicUpdates";
|
||||
545
backend/package-lock.json
generated
Normal file
@ -0,0 +1,545 @@
|
||||
{
|
||||
"name": "bun-api",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "bun-api",
|
||||
"dependencies": {
|
||||
"@elysiajs/cors": "^1.2.0",
|
||||
"better-sqlite3": "^11.8.1",
|
||||
"elysia": "^1.2.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/better-sqlite3": "^7.6.12",
|
||||
"@types/bun": "latest"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@elysiajs/cors": {
|
||||
"version": "1.2.0",
|
||||
"license": "MIT",
|
||||
"peerDependencies": {
|
||||
"elysia": ">= 1.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@sinclair/typebox": {
|
||||
"version": "0.34.15",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@types/better-sqlite3": {
|
||||
"version": "7.6.12",
|
||||
"resolved": "https://registry.npmjs.org/@types/better-sqlite3/-/better-sqlite3-7.6.12.tgz",
|
||||
"integrity": "sha512-fnQmj8lELIj7BSrZQAdBMHEHX8OZLYIHXqAKT1O7tDfLxaINzf00PMjw22r3N/xXh0w/sGHlO6SVaCQ2mj78lg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/bun": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/bun/-/bun-1.2.3.tgz",
|
||||
"integrity": "sha512-054h79ipETRfjtsCW9qJK8Ipof67Pw9bodFWmkfkaUaRiIQ1dIV2VTlheshlBx3mpKr0KeK8VqnMMCtgN9rQtw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"bun-types": "1.2.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "22.13.5",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.5.tgz",
|
||||
"integrity": "sha512-+lTU0PxZXn0Dr1NBtC7Y8cR21AJr87dLLU953CWA6pMxxv/UDc7jYAY90upcrie1nRcD6XNG5HOYEDtgW5TxAg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~6.20.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/ws": {
|
||||
"version": "8.5.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.14.tgz",
|
||||
"integrity": "sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
"integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/better-sqlite3": {
|
||||
"version": "11.8.1",
|
||||
"resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-11.8.1.tgz",
|
||||
"integrity": "sha512-9BxNaBkblMjhJW8sMRZxnxVTRgbRmssZW0Oxc1MPBTfiR+WW21e2Mk4qu8CzrcZb1LwPCnFsfDEzq+SNcBU8eg==",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"bindings": "^1.5.0",
|
||||
"prebuild-install": "^7.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/bindings": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
|
||||
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
|
||||
"dependencies": {
|
||||
"file-uri-to-path": "1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/bl": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz",
|
||||
"integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==",
|
||||
"dependencies": {
|
||||
"buffer": "^5.5.0",
|
||||
"inherits": "^2.0.4",
|
||||
"readable-stream": "^3.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
"integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"base64-js": "^1.3.1",
|
||||
"ieee754": "^1.1.13"
|
||||
}
|
||||
},
|
||||
"node_modules/bun-types": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/bun-types/-/bun-types-1.2.3.tgz",
|
||||
"integrity": "sha512-P7AeyTseLKAvgaZqQrvp3RqFM3yN9PlcLuSTe7SoJOfZkER73mLdT2vEQi8U64S1YvM/ldcNiQjn0Sn7H9lGgg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@types/node": "*",
|
||||
"@types/ws": "~8.5.10"
|
||||
}
|
||||
},
|
||||
"node_modules/chownr": {
|
||||
"version": "1.1.4",
|
||||
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz",
|
||||
"integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg=="
|
||||
},
|
||||
"node_modules/cookie": {
|
||||
"version": "1.0.2",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/decompress-response": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz",
|
||||
"integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==",
|
||||
"dependencies": {
|
||||
"mimic-response": "^3.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/deep-extend": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
|
||||
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
|
||||
"engines": {
|
||||
"node": ">=4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/detect-libc": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.3.tgz",
|
||||
"integrity": "sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/elysia": {
|
||||
"version": "1.2.12",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@sinclair/typebox": "^0.34.15",
|
||||
"cookie": "^1.0.2",
|
||||
"memoirist": "^0.3.0",
|
||||
"openapi-types": "^12.1.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@sinclair/typebox": ">= 0.34.0",
|
||||
"openapi-types": ">= 12.0.0",
|
||||
"typescript": ">= 5.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"openapi-types": {
|
||||
"optional": true
|
||||
},
|
||||
"typescript": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/end-of-stream": {
|
||||
"version": "1.4.4",
|
||||
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
|
||||
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
|
||||
"dependencies": {
|
||||
"once": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/expand-template": {
|
||||
"version": "2.0.3",
|
||||
"resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz",
|
||||
"integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==",
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/file-uri-to-path": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
|
||||
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
|
||||
},
|
||||
"node_modules/fs-constants": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz",
|
||||
"integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow=="
|
||||
},
|
||||
"node_modules/github-from-package": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz",
|
||||
"integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw=="
|
||||
},
|
||||
"node_modules/ieee754": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
|
||||
"integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/inherits": {
|
||||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
},
|
||||
"node_modules/ini": {
|
||||
"version": "1.3.8",
|
||||
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
|
||||
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
|
||||
},
|
||||
"node_modules/memoirist": {
|
||||
"version": "0.3.0",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/mimic-response": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz",
|
||||
"integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
|
||||
"integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/mkdirp-classic": {
|
||||
"version": "0.5.3",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
|
||||
"integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A=="
|
||||
},
|
||||
"node_modules/napi-build-utils": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-2.0.0.tgz",
|
||||
"integrity": "sha512-GEbrYkbfF7MoNaoh2iGG84Mnf/WZfB0GdGEsM8wz7Expx/LlWf5U8t9nvJKXSp3qr5IsEbK04cBGhol/KwOsWA=="
|
||||
},
|
||||
"node_modules/node-abi": {
|
||||
"version": "3.74.0",
|
||||
"resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.74.0.tgz",
|
||||
"integrity": "sha512-c5XK0MjkGBrQPGYG24GBADZud0NCbznxNx0ZkS+ebUTrmV1qTDxPxSL8zEAPURXSbLRWVexxmP4986BziahL5w==",
|
||||
"dependencies": {
|
||||
"semver": "^7.3.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||
"dependencies": {
|
||||
"wrappy": "1"
|
||||
}
|
||||
},
|
||||
"node_modules/openapi-types": {
|
||||
"version": "12.1.3",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/prebuild-install": {
|
||||
"version": "7.1.3",
|
||||
"resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.3.tgz",
|
||||
"integrity": "sha512-8Mf2cbV7x1cXPUILADGI3wuhfqWvtiLA1iclTDbFRZkgRQS0NqsPZphna9V+HyTEadheuPmjaJMsbzKQFOzLug==",
|
||||
"dependencies": {
|
||||
"detect-libc": "^2.0.0",
|
||||
"expand-template": "^2.0.3",
|
||||
"github-from-package": "0.0.0",
|
||||
"minimist": "^1.2.3",
|
||||
"mkdirp-classic": "^0.5.3",
|
||||
"napi-build-utils": "^2.0.0",
|
||||
"node-abi": "^3.3.0",
|
||||
"pump": "^3.0.0",
|
||||
"rc": "^1.2.7",
|
||||
"simple-get": "^4.0.0",
|
||||
"tar-fs": "^2.0.0",
|
||||
"tunnel-agent": "^0.6.0"
|
||||
},
|
||||
"bin": {
|
||||
"prebuild-install": "bin.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/pump": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.2.tgz",
|
||||
"integrity": "sha512-tUPXtzlGM8FE3P0ZL6DVs/3P58k9nk8/jZeQCurTJylQA8qFYzHFfhBJkuqyE0FifOsQ0uKWekiZ5g8wtr28cw==",
|
||||
"dependencies": {
|
||||
"end-of-stream": "^1.1.0",
|
||||
"once": "^1.3.1"
|
||||
}
|
||||
},
|
||||
"node_modules/rc": {
|
||||
"version": "1.2.8",
|
||||
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
|
||||
"integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
|
||||
"dependencies": {
|
||||
"deep-extend": "^0.6.0",
|
||||
"ini": "~1.3.0",
|
||||
"minimist": "^1.2.0",
|
||||
"strip-json-comments": "~2.0.1"
|
||||
},
|
||||
"bin": {
|
||||
"rc": "cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/readable-stream": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
|
||||
"integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
|
||||
"dependencies": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/safe-buffer": {
|
||||
"version": "5.2.1",
|
||||
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.7.1",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz",
|
||||
"integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==",
|
||||
"bin": {
|
||||
"semver": "bin/semver.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/simple-concat": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz",
|
||||
"integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
]
|
||||
},
|
||||
"node_modules/simple-get": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz",
|
||||
"integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/feross"
|
||||
},
|
||||
{
|
||||
"type": "patreon",
|
||||
"url": "https://www.patreon.com/feross"
|
||||
},
|
||||
{
|
||||
"type": "consulting",
|
||||
"url": "https://feross.org/support"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"decompress-response": "^6.0.0",
|
||||
"once": "^1.3.1",
|
||||
"simple-concat": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
"integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "~5.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/strip-json-comments": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
|
||||
"integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tar-fs": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.2.tgz",
|
||||
"integrity": "sha512-EsaAXwxmx8UB7FRKqeozqEPop69DXcmYwTQwXvyAPF352HJsPdkVhvTaDPYqfNgruveJIJy3TA2l+2zj8LJIJA==",
|
||||
"dependencies": {
|
||||
"chownr": "^1.1.1",
|
||||
"mkdirp-classic": "^0.5.2",
|
||||
"pump": "^3.0.0",
|
||||
"tar-stream": "^2.1.4"
|
||||
}
|
||||
},
|
||||
"node_modules/tar-stream": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz",
|
||||
"integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==",
|
||||
"dependencies": {
|
||||
"bl": "^4.0.3",
|
||||
"end-of-stream": "^1.4.1",
|
||||
"fs-constants": "^1.0.0",
|
||||
"inherits": "^2.0.3",
|
||||
"readable-stream": "^3.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/tunnel-agent": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
||||
"integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.7.3",
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/undici-types": {
|
||||
"version": "6.20.0",
|
||||
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz",
|
||||
"integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
|
||||
},
|
||||
"node_modules/wrappy": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
|
||||
"integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ=="
|
||||
}
|
||||
}
|
||||
}
|
||||
17
backend/package.json
Normal file
@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "bun-api",
|
||||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@types/better-sqlite3": "^7.6.12",
|
||||
"@types/bun": "latest"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "^5.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@elysiajs/cors": "^1.2.0",
|
||||
"better-sqlite3": "^11.8.1",
|
||||
"elysia": "^1.2.12"
|
||||
}
|
||||
}
|
||||
4
backend/src/db/database.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import { Database } from "bun:sqlite";
|
||||
|
||||
const db = new Database("db.sqlite");
|
||||
export default db;
|
||||
94
backend/src/db/migrations.ts
Normal file
@ -0,0 +1,94 @@
|
||||
import type { SensorCount } from '../interfaces/SensorRow';
|
||||
import db from './database';
|
||||
|
||||
|
||||
export function runMigrations(): void {
|
||||
db.exec(`
|
||||
CREATE TABLE IF NOT EXISTS sensors (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
connect_time TEXT,
|
||||
isServicing BOOLEAN,
|
||||
name TEXT UNIQUE,
|
||||
position TEXT,
|
||||
quality TEXT,
|
||||
tag TEXT,
|
||||
value INTEGER,
|
||||
zone TEXT
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS errors (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
sensor_id INTEGER,
|
||||
alarmCode INTEGER,
|
||||
description TEXT,
|
||||
timestamp TEXT,
|
||||
FOREIGN KEY(sensor_id) REFERENCES sensors(id)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS sensor_details (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
sensor_id INTEGER UNIQUE,
|
||||
description TEXT,
|
||||
FOREIGN KEY(sensor_id) REFERENCES sensors(id)
|
||||
);
|
||||
`);
|
||||
}
|
||||
|
||||
export function runSeeders(): void {
|
||||
const sensorsCount = (db.prepare('SELECT COUNT(*) as count FROM sensors').get() as SensorCount).count;
|
||||
if (sensorsCount === 0) {
|
||||
const insertSensor = db.prepare(`
|
||||
INSERT INTO sensors (connect_time, isServicing, name, position, quality, tag, value, zone)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
`);
|
||||
// Вставляем только нужные датчики
|
||||
insertSensor.run("01.02.2025 07:20", false, "Аспирационная установка 6 на конвейере поз. 73", " ", "0x000000C0", "SIEMENSPLC.ZG02.Area I.inAU5aRun", 1, null);
|
||||
insertSensor.run("03.02.2025 08:09", false, "Питатель поз. 1", " ", "0x000000C0", "SIEMENSPLC.AZG01.Area I.inPos1Run", 1, null);
|
||||
insertSensor.run("03.02.2025 08:09", false, "Дробилка поз. 9", " ", "0x000000C0", "SIEMENSPLC.AZG01.Area I.inPos9Run", 0, null);
|
||||
insertSensor.run("03.02.2025 08:09", false, "Грохот поз. 12", " ", "0x000000C0", "SIEMENSPLC.AZG01.Area I.inPos12Run", 1, null);
|
||||
insertSensor.run("03.02.2025 08:09", false, "Конвейер поз. 14", " ", "0x000000C0", "SIEMENSPLC.AZG01.Area I.inPos14DKS", 1, null);
|
||||
insertSensor.run("03.02.2025 08:09", false, "Конвейер поз. 13", " ", "0x000000C0", "SIEMENSPLC.AZG01.Area I.inPos13DKS", 1, null);
|
||||
insertSensor.run("03.02.2025 08:09", false, "Конвейер поз. 4", " ", "0x000000C0", "SIEMENSPLC.AZG01.Area I.inPos4DKS", 1, null);
|
||||
}
|
||||
|
||||
const detailsCount = (db.prepare('SELECT COUNT(*) as count FROM sensor_details').get() as SensorCount).count;
|
||||
if (detailsCount === 0) {
|
||||
const insertDetail = db.prepare(`
|
||||
INSERT INTO sensor_details (sensor_id, description)
|
||||
VALUES (?, ?)
|
||||
`);
|
||||
const getSensorId = (name: string): number | undefined => {
|
||||
const row = db.prepare("SELECT id FROM sensors WHERE name = ?").get(name) as { id: number } | undefined;
|
||||
return row?.id;
|
||||
};
|
||||
|
||||
let sensorId = getSensorId("Аспирационная установка 6 на конвейере поз. 73");
|
||||
if (sensorId !== undefined) {
|
||||
insertDetail.run(sensorId, "Описание: Аспирационная установка 6 на конвейере поз. 73. Основные характеристики...");
|
||||
}
|
||||
sensorId = getSensorId("Питатель поз. 1");
|
||||
if (sensorId !== undefined) {
|
||||
insertDetail.run(sensorId, "Описание: Питатель поз. 1. Основные характеристики...");
|
||||
}
|
||||
sensorId = getSensorId("Дробилка поз. 9");
|
||||
if (sensorId !== undefined) {
|
||||
insertDetail.run(sensorId, "Описание: Дробилка поз. 9. Основные характеристики...");
|
||||
}
|
||||
sensorId = getSensorId("Грохот поз. 12");
|
||||
if (sensorId !== undefined) {
|
||||
insertDetail.run(sensorId, "Описание: Грохот поз. 12. Основные характеристики...");
|
||||
}
|
||||
sensorId = getSensorId("Конвейер поз. 14");
|
||||
if (sensorId !== undefined) {
|
||||
insertDetail.run(sensorId, "Описание: Конвейер поз. 14. Основные характеристики...");
|
||||
}
|
||||
sensorId = getSensorId("Конвейер поз. 13");
|
||||
if (sensorId !== undefined) {
|
||||
insertDetail.run(sensorId, "Описание: Конвейер поз. 13. Основные характеристики...");
|
||||
}
|
||||
sensorId = getSensorId("Конвейер поз. 4");
|
||||
if (sensorId !== undefined) {
|
||||
insertDetail.run(sensorId, "Описание: Конвейер поз. 4. Основные характеристики...");
|
||||
}
|
||||
}
|
||||
}
|
||||
29
backend/src/endpoints/errorResolve.ts
Normal file
@ -0,0 +1,29 @@
|
||||
import db from '../db/database';
|
||||
|
||||
import { Elysia } from 'elysia';
|
||||
import type { SensorRow } from '../interfaces/SensorRow';
|
||||
|
||||
export function errorResolveRoutes(group: Elysia): Elysia {
|
||||
return group.post("/errors/resolve", async ({ request }) => {
|
||||
const { sensorName, alarmCode } = await request.json() as { sensorName: string; alarmCode?: number };
|
||||
|
||||
const sensor = db.prepare("SELECT * FROM sensors WHERE name = ?").get(sensorName) as SensorRow | undefined;
|
||||
if (!sensor) {
|
||||
return { error: `Оборудование с именем ${sensorName} не найдено` };
|
||||
}
|
||||
|
||||
if (alarmCode !== undefined) {
|
||||
db.prepare(`
|
||||
DELETE FROM errors WHERE sensor_id = ? AND alarmCode = ?
|
||||
`).run(sensor.id, alarmCode);
|
||||
} else {
|
||||
db.prepare(`
|
||||
DELETE FROM errors WHERE sensor_id = ?
|
||||
`).run(sensor.id);
|
||||
}
|
||||
if (sensor.value === 2) {
|
||||
db.prepare("UPDATE sensors SET value = 0 WHERE id = ?").run(sensor.id);
|
||||
}
|
||||
return { message: "Ошибка успешно снята" };
|
||||
});
|
||||
}
|
||||
30
backend/src/endpoints/errors.ts
Normal file
@ -0,0 +1,30 @@
|
||||
import db from '../db/database';
|
||||
|
||||
import { Elysia } from 'elysia';
|
||||
import type { ErrorRow } from '../interfaces/ErrorRow';
|
||||
|
||||
export function errorsRoutes(group: Elysia): Elysia {
|
||||
return group.get("/errors", () => {
|
||||
const errorsRows = db.prepare(`
|
||||
SELECT e.id, e.sensor_id, e.alarmCode, e.description, e.timestamp, s.name as sensor_name
|
||||
FROM errors e
|
||||
JOIN sensors s ON s.id = e.sensor_id
|
||||
`).all() as (ErrorRow & { sensor_name: string })[];
|
||||
|
||||
const groupedErrors = errorsRows.reduce<Record<string, { alarmCode: number; description: string; timestamp: string }[]>>(
|
||||
(acc, curr) => {
|
||||
if (!acc[curr.sensor_name]) {
|
||||
acc[curr.sensor_name] = [];
|
||||
}
|
||||
acc[curr.sensor_name].push({
|
||||
alarmCode: curr.alarmCode,
|
||||
description: curr.description,
|
||||
timestamp: curr.timestamp
|
||||
});
|
||||
return acc;
|
||||
},
|
||||
{}
|
||||
);
|
||||
return groupedErrors;
|
||||
});
|
||||
}
|
||||
20
backend/src/endpoints/sensorDetails.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import db from '../db/database';
|
||||
|
||||
import { Elysia } from 'elysia';
|
||||
import type { SensorDetail } from '../interfaces/SensorDetail';
|
||||
|
||||
export function sensorDetailsRoutes(group: Elysia): Elysia {
|
||||
return group.get("/sensor-details/:sensorName", ({ params }) => {
|
||||
const sensorName = params.sensorName;
|
||||
const detail = db.prepare(`
|
||||
SELECT sd.id, s.name, sd.description
|
||||
FROM sensor_details sd
|
||||
JOIN sensors s ON s.id = sd.sensor_id
|
||||
WHERE s.name = ?
|
||||
`).get(sensorName) as (SensorDetail & { name: string }) | undefined;
|
||||
if (!detail) {
|
||||
return { error: `Описание для оборудования '${sensorName}' не найдено.` };
|
||||
}
|
||||
return detail;
|
||||
});
|
||||
}
|
||||
17
backend/src/endpoints/sensors.ts
Normal file
@ -0,0 +1,17 @@
|
||||
import db from '../db/database';
|
||||
|
||||
import { Elysia } from 'elysia';
|
||||
import type { SensorRow } from '../interfaces/SensorRow';
|
||||
|
||||
|
||||
export function sensorsRoutes(group: Elysia<any>): Elysia<any> {
|
||||
return group.get("/sensors", () => {
|
||||
const sensors = db.prepare("SELECT * FROM sensors").all() as SensorRow[];
|
||||
return {
|
||||
error: "",
|
||||
items: sensors,
|
||||
status: 0,
|
||||
total: sensors.length
|
||||
};
|
||||
});
|
||||
}
|
||||
8
backend/src/interfaces/ErrorRow.ts
Normal file
@ -0,0 +1,8 @@
|
||||
export interface ErrorRow {
|
||||
id: number;
|
||||
sensor_id: number;
|
||||
alarmCode: number;
|
||||
description: string;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
6
backend/src/interfaces/SensorDetail.ts
Normal file
@ -0,0 +1,6 @@
|
||||
export interface SensorDetail {
|
||||
id: number;
|
||||
sensor_id: number;
|
||||
description: string;
|
||||
}
|
||||
|
||||
16
backend/src/interfaces/SensorRow.ts
Normal file
@ -0,0 +1,16 @@
|
||||
export interface SensorRow {
|
||||
id: number;
|
||||
connect_time: string;
|
||||
isServicing: boolean;
|
||||
name: string;
|
||||
position: string;
|
||||
quality: string;
|
||||
tag: string;
|
||||
value: number;
|
||||
zone: string | null;
|
||||
}
|
||||
|
||||
export interface SensorCount {
|
||||
count: number;
|
||||
}
|
||||
|
||||
84
backend/src/periodicUpdates.ts
Normal file
@ -0,0 +1,84 @@
|
||||
import db from './db/database';
|
||||
import type { SensorCount, SensorRow } from './interfaces/SensorRow';
|
||||
|
||||
|
||||
const updateInterval = 30000; // 30 секунд
|
||||
|
||||
// Периодическое обновление аварийного состояния:
|
||||
setInterval(() => {
|
||||
const currentCount = (db.prepare("SELECT COUNT(*) as count FROM sensors WHERE value = 2").get() as SensorCount).count;
|
||||
if (currentCount >= 3) {
|
||||
console.log("Максимальное количество датчиков с аварийным состоянием уже достигнуто.");
|
||||
return;
|
||||
}
|
||||
|
||||
const availableSensors = db.prepare("SELECT * FROM sensors WHERE value != 2").all() as SensorRow[];
|
||||
if (availableSensors.length === 0) return;
|
||||
|
||||
const maxToUpdate = Math.min(3 - currentCount, availableSensors.length);
|
||||
const countToUpdate = Math.floor(Math.random() * maxToUpdate) + 1;
|
||||
|
||||
const selectedSensors: SensorRow[] = [];
|
||||
while (selectedSensors.length < countToUpdate) {
|
||||
const randomIndex = Math.floor(Math.random() * availableSensors.length);
|
||||
const sensor = availableSensors[randomIndex];
|
||||
if (!selectedSensors.find(s => s.id === sensor.id)) {
|
||||
selectedSensors.push(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
const errorDescriptions = [
|
||||
"Перегрев системы.",
|
||||
"Ошибка датчика.",
|
||||
"Низкий уровень масла.",
|
||||
"Сбой питания.",
|
||||
"Перегрузка электросети."
|
||||
];
|
||||
const possibleAlarmCodes = [1, 2, 3];
|
||||
|
||||
selectedSensors.forEach(sensor => {
|
||||
db.prepare("UPDATE sensors SET value = 2 WHERE id = ?").run(sensor.id);
|
||||
const numErrors = Math.floor(Math.random() * 2) + 1;
|
||||
for (let i = 0; i < numErrors; i++) {
|
||||
const alarmCode = possibleAlarmCodes[Math.floor(Math.random() * possibleAlarmCodes.length)];
|
||||
const description = errorDescriptions[Math.floor(Math.random() * errorDescriptions.length)];
|
||||
const timestamp = new Date().toLocaleString("ru-RU");
|
||||
db.prepare("INSERT INTO errors (sensor_id, alarmCode, description, timestamp) VALUES (?, ?, ?, ?)")
|
||||
.run(sensor.id, alarmCode, description, timestamp);
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`Периодическое обновление: для ${countToUpdate} датчика(ов) установлено аварийное состояние и добавлены ошибки.`);
|
||||
}, updateInterval);
|
||||
|
||||
// Периодическое включение выключенных датчиков:
|
||||
setInterval(() => {
|
||||
const offSensors = db.prepare("SELECT * FROM sensors WHERE value = 0").all() as SensorRow[];
|
||||
const offCount = offSensors.length;
|
||||
if (offCount === 0) {
|
||||
console.log("Нет выключенных датчиков для обновления.");
|
||||
return;
|
||||
}
|
||||
|
||||
const maxToUpdate = Math.floor(offCount / 2);
|
||||
if (maxToUpdate < 1) {
|
||||
console.log("Слишком мало выключенных датчиков для обновления.");
|
||||
return;
|
||||
}
|
||||
|
||||
const countToUpdate = Math.floor(Math.random() * maxToUpdate) + 1;
|
||||
const selectedSensors: SensorRow[] = [];
|
||||
while (selectedSensors.length < countToUpdate) {
|
||||
const randomIndex = Math.floor(Math.random() * offSensors.length);
|
||||
const sensor = offSensors[randomIndex];
|
||||
if (!selectedSensors.find(s => s.id === sensor.id)) {
|
||||
selectedSensors.push(sensor);
|
||||
}
|
||||
}
|
||||
|
||||
selectedSensors.forEach(sensor => {
|
||||
db.prepare("UPDATE sensors SET value = 1 WHERE id = ?").run(sensor.id);
|
||||
});
|
||||
|
||||
console.log(`Периодическое обновление: для ${countToUpdate} выключенных датчика(ов) установлено состояние 'on' (value = 1).`);
|
||||
}, updateInterval);
|
||||
27
backend/tsconfig.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
// Enable latest features
|
||||
"lib": ["ESNext", "DOM"],
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleDetection": "force",
|
||||
"jsx": "react-jsx",
|
||||
"allowJs": true,
|
||||
|
||||
// Bundler mode
|
||||
"moduleResolution": "bundler",
|
||||
"allowImportingTsExtensions": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"noEmit": true,
|
||||
|
||||
// Best practices
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
|
||||
// Some stricter flags (disabled by default)
|
||||
"noUnusedLocals": false,
|
||||
"noUnusedParameters": false,
|
||||
"noPropertyAccessFromIndexSignature": false
|
||||
}
|
||||
}
|
||||
19
docker-compose.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
services:
|
||||
backend:
|
||||
container_name: backend
|
||||
build: ./backend/
|
||||
ports:
|
||||
- '3030:3030'
|
||||
depends_on:
|
||||
nginx:
|
||||
condition: service_healthy
|
||||
restart: always
|
||||
|
||||
nginx:
|
||||
container_name: ui-web
|
||||
image: nginx:latest
|
||||
ports:
|
||||
- "3031:80"
|
||||
volumes:
|
||||
- ./frontend/code:/usr/share/nginx/html
|
||||
restart: always
|
||||
1
frontend/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.idea
|
||||
4
frontend/README.md
Normal file
@ -0,0 +1,4 @@
|
||||
[Документация по спидометру ](https://jscharting.com/examples/chart-types/circular-gauge/)
|
||||
Пример находится в [файле gauge.html](code/gauge.html)
|
||||
|
||||
Поля ввода находятся в [файле index.html](code/index.html)
|
||||
61
frontend/code/application.js
Normal file
@ -0,0 +1,61 @@
|
||||
System.register([], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
var cc, Application;
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
||||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
||||
return {
|
||||
setters: [],
|
||||
execute: function () {
|
||||
_export("Application", Application = /*#__PURE__*/function () {
|
||||
function Application() {
|
||||
_classCallCheck(this, Application);
|
||||
this.settingsPath = 'src/settings.json';
|
||||
this.showFPS = false;
|
||||
}
|
||||
_createClass(Application, [{
|
||||
key: "init",
|
||||
value: function init(engine) {
|
||||
cc = engine;
|
||||
cc.game.onPostBaseInitDelegate.add(this.onPostInitBase.bind(this));
|
||||
cc.game.onPostSubsystemInitDelegate.add(this.onPostSystemInit.bind(this));
|
||||
}
|
||||
}, {
|
||||
key: "onPostInitBase",
|
||||
value: function onPostInitBase() {
|
||||
// cc.settings.overrideSettings('assets', 'server', '');
|
||||
// do custom logic
|
||||
}
|
||||
}, {
|
||||
key: "onPostSystemInit",
|
||||
value: function onPostSystemInit() {
|
||||
// do custom logic
|
||||
}
|
||||
}, {
|
||||
key: "start",
|
||||
value: function start() {
|
||||
return cc.game.init({
|
||||
debugMode: false ? cc.DebugMode.INFO : cc.DebugMode.ERROR,
|
||||
settingsPath: this.settingsPath,
|
||||
overrideSettings: {
|
||||
// assets: {
|
||||
// preloadBundles: [{ bundle: 'main', version: 'xxx' }],
|
||||
// }
|
||||
profiling: {
|
||||
showFPS: this.showFPS
|
||||
}
|
||||
}
|
||||
}).then(function () {
|
||||
return cc.game.run();
|
||||
});
|
||||
}
|
||||
}]);
|
||||
return Application;
|
||||
}());
|
||||
}
|
||||
};
|
||||
});
|
||||
1
frontend/code/assets/3d_models/config.json
Normal file
1
frontend/code/assets/3d_models/import/0a/0a53ee950.json
Normal file
@ -0,0 +1 @@
|
||||
[1,["c89m0XNRpI2qEsAhLShXXE","e2Y/hxG/5JJ4f+EuJgfHP4@b811d","e2Y/hxG/5JJ4f+EuJgfHP4@63096"],["_effectAsset","root","node","data","_mesh"],[["cc.Node",["_name","_prefab","_children","_parent","_components","_lpos"],2,4,2,1,9,5],["cc.Material",["_name","_props","_states","_defines"],-1],["cc.Prefab",["_name"],2],["cc.PrefabInfo",["fileId","instance","targetOverrides","nestedPrefabInstanceRoots","root","asset"],-1,1,1],["cc.MeshRenderer",["_shadowCastingMode","node","__prefab","_materials","bakeSettings","_mesh"],2,1,4,3,4,6],["cc.CompPrefabInfo",["fileId"],2],["cc.ModelBakeSettings",["_castShadow","_receiveShadow"],1]],[[3,0,1,2,3,4,5,5],[1,0,1,2,3,5],[2,0,2],[0,0,2,1,2],[0,0,3,4,1,5,2],[4,0,1,2,3,4,5,2],[5,0,2],[6,0,1,3]],[[[[1,"CT MATERIAL_A",[{"occlusion":0}],[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{}]]],0,0,[0],[0],[0]],[[[2,"73_collider"],[3,"73_collider",[-2],[0,"2awJwomwZV7Z9gTNZCgeTQ",null,null,null,-1,0]],[4,"UBX_DefaultRootName_001",1,[[5,1,-3,[6,"b6yTklyuVWYbY63yitocOd"],[0],[7,true,true],1]],[0,"5ctwZDSiVb26shLHihHeGy",null,null,null,1,0],[1,72.18412780761719,22.281278610229492,-38.93197250366211]]],0,[0,1,1,0,-1,2,0,2,2,0,3,1,3],[0,0],[-1,4],[1,2]]]]
|
||||
1
frontend/code/assets/3d_models/import/0c/0c0a498a0.json
Normal file
@ -0,0 +1 @@
|
||||
{"type":"cc.Texture2D","data":[["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@1f3c6"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@f1375"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@f1375"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@caddf"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@0ef36"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@f1375"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@d8bd3"]]]}
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
20
frontend/code/assets/3d_models/index.js
Normal file
@ -0,0 +1,20 @@
|
||||
System.register("chunks:///_virtual/3d_models",[],(function(){return{execute:function(){}}}));
|
||||
|
||||
(function(r) {
|
||||
r('virtual:///prerequisite-imports/3d_models', 'chunks:///_virtual/3d_models');
|
||||
})(function(mid, cid) {
|
||||
System.register(mid, [cid], function (_export, _context) {
|
||||
return {
|
||||
setters: [function(_m) {
|
||||
var _exportObj = {};
|
||||
|
||||
for (var _key in _m) {
|
||||
if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _m[_key];
|
||||
}
|
||||
|
||||
_export(_exportObj);
|
||||
}],
|
||||
execute: function () { }
|
||||
};
|
||||
});
|
||||
});
|
||||
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 464 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 959 KiB |
|
After Width: | Height: | Size: 119 KiB |
1
frontend/code/assets/Materials-001/config.json
Normal file
@ -0,0 +1 @@
|
||||
{"importBase":"import","nativeBase":"native","name":"Materials-001","deps":[],"uuids":[],"paths":{},"scenes":{},"packs":{},"versions":{"import":[],"native":[]},"redirect":[],"debug":false,"extensionMap":{},"hasPreloadScript":true,"dependencyRelationships":{},"types":[]}
|
||||
20
frontend/code/assets/Materials-001/index.js
Normal file
@ -0,0 +1,20 @@
|
||||
System.register("chunks:///_virtual/Materials-001",[],(function(){return{execute:function(){}}}));
|
||||
|
||||
(function(r) {
|
||||
r('virtual:///prerequisite-imports/Materials-001', 'chunks:///_virtual/Materials-001');
|
||||
})(function(mid, cid) {
|
||||
System.register(mid, [cid], function (_export, _context) {
|
||||
return {
|
||||
setters: [function(_m) {
|
||||
var _exportObj = {};
|
||||
|
||||
for (var _key in _m) {
|
||||
if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _m[_key];
|
||||
}
|
||||
|
||||
_export(_exportObj);
|
||||
}],
|
||||
execute: function () { }
|
||||
};
|
||||
});
|
||||
});
|
||||
1
frontend/code/assets/Materials/config.json
Normal file
@ -0,0 +1 @@
|
||||
{"importBase":"import","nativeBase":"native","name":"Materials","deps":["main"],"uuids":["0by2OqhTtD6KVmY6y0fvqN","87cJVYNlpFCqZOYVSlxe8Y","a6rIekk9VCHZtA17lPWr6F"],"paths":{"0":["YellowPulseMaterial",0,1],"1":["RedPulseMaterial",0,1],"2":["GreenPulseMaterial",0,1]},"scenes":{},"packs":{},"versions":{"import":[],"native":[]},"redirect":[0,"0",1,"0",2,"0"],"debug":false,"extensionMap":{},"hasPreloadScript":true,"dependencyRelationships":{},"types":["cc.Material"]}
|
||||
20
frontend/code/assets/Materials/index.js
Normal file
@ -0,0 +1,20 @@
|
||||
System.register("chunks:///_virtual/Materials",[],(function(){return{execute:function(){}}}));
|
||||
|
||||
(function(r) {
|
||||
r('virtual:///prerequisite-imports/Materials', 'chunks:///_virtual/Materials');
|
||||
})(function(mid, cid) {
|
||||
System.register(mid, [cid], function (_export, _context) {
|
||||
return {
|
||||
setters: [function(_m) {
|
||||
var _exportObj = {};
|
||||
|
||||
for (var _key in _m) {
|
||||
if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _m[_key];
|
||||
}
|
||||
|
||||
_export(_exportObj);
|
||||
}],
|
||||
execute: function () { }
|
||||
};
|
||||
});
|
||||
});
|
||||
61
frontend/code/assets/application.js
Normal file
@ -0,0 +1,61 @@
|
||||
System.register([], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
var cc, Application;
|
||||
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
||||
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
||||
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
||||
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
||||
return {
|
||||
setters: [],
|
||||
execute: function () {
|
||||
_export("Application", Application = /*#__PURE__*/function () {
|
||||
function Application() {
|
||||
_classCallCheck(this, Application);
|
||||
this.settingsPath = 'src/settings.json';
|
||||
this.showFPS = false;
|
||||
}
|
||||
_createClass(Application, [{
|
||||
key: "init",
|
||||
value: function init(engine) {
|
||||
cc = engine;
|
||||
cc.game.onPostBaseInitDelegate.add(this.onPostInitBase.bind(this));
|
||||
cc.game.onPostSubsystemInitDelegate.add(this.onPostSystemInit.bind(this));
|
||||
}
|
||||
}, {
|
||||
key: "onPostInitBase",
|
||||
value: function onPostInitBase() {
|
||||
// cc.settings.overrideSettings('assets', 'server', '');
|
||||
// do custom logic
|
||||
}
|
||||
}, {
|
||||
key: "onPostSystemInit",
|
||||
value: function onPostSystemInit() {
|
||||
// do custom logic
|
||||
}
|
||||
}, {
|
||||
key: "start",
|
||||
value: function start() {
|
||||
return cc.game.init({
|
||||
debugMode: false ? cc.DebugMode.INFO : cc.DebugMode.ERROR,
|
||||
settingsPath: this.settingsPath,
|
||||
overrideSettings: {
|
||||
// assets: {
|
||||
// preloadBundles: [{ bundle: 'main', version: 'xxx' }],
|
||||
// }
|
||||
profiling: {
|
||||
showFPS: this.showFPS
|
||||
}
|
||||
}
|
||||
}).then(function () {
|
||||
return cc.game.run();
|
||||
});
|
||||
}
|
||||
}]);
|
||||
return Application;
|
||||
}());
|
||||
}
|
||||
};
|
||||
});
|
||||
1
frontend/code/assets/assets/3d_models/config.json
Normal file
@ -0,0 +1 @@
|
||||
[1,["c89m0XNRpI2qEsAhLShXXE","e2Y/hxG/5JJ4f+EuJgfHP4@b811d","e2Y/hxG/5JJ4f+EuJgfHP4@63096"],["_effectAsset","root","node","data","_mesh"],[["cc.Node",["_name","_prefab","_children","_parent","_components","_lpos"],2,4,2,1,9,5],["cc.Material",["_name","_props","_states","_defines"],-1],["cc.Prefab",["_name"],2],["cc.PrefabInfo",["fileId","instance","targetOverrides","nestedPrefabInstanceRoots","root","asset"],-1,1,1],["cc.MeshRenderer",["_shadowCastingMode","node","__prefab","_materials","bakeSettings","_mesh"],2,1,4,3,4,6],["cc.CompPrefabInfo",["fileId"],2],["cc.ModelBakeSettings",["_castShadow","_receiveShadow"],1]],[[3,0,1,2,3,4,5,5],[1,0,1,2,3,5],[2,0,2],[0,0,2,1,2],[0,0,3,4,1,5,2],[4,0,1,2,3,4,5,2],[5,0,2],[6,0,1,3]],[[[[1,"CT MATERIAL_A",[{"occlusion":0}],[{"rasterizerState":{"cullMode":0},"blendState":{"targets":[{}]},"depthStencilState":{}}],[{}]]],0,0,[0],[0],[0]],[[[2,"73_collider"],[3,"73_collider",[-2],[0,"2awJwomwZV7Z9gTNZCgeTQ",null,null,null,-1,0]],[4,"UBX_DefaultRootName_001",1,[[5,1,-3,[6,"b6yTklyuVWYbY63yitocOd"],[0],[7,true,true],1]],[0,"5ctwZDSiVb26shLHihHeGy",null,null,null,1,0],[1,72.18412780761719,22.281278610229492,-38.93197250366211]]],0,[0,1,1,0,-1,2,0,2,2,0,3,1,3],[0,0],[-1,4],[1,2]]]]
|
||||
@ -0,0 +1 @@
|
||||
{"type":"cc.Texture2D","data":[["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@1f3c6"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@f1375"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@f1375"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@caddf"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@0ef36"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@f1375"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@d8bd3"]]]}
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
20
frontend/code/assets/assets/3d_models/index.js
Normal file
@ -0,0 +1,20 @@
|
||||
System.register("chunks:///_virtual/3d_models",[],(function(){return{execute:function(){}}}));
|
||||
|
||||
(function(r) {
|
||||
r('virtual:///prerequisite-imports/3d_models', 'chunks:///_virtual/3d_models');
|
||||
})(function(mid, cid) {
|
||||
System.register(mid, [cid], function (_export, _context) {
|
||||
return {
|
||||
setters: [function(_m) {
|
||||
var _exportObj = {};
|
||||
|
||||
for (var _key in _m) {
|
||||
if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _m[_key];
|
||||
}
|
||||
|
||||
_export(_exportObj);
|
||||
}],
|
||||
execute: function () { }
|
||||
};
|
||||
});
|
||||
});
|
||||
|
After Width: | Height: | Size: 58 KiB |
|
After Width: | Height: | Size: 464 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 959 KiB |
|
After Width: | Height: | Size: 119 KiB |
1
frontend/code/assets/assets/Materials-001/config.json
Normal file
@ -0,0 +1 @@
|
||||
{"importBase":"import","nativeBase":"native","name":"Materials-001","deps":[],"uuids":[],"paths":{},"scenes":{},"packs":{},"versions":{"import":[],"native":[]},"redirect":[],"debug":false,"extensionMap":{},"hasPreloadScript":true,"dependencyRelationships":{},"types":[]}
|
||||
20
frontend/code/assets/assets/Materials-001/index.js
Normal file
@ -0,0 +1,20 @@
|
||||
System.register("chunks:///_virtual/Materials-001",[],(function(){return{execute:function(){}}}));
|
||||
|
||||
(function(r) {
|
||||
r('virtual:///prerequisite-imports/Materials-001', 'chunks:///_virtual/Materials-001');
|
||||
})(function(mid, cid) {
|
||||
System.register(mid, [cid], function (_export, _context) {
|
||||
return {
|
||||
setters: [function(_m) {
|
||||
var _exportObj = {};
|
||||
|
||||
for (var _key in _m) {
|
||||
if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _m[_key];
|
||||
}
|
||||
|
||||
_export(_exportObj);
|
||||
}],
|
||||
execute: function () { }
|
||||
};
|
||||
});
|
||||
});
|
||||
1
frontend/code/assets/assets/Materials/config.json
Normal file
@ -0,0 +1 @@
|
||||
{"importBase":"import","nativeBase":"native","name":"Materials","deps":["main"],"uuids":["0by2OqhTtD6KVmY6y0fvqN","87cJVYNlpFCqZOYVSlxe8Y","a6rIekk9VCHZtA17lPWr6F"],"paths":{"0":["YellowPulseMaterial",0,1],"1":["RedPulseMaterial",0,1],"2":["GreenPulseMaterial",0,1]},"scenes":{},"packs":{},"versions":{"import":[],"native":[]},"redirect":[0,"0",1,"0",2,"0"],"debug":false,"extensionMap":{},"hasPreloadScript":true,"dependencyRelationships":{},"types":["cc.Material"]}
|
||||
20
frontend/code/assets/assets/Materials/index.js
Normal file
@ -0,0 +1,20 @@
|
||||
System.register("chunks:///_virtual/Materials",[],(function(){return{execute:function(){}}}));
|
||||
|
||||
(function(r) {
|
||||
r('virtual:///prerequisite-imports/Materials', 'chunks:///_virtual/Materials');
|
||||
})(function(mid, cid) {
|
||||
System.register(mid, [cid], function (_export, _context) {
|
||||
return {
|
||||
setters: [function(_m) {
|
||||
var _exportObj = {};
|
||||
|
||||
for (var _key in _m) {
|
||||
if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _m[_key];
|
||||
}
|
||||
|
||||
_export(_exportObj);
|
||||
}],
|
||||
execute: function () { }
|
||||
};
|
||||
});
|
||||
});
|
||||
1
frontend/code/assets/assets/internal/config.json
Normal file
@ -0,0 +1 @@
|
||||
{"importBase":"import","nativeBase":"native","name":"internal","deps":[],"uuids":["08HKsx3M1CjoZS8kBMyBxH","0fcbd05f8","142hclxMJCtKsI7grraJiz","173rzDCmtLirAL3Fi4hVge","1cAq5vRJJJFbj4dJKjseTN","1dCO9ipQNM4ouaRskIc/fT","509DSLyINOL48RziM7hZ+h","51HSYzCadL3axC93gDISSz","5dRaoA4GRJOLMUQmXwwiWM","609xlc7CpF67qUiVX2DoHQ","6aLQc0vZ5N35RuyqUkmMt1","71Hr4R9nNM2ZqDY8YLpUxb","784FhKQ0NHJ4834U5lwqLb","81Dpbk5FZEaJtZ9OjzlzLA","87HDtsc3lBnb2jeUsjmrkN","8bvbzdXNRBALbVt8liW2EH","93Yf2QulJPhKqTboeP1XbK","97CwWYvLBHFJH7LoFEDczY","97G9sjP/ZD67QiHDAWWjZj","a3zQCfCrBCDZJ4uf2rk5u8","b51hFfA3BNfKrTwZTMcc+Y","baIUdvKGZPgZxNbjWTFuRI","bc1kzGLdlD9qu+ZjGNMyAy","c0FDkGmu1EfpQ2KuhRLRtu","c2chXYaDVLaL+7verGEAwE","d1NGQ2rJZCcbhjH0/erZWw","d9MFkNu5JMyIvRI80Cf57f","ddOhRNq39B8IK4LkOgkNSW","e9qpo+WytKx6LHBz3isrJP","ef6OKj6s5Ce7Txy4qTfsd9","f0QW5oAgBLd6kmT50W5JTa","f9KAbXF2hEP6/oErzehNDw","fdoJXLgx1GAa2UhGATlj3o"],"paths":{"0":["db:/internal/default_materials/default-trail-material",1,1],"2":["db:/internal/default_materials/default-particle-gpu-material",1,1],"3":["db:/internal/effects/particles/builtin-particle-trail",0,1],"4":["db:/internal/effects/internal/builtin-graphics",0,1],"5":["db:/internal/effects/legacy/terrain",0,1],"6":["db:/internal/default_materials/ui-alpha-test-material",1,1],"7":["db:/internal/effects/pipeline/skybox",0,1],"8":["db:/internal/effects/pipeline/deferred-lighting",0,1],"9":["db:/internal/effects/for2d/builtin-sprite",0,1],"10":["db:/internal/effects/pipeline/post-process/tone-mapping",0,1],"11":["db:/internal/effects/particles/builtin-billboard",0,1],"12":["db:/internal/default_materials/default-billboard-material",1,1],"13":["db:/internal/effects/internal/builtin-clear-stencil",0,1],"14":["db:/internal/effects/util/profiler",0,1],"15":["db:/internal/default_materials/default-clear-stencil",1,1],"16":["db:/internal/effects/pipeline/planar-shadow",0,1],"17":["db:/internal/effects/util/splash-screen",0,1],"18":["db:/internal/effects/particles/builtin-particle-gpu",0,1],"19":["db:/internal/effects/builtin-unlit",0,1],"20":["db:/internal/default_materials/default-spine-material",1,1],"21":["db:/internal/physics/default-physics-material",2,1],"22":["db:/internal/default_materials/missing-effect-material",1,1],"23":["db:/internal/default_materials/default-particle-material",1,1],"24":["db:/internal/effects/for2d/builtin-spine",0,1],"25":["db:/internal/effects/particles/builtin-particle",0,1],"26":["db:/internal/default_materials/missing-material",1,1],"27":["db:/internal/default_materials/ui-sprite-gray-alpha-sep-material",1,1],"28":["db:/internal/default_materials/ui-base-material",1,1],"29":["db:/internal/default_materials/ui-sprite-gray-material",1,1],"30":["db:/internal/default_materials/ui-graphics-material",1,1],"31":["db:/internal/default_materials/ui-sprite-alpha-sep-material",1,1],"32":["db:/internal/default_materials/ui-sprite-material",1,1]},"scenes":{},"packs":{"0fcbd05f8":[0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32]},"versions":{"import":[],"native":[]},"redirect":[],"debug":false,"extensionMap":{},"hasPreloadScript":true,"dependencyRelationships":{},"types":["cc.EffectAsset","cc.Material","cc.PhysicsMaterial"]}
|
||||
26
frontend/code/assets/assets/internal/index.js
Normal file
1
frontend/code/assets/assets/main/config.json
Normal file
@ -0,0 +1 @@
|
||||
{"type":"cc.Texture2D","data":[["2,2,2,2,0,0",["54TknWPwVPqJqeCR+Y/Czo"]],["2,2,2,2,0,0",["20g1ukYUVPvKWKBRznAKo+"]],["2,2,2,2,0,0",["95EkngnxZFbYuFpsqVTaFr"]],["2,2,2,2,0,0",["acdPorH1tP9aPw8Sf0SD6R"]],["2,2,2,2,0,0",["afxHkx8GZGsJC+n+YfITQo"]],["2,2,2,2,0,0",["b7MFJ8MjNBwqr3fNq1j5dJ"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@6ee89"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@2e78d"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@07f2f"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@6af60"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@87329"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@8f420"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@db620"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@e5e90"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@5501b"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@31c60"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@5f29a"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@3f79a"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@2f00a"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@90611"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@d5db4"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@d0c04"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@8222a"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@e73c6"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@f2d5a"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@a0c07"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@8c06b"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@e461a"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@6fe55"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@e6790"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@5f893"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@f9ec9"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@8c06b"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@54d9f"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@e1124"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@a1f5c"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@39e53"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@5501b"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@eb942"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@5c5bd"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@6cae0"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@bf0b5"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@6fe55"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@0fa64"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@9333c"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@7597f"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@b4805"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@95418"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@48729"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@1f444"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@8c06b"]],["2,2,0,0,2,0",["e4sZyu/AFCepU5HK+e0zbc@e5ade"]],["2,2,2,2,0,0",["f1KiPEuSRDIqJgPZgkKPHo"]],["2,2,2,2,0,0",["ffuIqPr2JI9I8dPLYGRDpD"]]]}
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"0","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||
@ -0,0 +1 @@
|
||||
[1,0,0,["cc.ImageAsset"],0,[{"fmt":"1","w":0,"h":0},-1],[0],0,[],[],[]]
|
||||