fix(bereich): Bereich-Dropdown im "Neues Projekt"-Dialog war leer
ci / quality (push) Failing after 45s
ci / build (push) Has been skipped
deploy / deploy (push) Successful in 53s

Zwei Ursachen behoben:
- Frontend: areaId/Default wurden nur beim Mount aus dem (noch ladenden)
  areas-Prop berechnet → kein Default, keine Platzhalter-Option. Jetzt via
  useEffect Default setzen sobald Areas geladen sind + Platzhalter-Option.
- Prod: Deploy seedet nicht → frische DB hatte keine Areas. Neue
  ensureBaseAreas() legt die Basis-Bereiche idempotent beim API-Start an
  (nach den Migrationen), analog zu runMigrations.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
dejanandClaude Opus 4.8 committed 2026-06-05 19:28:59 +02:00
1 parent 9c5207527a
commit 43eeabaea2
4 files changed
+51 -2

No files matched your search

+10 -1
View File
@@ -1,7 +1,7 @@
import Fastify from 'fastify';
import cookie from '@fastify/cookie';
import { fastifyTRPCPlugin, type FastifyTRPCPluginOptions } from '@trpc/server/adapters/fastify';
import { runMigrations } from '@cockpit/db';
import { runMigrations, ensureBaseAreas } from '@cockpit/db';
import { loadEnv } from './env.js';
import { logger } from './lib/logger.js';
import { registerAuthMiddleware } from './auth/middleware.js';
@@ -24,6 +24,15 @@ async function main() {
process.exit(1);
}
// Basis-Bereiche sicherstellen (idempotent), damit der „Neues Projekt"-
// Bereich-Dropdown auch auf einer nicht geseedeten Prod-DB nie leer ist.
try {
await ensureBaseAreas(env.DATABASE_URL);
logger.info('base areas ensured');
} catch (err) {
logger.error({ err }, 'ensure base areas failed');
}
const app = Fastify({
logger: {
level: env.LOG_LEVEL,