Fixes: - CRITICAL: compareVersions used string comparison, fails for 1.10 vs 1.9 (now numeric) - CRITICAL: Double CloseDatabase() in main.go (defer + OnShutdown) - CRITICAL: Tailwind v4 in package.json but v3 config/syntax (downgraded to v3) - CRITICAL: react-router-dom v7 with v5 types (switched to v6, removed deprecated types) - IMPORTANT: UpdatePlanEntry hook signature mismatch (7 args vs Go's 4) - IMPORTANT: AllergenPicker hidden checkbox inaccessible to screenreaders (sr-only) - IMPORTANT: weekHelper getWeekFromDate returned wrong ISO year for edge cases - IMPORTANT: getWeeksInYear bug for years where Dec 31 is in week 1 of next year - IMPORTANT: getDateFromWeek off-by-one for some years (use Jan 4 anchor) - IMPORTANT: ProductSearch click-outside missed dropdown (use container ref) - IMPORTANT: seed.go LastInsertId=0 on INSERT OR IGNORE skip - IMPORTANT: SQLite missing PRAGMA foreign_keys=ON and WAL mode - IMPORTANT: AdditivePicker ADDITIVE_NAMES used numeric IDs but data uses letters - IMPORTANT: Missing role=dialog/aria-modal on all modal dialogs - IMPORTANT: Missing Escape key handler on ProductForm modal - IMPORTANT: Sidebar NavLink aria-current used function instead of string - IMPORTANT: useProducts searchProducts null safety for allergens/additives - NICE-TO-HAVE: Added aria-live=polite to WeekPlanner for dynamic updates - NICE-TO-HAVE: Added postcss.config.js for Tailwind v3 - NICE-TO-HAVE: Updated model comments to match actual day/meal conventions - NICE-TO-HAVE: Modernized vite/typescript/plugin versions
76 lines
2.7 KiB
Go
76 lines
2.7 KiB
Go
package main
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// Allergen repräsentiert ein EU-Allergen (a-n)
|
|
type Allergen struct {
|
|
ID string `json:"id" db:"id"`
|
|
Name string `json:"name" db:"name"`
|
|
Category string `json:"category" db:"category"`
|
|
}
|
|
|
|
// Additive repräsentiert einen Zusatzstoff (A, B, E, F, etc.)
|
|
type Additive struct {
|
|
ID string `json:"id" db:"id"`
|
|
Name string `json:"name" db:"name"`
|
|
}
|
|
|
|
// Product repräsentiert ein Produkt mit Allergenen und Zusatzstoffen
|
|
type Product struct {
|
|
ID int `json:"id" db:"id"`
|
|
Name string `json:"name" db:"name"`
|
|
Multiline bool `json:"multiline" db:"multiline"`
|
|
Allergens []Allergen `json:"allergens"`
|
|
Additives []Additive `json:"additives"`
|
|
}
|
|
|
|
// WeekPlan repräsentiert einen Wochenplan
|
|
type WeekPlan struct {
|
|
ID int `json:"id" db:"id"`
|
|
Year int `json:"year" db:"year"`
|
|
Week int `json:"week" db:"week"`
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
Entries []PlanEntry `json:"entries"`
|
|
SpecialDays []SpecialDay `json:"special_days"`
|
|
}
|
|
|
|
// PlanEntry repräsentiert einen Eintrag im Wochenplan
|
|
type PlanEntry struct {
|
|
ID int `json:"id" db:"id"`
|
|
WeekPlanID int `json:"week_plan_id" db:"week_plan_id"`
|
|
Day int `json:"day" db:"day"` // 1=Mo, 2=Di, 3=Mi, 4=Do, 5=Fr
|
|
Meal string `json:"meal" db:"meal"` // 'fruehstueck' oder 'vesper'
|
|
Slot int `json:"slot" db:"slot"` // Reihenfolge innerhalb des Tages
|
|
ProductID *int `json:"product_id" db:"product_id"`
|
|
Product *Product `json:"product,omitempty"`
|
|
CustomText *string `json:"custom_text" db:"custom_text"`
|
|
GroupLabel *string `json:"group_label" db:"group_label"` // 'Krippe', 'Kita', 'Hort', etc.
|
|
}
|
|
|
|
// SpecialDay repräsentiert einen Sondertag (Feiertag, Schließtag, etc.)
|
|
type SpecialDay struct {
|
|
ID int `json:"id" db:"id"`
|
|
WeekPlanID int `json:"week_plan_id" db:"week_plan_id"`
|
|
Day int `json:"day" db:"day"` // 1=Mo, 2=Di, ...
|
|
Type string `json:"type" db:"type"` // 'feiertag' oder 'schliesstag'
|
|
Label *string `json:"label" db:"label"` // z.B. "Neujahr", "Teamtag"
|
|
}
|
|
|
|
// UpdateInfo repräsentiert Informationen über verfügbare Updates
|
|
type UpdateInfo struct {
|
|
Available bool `json:"available"`
|
|
CurrentVersion string `json:"current_version"`
|
|
LatestVersion string `json:"latest_version"`
|
|
DownloadURL string `json:"download_url,omitempty"`
|
|
ReleaseNotes string `json:"release_notes,omitempty"`
|
|
}
|
|
|
|
// ProductImport repräsentiert ein Produkt beim Import aus JSON
|
|
type ProductImport struct {
|
|
Name string `json:"name"`
|
|
Multiline bool `json:"multiline"`
|
|
Allergens1 string `json:"allergens1"`
|
|
Allergens2 string `json:"allergens2"`
|
|
} |