ADD: fixed sime routing issues and docker file issues

This commit is contained in:
hwinkel
2026-03-13 13:18:47 +01:00
parent b3684c86b5
commit cf66d914de
7 changed files with 32 additions and 9 deletions
+3 -1
View File
@@ -14,7 +14,9 @@ RUN npx prisma generate
COPY . .
RUN npm run build
# Compile recovery scripts to plain JS for use inside the container
RUN npx tsc --module commonjs --target es2020 --moduleResolution node --esModuleInterop true --outDir scripts-dist scripts/setup-admin.ts scripts/reset-password.ts
RUN npx tsc --module commonjs --target es2020 --moduleResolution node --esModuleInterop true --outDir scripts-dist scripts/setup-admin.ts scripts/reset-password.ts && \
mv scripts-dist/setup-admin.js scripts-dist/setup-admin.cjs && \
mv scripts-dist/reset-password.js scripts-dist/reset-password.cjs
# ---- Production Stage ----
FROM node:alpine AS runner
+22 -1
View File
@@ -1,6 +1,27 @@
import { Links, Meta, Outlet, Scripts, ScrollRestoration } from "react-router";
import { Links, Meta, Outlet, Scripts, ScrollRestoration, isRouteErrorResponse, useRouteError } from "react-router";
import "./app.css";
export function ErrorBoundary() {
const error = useRouteError();
const message = isRouteErrorResponse(error)
? `${error.status} ${error.statusText}`
: error instanceof Error
? error.message
: String(error);
const stack = error instanceof Error ? error.stack : undefined;
return (
<html lang="de">
<head><meta charSet="utf-8" /><Meta /><Links /></head>
<body style={{ fontFamily: "monospace", padding: "2rem", background: "#fff1f2", color: "#9f1239" }}>
<h1 style={{ fontSize: "1.5rem", fontWeight: 700, marginBottom: "1rem" }}>Fehler</h1>
<pre style={{ whiteSpace: "pre-wrap", wordBreak: "break-word", background: "#ffe4e6", padding: "1rem", borderRadius: "0.5rem" }}>{message}</pre>
{stack && <pre style={{ marginTop: "1rem", fontSize: "0.75rem", color: "#64748b", whiteSpace: "pre-wrap" }}>{stack}</pre>}
<Scripts />
</body>
</html>
);
}
export function Layout({ children }: { children: React.ReactNode }) {
return (
<html lang="de">
@@ -16,7 +16,7 @@ import { Button } from "@/components/ui/button";
import { InvoiceStatusBadge } from "@/components/invoice/invoice-status-badge";
import { formatCurrency, formatDate } from "@/lib/tax";
import { ChevronLeft, Download, CheckCircle, Send, Trash2, RotateCcw } from "lucide-react";
import { InvoiceStatus } from "@prisma/client";
import type { InvoiceStatus } from "@prisma/client";
export async function loader({
request,
@@ -161,7 +161,7 @@ export default function InvoiceDetailPage() {
</Button>
)}
{invoice.status === "DRAFT" && (
<Button size="sm" onClick={() => updateStatus(InvoiceStatus.SENT)} disabled={loading}>
<Button size="sm" onClick={() => updateStatus("SENT")} disabled={loading}>
<Send className="h-4 w-4" /> Als versendet markieren
</Button>
)}
@@ -169,7 +169,7 @@ export default function InvoiceDetailPage() {
<Button
size="sm"
className="bg-green-600 hover:bg-green-700"
onClick={() => updateStatus(InvoiceStatus.PAID)}
onClick={() => updateStatus("PAID")}
disabled={loading}
>
<CheckCircle className="h-4 w-4" /> Als bezahlt markieren
+1 -1
View File
@@ -1,7 +1,7 @@
services:
mariadb:
image: mariadb:11
container_name: annas_mariadb
container_name: annas_mariadb_dev
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: rootpassword
+1 -1
View File
@@ -28,7 +28,7 @@ services:
- "3000:3000"
environment:
DATABASE_URL: mysql://annas_user:annas_password@mariadb:3306/annas_rechnungen
AUTH_SECRET: ${AUTH_SECRET}
AUTH_SECRET: changeme123
NODE_ENV: production
# Beim ersten Start wird der Admin-Benutzer (username: admin) mit diesem Passwort angelegt.
# Nach dem ersten Login in der App ändern und hier leer lassen oder entfernen.
+1 -1
View File
@@ -5,7 +5,7 @@ echo "[entrypoint] Migrationen werden angewendet..."
npx prisma migrate deploy
echo "[entrypoint] Admin-Benutzer wird geprüft..."
node scripts/setup-admin.js
node scripts/setup-admin.cjs
echo "[entrypoint] App wird gestartet..."
exec npm run start
+1 -1
View File
@@ -12,7 +12,7 @@
*
* Manual usage:
* ADMIN_PASSWORD=secret npx ts-node --compiler-options '{"module":"CommonJS"}' scripts/setup-admin.ts
* docker exec -e ADMIN_PASSWORD=secret annas_app node scripts/setup-admin.js
* docker exec -e ADMIN_PASSWORD=secret annas_app node scripts/setup-admin.cjs
*/
import { PrismaClient } from "@prisma/client";