mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-25 00:31:13 -05:00
Refactor log_request_metadata function
This commit is contained in:
@@ -640,14 +640,23 @@ export function SubmissionReviewManager({
|
||||
}}
|
||||
onResolve={async (strategy) => {
|
||||
if (strategy === 'keep-mine') {
|
||||
// Log conflict resolution
|
||||
// Log conflict resolution using relational tables
|
||||
const { supabase } = await import('@/integrations/supabase/client');
|
||||
await supabase.from('conflict_resolutions').insert([{
|
||||
submission_id: submissionId,
|
||||
resolved_by: user?.id || null,
|
||||
resolution_strategy: strategy,
|
||||
conflict_details: conflictData as any,
|
||||
}]);
|
||||
const { writeConflictDetailFields } = await import('@/lib/auditHelpers');
|
||||
|
||||
const { data: resolution, error } = await supabase
|
||||
.from('conflict_resolutions')
|
||||
.insert([{
|
||||
submission_id: submissionId,
|
||||
resolved_by: user?.id || null,
|
||||
resolution_strategy: strategy,
|
||||
}])
|
||||
.select('id')
|
||||
.single();
|
||||
|
||||
if (!error && resolution && conflictData) {
|
||||
await writeConflictDetailFields(resolution.id, conflictData as any);
|
||||
}
|
||||
|
||||
// Force override and proceed with approval
|
||||
await handleApprove();
|
||||
|
||||
@@ -23,22 +23,31 @@ export function RecentPhotosPreview({ rideId, onViewAll }: RecentPhotosPreviewPr
|
||||
async function fetchPhotos() {
|
||||
const { data, error } = await supabase
|
||||
.from('reviews')
|
||||
.select('photos')
|
||||
.select(`
|
||||
id,
|
||||
user_id,
|
||||
created_at,
|
||||
review_photos!inner(
|
||||
cloudflare_image_url,
|
||||
caption,
|
||||
order_index,
|
||||
id
|
||||
)
|
||||
`)
|
||||
.eq('ride_id', rideId)
|
||||
.eq('moderation_status', 'approved')
|
||||
.not('photos', 'is', null)
|
||||
.order('created_at', { ascending: false })
|
||||
.limit(10);
|
||||
|
||||
if (!error && data) {
|
||||
const allPhotos: Photo[] = [];
|
||||
data.forEach((review: any) => {
|
||||
if (review.photos && Array.isArray(review.photos)) {
|
||||
review.photos.forEach((photo: any) => {
|
||||
if (review.review_photos && Array.isArray(review.review_photos)) {
|
||||
review.review_photos.forEach((photo: any) => {
|
||||
if (allPhotos.length < 4) {
|
||||
allPhotos.push({
|
||||
id: photo.id || Math.random().toString(),
|
||||
image_url: photo.image_url || photo.url,
|
||||
image_url: photo.cloudflare_image_url,
|
||||
caption: photo.caption || null
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user