v4.1.9: Начальная производственная версия

- Полный backend на Hono + TypeScript
- SQLite база данных с 38 записями
- 3 пользователя: admin, aknaproff, kasutaja
- Модальное окно reportModal (4 шага)
- Docker конфигурация для Synology ARM
- Все миграции (0001-0017)
- Frontend: vanilla HTML/JS (original.html)
This commit is contained in:
Deploy Bot
2025-12-31 12:00:00 +02:00
parent afea76b053
commit 4898f5ec7f
381 changed files with 9105 additions and 65477 deletions

45
src/index.tsx Executable file
View File

@@ -0,0 +1,45 @@
import { Hono } from 'hono'
import { serveStatic } from 'hono/cloudflare-pages'
import { HTTPException } from 'hono/http-exception'
import authRoute from './routes/auth'
import recordsRoute from './routes/records'
import reportsRoute from './routes/reports'
import usersRoute from './routes/users'
import yearsRoute from './routes/years'
import type { Bindings, Variables } from './types'
import { requestLogger } from './middlewares/requestLogger'
const app = new Hono<{ Bindings: Bindings; Variables: Variables }>({
strict: false
})
// API routes
app.use('/api/*', requestLogger)
app.route('/api/auth', authRoute)
app.route('/api/records', recordsRoute)
app.route('/api/reports', reportsRoute)
app.route('/api/users', usersRoute)
app.route('/api/years', yearsRoute)
// Static frontend
app.get('/', serveStatic({ path: './public/index.html' }))
app.use('/AKNAPROFF Tootmine_files/*', serveStatic({ root: './public' }))
app.use('/static/*', serveStatic({ root: './public' }))
app.use('*', serveStatic({ root: './public' }))
app.notFound(() => new Response('Not Found', { status: 404 }))
app.onError((err, c) => {
if (err instanceof HTTPException) {
return err.getResponse()
}
if (err instanceof SyntaxError) {
return c.json({ error: 'Invalid JSON payload' }, 400)
}
console.error('Unhandled error:', err)
return c.json({ error: 'Internal Server Error' }, 500)
})
export default app