mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 11:11:14 -05:00
Fix validation for moderation queue
This commit is contained in:
@@ -62,6 +62,12 @@ interface ModerationItem {
|
|||||||
assigned_to?: string;
|
assigned_to?: string;
|
||||||
locked_until?: string;
|
locked_until?: string;
|
||||||
_removing?: boolean;
|
_removing?: boolean;
|
||||||
|
submission_items?: Array<{
|
||||||
|
id: string;
|
||||||
|
item_type: string;
|
||||||
|
item_data: any;
|
||||||
|
status: string;
|
||||||
|
}>;
|
||||||
}
|
}
|
||||||
|
|
||||||
type EntityFilter = 'all' | 'reviews' | 'submissions' | 'photos';
|
type EntityFilter = 'all' | 'reviews' | 'submissions' | 'photos';
|
||||||
@@ -255,7 +261,13 @@ export const ModerationQueue = forwardRef<ModerationQueueRef>((props, ref) => {
|
|||||||
reviewer_notes,
|
reviewer_notes,
|
||||||
escalated,
|
escalated,
|
||||||
assigned_to,
|
assigned_to,
|
||||||
locked_until
|
locked_until,
|
||||||
|
submission_items (
|
||||||
|
id,
|
||||||
|
item_type,
|
||||||
|
item_data,
|
||||||
|
status
|
||||||
|
)
|
||||||
`)
|
`)
|
||||||
.order('escalated', { ascending: false })
|
.order('escalated', { ascending: false })
|
||||||
.order('created_at', { ascending: true });
|
.order('created_at', { ascending: true });
|
||||||
@@ -824,7 +836,13 @@ export const ModerationQueue = forwardRef<ModerationQueueRef>((props, ref) => {
|
|||||||
.from('content_submissions')
|
.from('content_submissions')
|
||||||
.select(`
|
.select(`
|
||||||
id, submission_type, status, content, created_at, user_id,
|
id, submission_type, status, content, created_at, user_id,
|
||||||
reviewed_at, reviewer_id, reviewer_notes, escalated, assigned_to, locked_until
|
reviewed_at, reviewer_id, reviewer_notes, escalated, assigned_to, locked_until,
|
||||||
|
submission_items (
|
||||||
|
id,
|
||||||
|
item_type,
|
||||||
|
item_data,
|
||||||
|
status
|
||||||
|
)
|
||||||
`)
|
`)
|
||||||
.eq('id', newSubmission.id)
|
.eq('id', newSubmission.id)
|
||||||
.single();
|
.single();
|
||||||
@@ -1004,7 +1022,13 @@ export const ModerationQueue = forwardRef<ModerationQueueRef>((props, ref) => {
|
|||||||
.from('content_submissions')
|
.from('content_submissions')
|
||||||
.select(`
|
.select(`
|
||||||
id, submission_type, status, content, created_at, user_id,
|
id, submission_type, status, content, created_at, user_id,
|
||||||
reviewed_at, reviewer_id, reviewer_notes, escalated, assigned_to, locked_until
|
reviewed_at, reviewer_id, reviewer_notes, escalated, assigned_to, locked_until,
|
||||||
|
submission_items (
|
||||||
|
id,
|
||||||
|
item_type,
|
||||||
|
item_data,
|
||||||
|
status
|
||||||
|
)
|
||||||
`)
|
`)
|
||||||
.eq('id', updatedSubmission.id)
|
.eq('id', updatedSubmission.id)
|
||||||
.single();
|
.single();
|
||||||
|
|||||||
@@ -39,6 +39,12 @@ interface ModerationItem {
|
|||||||
assigned_to?: string;
|
assigned_to?: string;
|
||||||
locked_until?: string;
|
locked_until?: string;
|
||||||
_removing?: boolean;
|
_removing?: boolean;
|
||||||
|
submission_items?: Array<{
|
||||||
|
id: string;
|
||||||
|
item_type: string;
|
||||||
|
item_data: any;
|
||||||
|
status: string;
|
||||||
|
}>;
|
||||||
}
|
}
|
||||||
|
|
||||||
import { ValidationSummary } from './ValidationSummary';
|
import { ValidationSummary } from './ValidationSummary';
|
||||||
@@ -168,12 +174,12 @@ export const QueueItem = memo(({
|
|||||||
Claimed by You
|
Claimed by You
|
||||||
</Badge>
|
</Badge>
|
||||||
)}
|
)}
|
||||||
{item.submission_type && (
|
{item.submission_items && item.submission_items.length > 0 && (
|
||||||
<ValidationSummary
|
<ValidationSummary
|
||||||
item={{
|
item={{
|
||||||
item_type: item.submission_type,
|
item_type: item.submission_items[0].item_type,
|
||||||
item_data: item.content,
|
item_data: item.submission_items[0].item_data,
|
||||||
id: item.id,
|
id: item.submission_items[0].id,
|
||||||
}}
|
}}
|
||||||
compact={true}
|
compact={true}
|
||||||
onValidationChange={handleValidationChange}
|
onValidationChange={handleValidationChange}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export const rideValidationSchema = z.object({
|
|||||||
export const companyValidationSchema = z.object({
|
export const companyValidationSchema = z.object({
|
||||||
name: z.string().trim().min(1, 'Company name is required').max(200, 'Name must be less than 200 characters'),
|
name: z.string().trim().min(1, 'Company name is required').max(200, 'Name must be less than 200 characters'),
|
||||||
slug: z.string().trim().min(1, 'Slug is required').regex(/^[a-z0-9-]+$/, 'Slug must contain only lowercase letters, numbers, and hyphens'),
|
slug: z.string().trim().min(1, 'Slug is required').regex(/^[a-z0-9-]+$/, 'Slug must contain only lowercase letters, numbers, and hyphens'),
|
||||||
company_type: z.enum(['manufacturer', 'designer', 'operator', 'property_owner']).optional(),
|
company_type: z.enum(['manufacturer', 'designer', 'operator', 'property_owner']),
|
||||||
description: z.string().max(2000, 'Description must be less than 2000 characters').optional(),
|
description: z.string().max(2000, 'Description must be less than 2000 characters').optional(),
|
||||||
person_type: z.enum(['company', 'individual', 'firm', 'organization']),
|
person_type: z.enum(['company', 'individual', 'firm', 'organization']),
|
||||||
founded_year: z.number().min(1800, 'Founded year must be after 1800').max(currentYear, `Founded year cannot be in the future`).optional(),
|
founded_year: z.number().min(1800, 'Founded year must be after 1800').max(currentYear, `Founded year cannot be in the future`).optional(),
|
||||||
|
|||||||
Reference in New Issue
Block a user