Files
sure/app/views/api/v1/sync/create.json.jbuilder
Mark Hendriksen b73ac207e0 Add API endpoint for triggering family sync (#423)
* Add API endpoint for triggering family sync

Introduces Api::V1::SyncController with a create action to queue a family sync, applying all active rules and syncing accounts. Adds corresponding route, JSON response view, and comprehensive controller tests for authorization and response validation.

* Rename started_at to syncing_at in sync API response

Updated the sync create JSON response to use 'syncing_at' instead of 'started_at'. Adjusted related controller test to check for 'syncing_at'. Also updated API authentication header in test to use 'X-Api-Key' instead of Bearer token.

* Update app/controllers/api/v1/sync_controller.rb

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Mark Hendriksen <hendriksen-mark@hotmail.com>

---------

Signed-off-by: Mark Hendriksen <hendriksen-mark@hotmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-12 17:07:02 +01:00

12 lines
375 B
Ruby

# frozen_string_literal: true
json.id @sync.id
json.status @sync.status
json.syncable_type @sync.syncable_type
json.syncable_id @sync.syncable_id
json.syncing_at @sync.syncing_at
json.completed_at @sync.completed_at
json.window_start_date @sync.window_start_date
json.window_end_date @sync.window_end_date
json.message "Sync has been queued and will apply all active rules"