Compare commits

..

3 Commits

Author SHA1 Message Date
rxf
8bfc2b685b V 1.2.1 Berechnugn der Resttsage auch beim Start 2026-03-23 10:08:03 +01:00
rxf
229cbf7223 nochmal 2026-03-19 11:29:36 +01:00
rxf
704a8f09b7 Buid-Date updated 2026-03-19 11:29:08 +01:00
6 changed files with 32 additions and 15 deletions

View File

@@ -16,6 +16,8 @@ COPY . .
# Standalone-Output aktiviert kleinste Images # Standalone-Output aktiviert kleinste Images
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
ARG BUILD_DATE
ENV NEXT_PUBLIC_BUILD_DATE=$BUILD_DATE
RUN npm run build RUN npm run build
# ── Stage 3: Produktions-Image ──────────────────────────────────────────────── # ── Stage 3: Produktions-Image ────────────────────────────────────────────────

View File

@@ -5,6 +5,10 @@ import { checkAblauf } from '@/lib/checkAblauf';
import moment from 'moment'; import moment from 'moment';
import { Tablette, DataResponse } from '@/types/tablette'; import { Tablette, DataResponse } from '@/types/tablette';
// Verhindert Caching der Route
export const dynamic = 'force-dynamic';
export const revalidate = 0;
function formatDate(dt: Date | string | null): string { function formatDate(dt: Date | string | null): string {
if (!dt) return ''; if (!dt) return '';
const d = moment(dt); const d = moment(dt);
@@ -24,22 +28,26 @@ export async function GET(req: NextRequest) {
try { try {
const [rows] = await pool.query<RowDataPacket[]>( const [rows] = await pool.query<RowDataPacket[]>(
`SELECT tab, pday, cnt, at, akt, until, warn, rem, \`order\` `SELECT tab, pday, cnt, at, rem, \`order\`
FROM tabletten FROM tabletten
ORDER BY ${col} ${sord}, rem DESC, tab ASC` ORDER BY ${col} ${sord}, rem DESC, tab ASC`
); );
const values: Tablette[] = rows.map((r) => ({ const values: Tablette[] = rows.map((r) => {
tab: r.tab, // Berechne die aktuellen Werte dynamisch basierend auf dem heutigen Datum
pday: r.pday, const calculated = checkAblauf({ cnt: r.cnt, pday: r.pday, at: r.at });
cnt: r.cnt, return {
at: formatDate(r.at), tab: r.tab,
akt: r.akt, pday: r.pday,
until: formatDate(r.until), cnt: r.cnt,
warn: r.warn === 1 || r.warn === true, at: formatDate(r.at),
rem: r.rem, akt: calculated.akt,
order: r.order, until: formatDate(calculated.until),
})); warn: calculated.warn,
rem: r.rem,
order: r.order,
};
});
const result: DataResponse = { const result: DataResponse = {
total: 1, total: 1,

View File

@@ -1,5 +1,6 @@
'use client'; 'use client';
import { useState } from 'react';
import LogoutButton from '@/components/LogoutButton'; import LogoutButton from '@/components/LogoutButton';
import packageJson from '@/package.json'; import packageJson from '@/package.json';
@@ -9,7 +10,9 @@ interface AppLayoutProps {
export default function AppLayout({ children }: AppLayoutProps) { export default function AppLayout({ children }: AppLayoutProps) {
const version = packageJson.version; const version = packageJson.version;
const buildDate = process.env.NEXT_PUBLIC_BUILD_DATE || new Date().toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' }); const [buildDate] = useState(() =>
process.env.NEXT_PUBLIC_BUILD_DATE || new Date().toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' })
);
return ( return (
<div className="app-wrapper"> <div className="app-wrapper">

View File

@@ -2,13 +2,15 @@
# Lokaler Betrieb MySQL läuft bereits auf dem Host (localhost) # Lokaler Betrieb MySQL läuft bereits auf dem Host (localhost)
# #
# Start: # Start:
# docker compose -f docker-compose.local.yml up --build # BUILD_DATE=$(date +%d.%m.%Y) docker compose -f docker-compose.local.yml up --build
services: services:
app: app:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
args:
BUILD_DATE: "$(date +%d.%m.%Y)"
restart: unless-stopped restart: unless-stopped
ports: ports:
- "3000:3000" - "3000:3000"

View File

@@ -15,6 +15,8 @@ services:
build: build:
context: . context: .
dockerfile: Dockerfile dockerfile: Dockerfile
args:
BUILD_DATE: "$(date +%d.%m.%Y)"
platforms: platforms:
- linux/amd64 - linux/amd64
- linux/arm64 - linux/arm64

View File

@@ -1,6 +1,6 @@
{ {
"name": "tabletten_next", "name": "tabletten_next",
"version": "1.2.0", "version": "1.2.1",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",