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
@@ -0,0 +1,31 @@
|
||||
import { formatGeneratedNumber } from './number-format';
|
||||
|
||||
describe('formatGeneratedNumber', () => {
|
||||
// Constructed via local-time components (not an ISO string) so the test
|
||||
// is deterministic regardless of the machine's timezone.
|
||||
const date = new Date(2026, 2, 7);
|
||||
|
||||
it('substitutes year, month, day and a zero-padded sequence', () => {
|
||||
const result = formatGeneratedNumber('WH-{YYYY}-{SEQ:4}', 7, date);
|
||||
|
||||
expect(result).toBe('WH-2026-0007');
|
||||
});
|
||||
|
||||
it('supports {YY}, {MM}, {DD} and an unpadded {SEQ}', () => {
|
||||
const result = formatGeneratedNumber('{YY}{MM}{DD}-{SEQ}', 3, date);
|
||||
|
||||
expect(result).toBe('260307-3');
|
||||
});
|
||||
|
||||
it('does not truncate a sequence wider than the requested padding', () => {
|
||||
const result = formatGeneratedNumber('L-{SEQ:2}', 12345, date);
|
||||
|
||||
expect(result).toBe('L-12345');
|
||||
});
|
||||
|
||||
it('leaves a format with no placeholders unchanged', () => {
|
||||
const result = formatGeneratedNumber('FIXED-NUMBER', 1, date);
|
||||
|
||||
expect(result).toBe('FIXED-NUMBER');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user