ADD: fixed sime routing issues and docker file issues
This commit is contained in:
+3
-1
@@ -14,7 +14,9 @@ RUN npx prisma generate
|
|||||||
COPY . .
|
COPY . .
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
# Compile recovery scripts to plain JS for use inside the container
|
# 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 ----
|
# ---- Production Stage ----
|
||||||
FROM node:alpine AS runner
|
FROM node:alpine AS runner
|
||||||
|
|||||||
+22
-1
@@ -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";
|
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 }) {
|
export function Layout({ children }: { children: React.ReactNode }) {
|
||||||
return (
|
return (
|
||||||
<html lang="de">
|
<html lang="de">
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import { Button } from "@/components/ui/button";
|
|||||||
import { InvoiceStatusBadge } from "@/components/invoice/invoice-status-badge";
|
import { InvoiceStatusBadge } from "@/components/invoice/invoice-status-badge";
|
||||||
import { formatCurrency, formatDate } from "@/lib/tax";
|
import { formatCurrency, formatDate } from "@/lib/tax";
|
||||||
import { ChevronLeft, Download, CheckCircle, Send, Trash2, RotateCcw } from "lucide-react";
|
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({
|
export async function loader({
|
||||||
request,
|
request,
|
||||||
@@ -161,7 +161,7 @@ export default function InvoiceDetailPage() {
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
{invoice.status === "DRAFT" && (
|
{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
|
<Send className="h-4 w-4" /> Als versendet markieren
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
@@ -169,7 +169,7 @@ export default function InvoiceDetailPage() {
|
|||||||
<Button
|
<Button
|
||||||
size="sm"
|
size="sm"
|
||||||
className="bg-green-600 hover:bg-green-700"
|
className="bg-green-600 hover:bg-green-700"
|
||||||
onClick={() => updateStatus(InvoiceStatus.PAID)}
|
onClick={() => updateStatus("PAID")}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
>
|
>
|
||||||
<CheckCircle className="h-4 w-4" /> Als bezahlt markieren
|
<CheckCircle className="h-4 w-4" /> Als bezahlt markieren
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
services:
|
services:
|
||||||
mariadb:
|
mariadb:
|
||||||
image: mariadb:11
|
image: mariadb:11
|
||||||
container_name: annas_mariadb
|
container_name: annas_mariadb_dev
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: rootpassword
|
MYSQL_ROOT_PASSWORD: rootpassword
|
||||||
|
|||||||
+1
-1
@@ -28,7 +28,7 @@ services:
|
|||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
environment:
|
environment:
|
||||||
DATABASE_URL: mysql://annas_user:annas_password@mariadb:3306/annas_rechnungen
|
DATABASE_URL: mysql://annas_user:annas_password@mariadb:3306/annas_rechnungen
|
||||||
AUTH_SECRET: ${AUTH_SECRET}
|
AUTH_SECRET: changeme123
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
# Beim ersten Start wird der Admin-Benutzer (username: admin) mit diesem Passwort angelegt.
|
# 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.
|
# Nach dem ersten Login in der App ändern und hier leer lassen oder entfernen.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ echo "[entrypoint] Migrationen werden angewendet..."
|
|||||||
npx prisma migrate deploy
|
npx prisma migrate deploy
|
||||||
|
|
||||||
echo "[entrypoint] Admin-Benutzer wird geprüft..."
|
echo "[entrypoint] Admin-Benutzer wird geprüft..."
|
||||||
node scripts/setup-admin.js
|
node scripts/setup-admin.cjs
|
||||||
|
|
||||||
echo "[entrypoint] App wird gestartet..."
|
echo "[entrypoint] App wird gestartet..."
|
||||||
exec npm run start
|
exec npm run start
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
*
|
*
|
||||||
* Manual usage:
|
* Manual usage:
|
||||||
* ADMIN_PASSWORD=secret npx ts-node --compiler-options '{"module":"CommonJS"}' scripts/setup-admin.ts
|
* 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";
|
import { PrismaClient } from "@prisma/client";
|
||||||
|
|||||||
Reference in New Issue
Block a user