mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-25 19:51:12 -05:00
Update submission_metadata queries
Enhance frontend to correctly fetch entity names by joining with submission_metadata and filtering metadata_key = 'name'; replace incorrect submission_metadata(name) usage in systemActivityService.ts and Profile.tsx with proper inner join and metadata_value extraction.
This commit is contained in:
@@ -291,8 +291,9 @@ export default function Profile() {
|
||||
submission_type,
|
||||
status,
|
||||
created_at,
|
||||
submission_metadata(name)
|
||||
submission_metadata!inner(metadata_value)
|
||||
`)
|
||||
.eq('submission_metadata.metadata_key', 'name')
|
||||
.eq('user_id', userId)
|
||||
.order('created_at', { ascending: false })
|
||||
.limit(10);
|
||||
@@ -310,10 +311,10 @@ export default function Profile() {
|
||||
const enrichedSubmissions = await Promise.all((submissions || []).map(async (sub) => {
|
||||
const enriched: any = { ...sub };
|
||||
|
||||
// Get name from submission_metadata
|
||||
// Get name from submission_metadata - extract metadata_value from the joined result
|
||||
const metadata = sub.submission_metadata as any;
|
||||
enriched.name = Array.isArray(metadata) && metadata.length > 0
|
||||
? metadata[0]?.name
|
||||
? metadata[0]?.metadata_value
|
||||
: undefined;
|
||||
|
||||
// For photo submissions, get photo count and preview
|
||||
|
||||
Reference in New Issue
Block a user