feat: add website social link, fix herkunft origin display, GUI backup schedule, and format-based batch numbering
- SiteSettings gains websiteUrl (e.g. online shop link) alongside the
existing social links, editable in Verwaltung > Automatisierung.
- /herkunft/[lot] now shows the apiary's Standort instead of its internal
Name (so multiple apiaries at one location read as one origin), adds
small icons per social link, and surfaces previously-fetched-but-unused
data (Honigsorte, Abfülldatum, stat cards) to make the page a richer
customer-facing info page.
- Backup schedule (path/cron/retention) is now also configurable via the
GUI (Verwaltung > Backup), stored in a new BackupSettings singleton;
an env var always wins over the GUI value per field, and the scheduler
reloads its cron job live when GUI settings change.
- New Automatisierung rules let an admin define a format (e.g.
"WH-{YYYY}-{SEQ:4}") that auto-generates HoneyBatch.batchNumber and
BottlingBatch.lotNumber on creation, with an atomic per-rule sequence
counter and a manual reset. Manual entry still works when the rule is
inactive.
This commit is contained in:
1 parent
7b23862a41
commit
412d033d8d
42 files changed
+1045
-119
No files matched your search
+9
@@ -0,0 +1,9 @@
|
||||
-- AlterEnum
|
||||
ALTER TYPE "AutomationTriggerType" ADD VALUE 'HONEY_BATCH_NUMBER_FORMAT';
|
||||
ALTER TYPE "AutomationTriggerType" ADD VALUE 'BOTTLING_LOT_NUMBER_FORMAT';
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "AutomationRule" ADD COLUMN "sequenceValue" INTEGER NOT NULL DEFAULT 0;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "SiteSettings" ADD COLUMN "websiteUrl" TEXT;
|
||||
@@ -0,0 +1,10 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "BackupSettings" (
|
||||
"id" TEXT NOT NULL DEFAULT 'singleton',
|
||||
"storagePath" TEXT,
|
||||
"cronSchedule" TEXT,
|
||||
"retentionCount" INTEGER,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "BackupSettings_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
@@ -1014,6 +1014,8 @@ enum AutomationTriggerType {
|
||||
SWARM_MOOD_HIGH
|
||||
COLONY_HEALTH_CRITICAL
|
||||
STOCK_ITEM_LOW
|
||||
HONEY_BATCH_NUMBER_FORMAT
|
||||
BOTTLING_LOT_NUMBER_FORMAT
|
||||
}
|
||||
|
||||
model AutomationRule {
|
||||
@@ -1022,6 +1024,12 @@ model AutomationRule {
|
||||
active Boolean @default(true)
|
||||
config Json?
|
||||
actionTemplate String?
|
||||
// Running counter for the number-format rules (HONEY_BATCH_NUMBER_FORMAT /
|
||||
// BOTTLING_LOT_NUMBER_FORMAT) - unused by the threshold-style rules. Kept as
|
||||
// a dedicated column (not inside `config`) so it can be incremented with a
|
||||
// single atomic `UPDATE ... SET sequenceValue = sequenceValue + 1`,
|
||||
// race-safe under concurrent batch/bottling creation.
|
||||
sequenceValue Int @default(0)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
@@ -1038,5 +1046,21 @@ model SiteSettings {
|
||||
youtubeUrl String?
|
||||
instagramUrl String?
|
||||
tiktokUrl String?
|
||||
websiteUrl String?
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Backup-Einstellungen – GUI-Override für den automatischen Backup-Zeitplan.
|
||||
// Jede der drei Umgebungsvariablen (BACKUP_STORAGE_PATH/_CRON_SCHEDULE/
|
||||
// _RETENTION_COUNT) hat Vorrang vor dem hier gespeicherten Wert - diese Zeile
|
||||
// greift nur pro Feld, wenn die jeweilige Env-Variable nicht gesetzt ist.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
model BackupSettings {
|
||||
id String @id @default("singleton")
|
||||
storagePath String?
|
||||
cronSchedule String?
|
||||
retentionCount Int?
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
Reference in new issue
Block a user