mirror of
https://github.com/we-promise/sure.git
synced 2026-05-08 21:25:00 +00:00
feat(api): expose sync status (#1635)
* feat(api): expose sync status * fix(api): harden sync status review paths * fix(api): address sync status review * fix(api): tighten sync status review fixes * fix(api): address sync status review * test(api): avoid secret-like sync fixture key * test(api): reuse sync status fixture key * fix(api): align sync route helpers * fix(api): tighten sync status scoping * fix(api): make sync status schema nullable-compliant
This commit is contained in:
@@ -1887,6 +1887,119 @@ components:
|
||||
per_page:
|
||||
type: integer
|
||||
minimum: 1
|
||||
SyncableSummary:
|
||||
type: object
|
||||
required:
|
||||
- type
|
||||
- id
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
name:
|
||||
type: string
|
||||
nullable: true
|
||||
SyncErrorSummary:
|
||||
type: object
|
||||
required:
|
||||
- message
|
||||
properties:
|
||||
message:
|
||||
type: string
|
||||
SyncResource:
|
||||
type: object
|
||||
required:
|
||||
- id
|
||||
- status
|
||||
- in_progress
|
||||
- terminal
|
||||
- syncable
|
||||
- children_count
|
||||
- created_at
|
||||
- updated_at
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
status:
|
||||
type: string
|
||||
enum:
|
||||
- pending
|
||||
- syncing
|
||||
- completed
|
||||
- failed
|
||||
- stale
|
||||
in_progress:
|
||||
type: boolean
|
||||
terminal:
|
||||
type: boolean
|
||||
syncable:
|
||||
"$ref": "#/components/schemas/SyncableSummary"
|
||||
parent_id:
|
||||
type: string
|
||||
format: uuid
|
||||
nullable: true
|
||||
children_count:
|
||||
type: integer
|
||||
minimum: 0
|
||||
window_start_date:
|
||||
type: string
|
||||
format: date
|
||||
nullable: true
|
||||
window_end_date:
|
||||
type: string
|
||||
format: date
|
||||
nullable: true
|
||||
pending_at:
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
syncing_at:
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
completed_at:
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
failed_at:
|
||||
type: string
|
||||
format: date-time
|
||||
nullable: true
|
||||
error:
|
||||
nullable: true
|
||||
allOf:
|
||||
- "$ref": "#/components/schemas/SyncErrorSummary"
|
||||
created_at:
|
||||
type: string
|
||||
format: date-time
|
||||
updated_at:
|
||||
type: string
|
||||
format: date-time
|
||||
SyncResponse:
|
||||
type: object
|
||||
required:
|
||||
- data
|
||||
properties:
|
||||
data:
|
||||
nullable: true
|
||||
allOf:
|
||||
- "$ref": "#/components/schemas/SyncResource"
|
||||
SyncCollection:
|
||||
type: object
|
||||
required:
|
||||
- data
|
||||
- meta
|
||||
properties:
|
||||
data:
|
||||
type: array
|
||||
maxItems: 100
|
||||
items:
|
||||
"$ref": "#/components/schemas/SyncResource"
|
||||
meta:
|
||||
"$ref": "#/components/schemas/Pagination"
|
||||
Trade:
|
||||
type: object
|
||||
required:
|
||||
@@ -5004,6 +5117,115 @@ paths:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
"/api/v1/syncs":
|
||||
get:
|
||||
summary: Lists sync history
|
||||
description: List sanitized sync status history for the authenticated user's
|
||||
family, accounts, and provider connections.
|
||||
tags:
|
||||
- Syncs
|
||||
security:
|
||||
- apiKeyAuth: []
|
||||
parameters:
|
||||
- name: page
|
||||
in: query
|
||||
required: false
|
||||
description: 'Page number (default: 1)'
|
||||
schema:
|
||||
type: integer
|
||||
- name: per_page
|
||||
in: query
|
||||
required: false
|
||||
description: 'Items per page (default: 25, max: 100)'
|
||||
schema:
|
||||
type: integer
|
||||
responses:
|
||||
'200':
|
||||
description: syncs listed
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/SyncCollection"
|
||||
'401':
|
||||
description: unauthorized
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
'403':
|
||||
description: forbidden
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
"/api/v1/syncs/latest":
|
||||
get:
|
||||
summary: Shows the latest sync
|
||||
description: 'Return the most recently created sanitized sync status for the
|
||||
authenticated user''s family, or data: null when no sync exists.'
|
||||
tags:
|
||||
- Syncs
|
||||
security:
|
||||
- apiKeyAuth: []
|
||||
responses:
|
||||
'200':
|
||||
description: latest sync shown
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/SyncResponse"
|
||||
'401':
|
||||
description: unauthorized
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
'403':
|
||||
description: forbidden
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
"/api/v1/syncs/{id}":
|
||||
parameters:
|
||||
- name: id
|
||||
in: path
|
||||
format: uuid
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
get:
|
||||
summary: Shows a sync
|
||||
description: Return sanitized status metadata for a single family-scoped sync.
|
||||
tags:
|
||||
- Syncs
|
||||
security:
|
||||
- apiKeyAuth: []
|
||||
responses:
|
||||
'200':
|
||||
description: sync shown
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/SyncResponse"
|
||||
'401':
|
||||
description: unauthorized
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
'403':
|
||||
description: forbidden
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
'404':
|
||||
description: not found
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
"$ref": "#/components/schemas/ErrorResponse"
|
||||
"/api/v1/tags":
|
||||
get:
|
||||
summary: List tags
|
||||
|
||||
Reference in New Issue
Block a user