Fix frontend JSONB references

This commit is contained in:
gpt-engineer-app[bot]
2025-11-03 21:19:51 +00:00
parent a4e1be8056
commit 63d9d8890c
8 changed files with 193 additions and 61 deletions

View File

@@ -287,7 +287,13 @@ export default function Profile() {
// Fetch last 10 submissions with enriched data
let submissionsQuery = supabase
.from('content_submissions')
.select('id, submission_type, content, status, created_at')
.select(`
id,
submission_type,
status,
created_at,
submission_metadata(name)
`)
.eq('user_id', userId)
.order('created_at', { ascending: false })
.limit(10);
@@ -305,6 +311,12 @@ export default function Profile() {
const enrichedSubmissions = await Promise.all((submissions || []).map(async (sub) => {
const enriched: any = { ...sub };
// Get name from submission_metadata
const metadata = sub.submission_metadata as any;
enriched.name = Array.isArray(metadata) && metadata.length > 0
? metadata[0]?.name
: undefined;
// For photo submissions, get photo count and preview
if (sub.submission_type === 'photo') {
const { data: photoSubs } = await supabase