fix: Use correct column names for tastings table

- Change nose/palate/finish/notes to nose_notes/palate_notes/finish_notes
- Update query, interface, and all references in admin tastings page
This commit is contained in:
2026-01-19 11:49:49 +01:00
parent 948c70c7f2
commit 5914ef2ac8
2 changed files with 16 additions and 19 deletions

View File

@@ -8,10 +8,9 @@ interface Tasting {
bottle_id: string;
user_id: string;
rating: number;
nose: string | null;
palate: string | null;
finish: string | null;
notes: string | null;
nose_notes: string | null;
palate_notes: string | null;
finish_notes: string | null;
created_at: string;
user: { username: string; display_name: string | null };
bottle: { id: string; name: string; distillery: string | null; image_url: string | null } | null;
@@ -45,10 +44,9 @@ export default function AdminTastingsList({ tastings }: AdminTastingsListProps)
t.bottle?.name?.toLowerCase().includes(searchLower) ||
t.bottle?.distillery?.toLowerCase().includes(searchLower) ||
t.user.username.toLowerCase().includes(searchLower) ||
t.notes?.toLowerCase().includes(searchLower) ||
t.nose?.toLowerCase().includes(searchLower) ||
t.palate?.toLowerCase().includes(searchLower) ||
t.finish?.toLowerCase().includes(searchLower)
t.nose_notes?.toLowerCase().includes(searchLower) ||
t.palate_notes?.toLowerCase().includes(searchLower) ||
t.finish_notes?.toLowerCase().includes(searchLower)
);
}
@@ -127,7 +125,7 @@ export default function AdminTastingsList({ tastings }: AdminTastingsListProps)
{/* Tastings List */}
<div className="space-y-3">
{filteredTastings.map(tasting => {
const hasNotes = tasting.notes || tasting.nose || tasting.palate || tasting.finish;
const hasNotes = tasting.nose_notes || tasting.palate_notes || tasting.finish_notes;
return (
<div
@@ -171,14 +169,14 @@ export default function AdminTastingsList({ tastings }: AdminTastingsListProps)
{/* Notes Preview */}
{hasNotes && (
<div className="mt-2 space-y-1">
{tasting.nose && (
{tasting.nose_notes && (
<p className="text-xs text-zinc-400">
<span className="text-zinc-600">Nose:</span> {tasting.nose.slice(0, 80)}...
<span className="text-zinc-600">Nose:</span> {tasting.nose_notes.slice(0, 80)}...
</p>
)}
{tasting.notes && (
<p className="text-xs text-zinc-400 line-clamp-2">
{tasting.notes.slice(0, 150)}...
{tasting.palate_notes && (
<p className="text-xs text-zinc-400">
<span className="text-zinc-600">Palate:</span> {tasting.palate_notes.slice(0, 80)}...
</p>
)}
</div>