mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 16:11:12 -05:00
Approve tool use
This commit is contained in:
@@ -7,6 +7,7 @@ import { extractChangedFields } from './submissionChangeDetection';
|
||||
import type { CompanyDatabaseRecord, TimelineEventDatabaseRecord } from '@/types/company-data';
|
||||
import { logger } from './logger';
|
||||
import { getErrorMessage } from './errorHandler';
|
||||
import type { TimelineEventFormData, EntityType } from '@/types/timeline';
|
||||
|
||||
/**
|
||||
* ═══════════════════════════════════════════════════════════════════
|
||||
@@ -153,9 +154,6 @@ export interface RideModelFormData {
|
||||
card_image_id?: string;
|
||||
}
|
||||
|
||||
// Import timeline types
|
||||
import type { TimelineEventFormData, TimelineSubmissionData, EntityType } from '@/types/timeline';
|
||||
|
||||
/**
|
||||
* ⚠️ CRITICAL SECURITY PATTERN ⚠️
|
||||
*
|
||||
@@ -1183,7 +1181,7 @@ export async function submitTimelineEvent(
|
||||
};
|
||||
|
||||
const items = [{
|
||||
item_type: 'milestone',
|
||||
item_type: 'timeline_event',
|
||||
action_type: 'create',
|
||||
item_data: itemData,
|
||||
order_index: 0,
|
||||
@@ -1192,7 +1190,7 @@ export async function submitTimelineEvent(
|
||||
const { data: submissionId, error } = await supabase
|
||||
.rpc('create_submission_with_items', {
|
||||
p_user_id: userId,
|
||||
p_submission_type: 'milestone',
|
||||
p_submission_type: 'timeline_event',
|
||||
p_content: content,
|
||||
p_items: items as unknown as Json[],
|
||||
});
|
||||
@@ -1255,7 +1253,7 @@ export async function submitTimelineEventUpdate(
|
||||
'create_submission_with_items',
|
||||
{
|
||||
p_user_id: userId,
|
||||
p_submission_type: 'milestone',
|
||||
p_submission_type: 'timeline_event',
|
||||
p_content: {
|
||||
action: 'edit',
|
||||
event_id: eventId,
|
||||
@@ -1263,7 +1261,7 @@ export async function submitTimelineEventUpdate(
|
||||
} as unknown as Json,
|
||||
p_items: [
|
||||
{
|
||||
item_type: 'milestone',
|
||||
item_type: 'timeline_event',
|
||||
action_type: 'edit',
|
||||
item_data: itemData,
|
||||
original_data: originalEvent,
|
||||
@@ -1290,12 +1288,7 @@ export async function submitTimelineEventUpdate(
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a timeline event (only pending/own events)
|
||||
* @param eventId - Timeline event ID
|
||||
* @param userId - Current user ID
|
||||
* @throws Error if event not found or cannot be deleted
|
||||
*/
|
||||
|
||||
export async function deleteTimelineEvent(
|
||||
eventId: string,
|
||||
userId: string
|
||||
|
||||
Reference in New Issue
Block a user