mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 12:11:12 -05:00
Fix build errors
This commit is contained in:
@@ -3,7 +3,11 @@
|
||||
* Manages moderation workflow with type-safe state transitions and lock coordination
|
||||
*/
|
||||
|
||||
import type { SubmissionItemData } from '@/types/photo-submissions';
|
||||
// Generic review data interface for moderation
|
||||
export interface ModerationReviewData {
|
||||
id: string;
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
// State definitions using discriminated unions
|
||||
export type ModerationState =
|
||||
@@ -11,7 +15,7 @@ export type ModerationState =
|
||||
| { status: 'claiming'; itemId: string }
|
||||
| { status: 'locked'; itemId: string; lockExpires: string }
|
||||
| { status: 'loading_data'; itemId: string; lockExpires: string }
|
||||
| { status: 'reviewing'; itemId: string; lockExpires: string; reviewData: SubmissionItemData[] }
|
||||
| { status: 'reviewing'; itemId: string; lockExpires: string; reviewData: ModerationReviewData[] }
|
||||
| { status: 'approving'; itemId: string }
|
||||
| { status: 'rejecting'; itemId: string }
|
||||
| { status: 'complete'; itemId: string; result: 'approved' | 'rejected' }
|
||||
@@ -24,7 +28,7 @@ export type ModerationAction =
|
||||
| { type: 'LOCK_ACQUIRED'; payload: { lockExpires: string } }
|
||||
| { type: 'LOCK_EXPIRED' }
|
||||
| { type: 'LOAD_DATA' }
|
||||
| { type: 'DATA_LOADED'; payload: { reviewData: SubmissionItemData[] } }
|
||||
| { type: 'DATA_LOADED'; payload: { reviewData: ModerationReviewData[] } }
|
||||
| { type: 'START_APPROVAL' }
|
||||
| { type: 'START_REJECTION' }
|
||||
| { type: 'COMPLETE'; payload: { result: 'approved' | 'rejected' } }
|
||||
|
||||
@@ -107,20 +107,25 @@ interface RequestMetadata {
|
||||
}
|
||||
|
||||
async function logRequestMetadata(metadata: RequestMetadata): Promise<void> {
|
||||
await supabase.from('request_metadata').insert({
|
||||
request_id: metadata.requestId,
|
||||
user_id: metadata.userId || null,
|
||||
endpoint: metadata.endpoint,
|
||||
method: metadata.method,
|
||||
status_code: metadata.statusCode,
|
||||
duration_ms: metadata.duration,
|
||||
error_type: metadata.errorType || null,
|
||||
error_message: metadata.errorMessage || null,
|
||||
user_agent: metadata.userAgent || null,
|
||||
client_version: metadata.clientVersion || null,
|
||||
parent_request_id: metadata.parentRequestId || null,
|
||||
trace_id: metadata.traceId || null,
|
||||
// Direct RPC call since types haven't regenerated yet
|
||||
const { error } = await supabase.rpc('log_request_metadata', {
|
||||
p_request_id: metadata.requestId,
|
||||
p_user_id: metadata.userId || null,
|
||||
p_endpoint: metadata.endpoint,
|
||||
p_method: metadata.method,
|
||||
p_status_code: metadata.statusCode,
|
||||
p_duration_ms: metadata.duration,
|
||||
p_error_type: metadata.errorType || null,
|
||||
p_error_message: metadata.errorMessage || null,
|
||||
p_user_agent: metadata.userAgent || null,
|
||||
p_client_version: metadata.clientVersion || null,
|
||||
p_parent_request_id: metadata.parentRequestId || null,
|
||||
p_trace_id: metadata.traceId || null,
|
||||
});
|
||||
|
||||
if (error) {
|
||||
console.error('[RequestTracking] Failed to log metadata:', error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user