-- Fix Time Clock Aggregation Sync Hook Configuration
-- Date: 2025-01-14
-- Description: Updates the hook config to use endpoint format instead of controller/method

-- Update the time clock aggregation hook to use endpoint format
UPDATE sync_hooks 
SET config = '{
    "endpoint": "/api/timeclock/aggregates", 
    "require_date_filter": true,
    "date_range_source": "filter"
}'::jsonb,
description = 'Auto-aggregate time_clocks data into time_clock_aggregates by user and org via endpoint',
updated_at = NOW()
WHERE name = 'time_clock_aggregation';

-- Verify the update
SELECT name, hook_type, config 
FROM sync_hooks 
WHERE name = 'time_clock_aggregation';