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
@@ -14,3 +14,9 @@ export function updateAutomationRule(
|
||||
body: JSON.stringify(input),
|
||||
});
|
||||
}
|
||||
|
||||
export function resetAutomationRuleSequence(id: string): Promise<AutomationRule> {
|
||||
return apiFetch<AutomationRule>(`/automation-rules/${id}/reset-sequence`, {
|
||||
method: "POST",
|
||||
});
|
||||
}
|
||||
@@ -4,7 +4,9 @@ export type AutomationTriggerType =
|
||||
| "FEED_STATUS_CRITICAL"
|
||||
| "SWARM_MOOD_HIGH"
|
||||
| "COLONY_HEALTH_CRITICAL"
|
||||
| "STOCK_ITEM_LOW";
|
||||
| "STOCK_ITEM_LOW"
|
||||
| "HONEY_BATCH_NUMBER_FORMAT"
|
||||
| "BOTTLING_LOT_NUMBER_FORMAT";
|
||||
|
||||
export interface AutomationRule {
|
||||
id: string;
|
||||
@@ -12,6 +14,7 @@ export interface AutomationRule {
|
||||
active: boolean;
|
||||
config: Record<string, unknown> | null;
|
||||
actionTemplate: string | null;
|
||||
sequenceValue: number;
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import { apiFetch, apiFetchBlob, apiFetchFormData, BlobDownload } from "@/lib/auth/api-client";
|
||||
import { BackupImportSummary, BackupScheduleStatus } from "./types";
|
||||
import {
|
||||
BackupImportSummary,
|
||||
BackupScheduleStatus,
|
||||
BackupSettings,
|
||||
UpdateBackupSettingsInput,
|
||||
} from "./types";
|
||||
|
||||
export function exportBackup(): Promise<BlobDownload> {
|
||||
return apiFetchBlob("/backup/export", "apicore-backup.json");
|
||||
@@ -20,3 +25,16 @@ export function runBackupNow(): Promise<{ filePath: string }> {
|
||||
method: "POST",
|
||||
});
|
||||
}
|
||||
|
||||
export function getBackupSettings(): Promise<BackupSettings> {
|
||||
return apiFetch<BackupSettings>("/backup/settings");
|
||||
}
|
||||
|
||||
export function updateBackupSettings(
|
||||
input: UpdateBackupSettingsInput,
|
||||
): Promise<BackupSettings> {
|
||||
return apiFetch<BackupSettings>("/backup/settings", {
|
||||
method: "PATCH",
|
||||
body: JSON.stringify(input),
|
||||
});
|
||||
}
|
||||
@@ -8,4 +8,23 @@ export interface BackupScheduleStatus {
|
||||
cronSchedule: string | null;
|
||||
retentionCount: number | null;
|
||||
lastRunAt: string | null;
|
||||
envOverrides: {
|
||||
storagePath: boolean;
|
||||
cronSchedule: boolean;
|
||||
retentionCount: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface BackupSettings {
|
||||
id: string;
|
||||
storagePath: string | null;
|
||||
cronSchedule: string | null;
|
||||
retentionCount: number | null;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export interface UpdateBackupSettingsInput {
|
||||
storagePath?: string;
|
||||
cronSchedule?: string;
|
||||
retentionCount?: number;
|
||||
}
|
||||
@@ -20,7 +20,7 @@ export interface CreateBottlingBatchInput {
|
||||
jarSize: number;
|
||||
jarCount: number;
|
||||
bestBeforeDate: string;
|
||||
lotNumber: string;
|
||||
lotNumber?: string;
|
||||
}
|
||||
|
||||
export interface UpdateBottlingBatchInput {
|
||||
|
||||
@@ -74,7 +74,7 @@ export interface Traceability {
|
||||
}
|
||||
|
||||
export interface CreateHoneyBatchInput {
|
||||
batchNumber: string;
|
||||
batchNumber?: string;
|
||||
extractionId: string;
|
||||
honeyType?: string;
|
||||
amount?: number;
|
||||
|
||||
@@ -7,6 +7,7 @@ export interface PublicSocialLinks {
|
||||
youtube: string | null;
|
||||
instagram: string | null;
|
||||
tiktok: string | null;
|
||||
website: string | null;
|
||||
}
|
||||
|
||||
export interface PublicBatch {
|
||||
|
||||
@@ -3,6 +3,7 @@ export interface SiteSettings {
|
||||
youtubeUrl: string | null;
|
||||
instagramUrl: string | null;
|
||||
tiktokUrl: string | null;
|
||||
websiteUrl: string | null;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
@@ -10,4 +11,5 @@ export interface UpdateSiteSettingsInput {
|
||||
youtubeUrl?: string;
|
||||
instagramUrl?: string;
|
||||
tiktokUrl?: string;
|
||||
websiteUrl?: string;
|
||||
}
|
||||
Reference in new issue
Block a user