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:
@@ -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>
|
||||
|
||||
@@ -28,10 +28,9 @@ export default async function AdminTastingsPage() {
|
||||
bottle_id,
|
||||
user_id,
|
||||
rating,
|
||||
nose,
|
||||
palate,
|
||||
finish,
|
||||
notes,
|
||||
nose_notes,
|
||||
palate_notes,
|
||||
finish_notes,
|
||||
created_at,
|
||||
bottles (id, name, distillery, image_url)
|
||||
`)
|
||||
@@ -60,7 +59,7 @@ export default async function AdminTastingsPage() {
|
||||
avgRating: tastings.length > 0
|
||||
? tastings.reduce((sum, t) => sum + (t.rating || 0), 0) / tastings.filter(t => t.rating > 0).length
|
||||
: 0,
|
||||
withNotes: tastings.filter(t => t.notes || t.nose || t.palate || t.finish).length,
|
||||
withNotes: tastings.filter(t => t.nose_notes || t.palate_notes || t.finish_notes).length,
|
||||
todayCount: tastings.filter(t => {
|
||||
const today = new Date();
|
||||
const tastingDate = new Date(t.created_at);
|
||||
|
||||
Reference in New Issue
Block a user