mirror of
https://github.com/sstent/FitTrack_GarminSync.git
synced 2026-01-25 16:41:41 +00:00
- Created implementation plan with technical context - Developed data models for User Session, Sync Job, and Authentication Token - Defined API contracts for authentication, sync triggering, and status checking - Created quickstart guide for CLI usage - Updated agent context with new technology stack - Verified constitution compliance for all design decisions
2.8 KiB
2.8 KiB
Data Model: CLI App for API Interaction with MFA
Key Entities
User Session
Represents an authenticated user session with associated tokens and permissions
Attributes:
session_id: Unique identifier for the sessionuser_id: Identifier for the authenticated useraccess_token: JWT or API token for authenticated requestsrefresh_token: Token used to refresh the access tokenexpires_at: Timestamp when the access token expiresmfa_enabled: Boolean indicating if MFA is required for this sessioncreated_at: Timestamp when the session was createdlast_used_at: Timestamp of last activity with this session
Sync Job
Represents an initiated sync operation with status, progress, and metadata
Attributes:
job_id: Unique identifier for the sync jobuser_id: Identifier of the user who initiated the jobstatus: Current status (pending, running, completed, failed, cancelled)progress: Percentage of completion (0-100)start_time: Timestamp when the sync startedend_time: Timestamp when the sync completed (if completed)sync_type: Type of sync (activities, health, workouts, etc.)error_message: Error details if the job failedtotal_items: Total number of items to syncprocessed_items: Number of items processed so far
Authentication Token
Secure credential used to access the API on behalf of the user
Attributes:
token_id: Unique identifier for the tokenuser_id: Identifier of the user this token representsaccess_token: The actual access token valuetoken_type: Type of token (Bearer, etc.)expires_in: Time until expiration in secondsscope: Permissions associated with this tokencreated_at: Timestamp when token was createdlast_used_at: Timestamp of last usagemfa_verified: Boolean indicating if MFA was completed for this token
Relationships
- User Session 1 → * Sync Job: A user session can have multiple sync jobs
- Authentication Token 1 → 1 User Session: Each session is associated with one primary auth token
Validation Rules
From Functional Requirements:
- FR-005: Authentication tokens must be stored securely with appropriate file permissions
- FR-008: Expired tokens must be refreshed automatically when possible
- FR-007: All operations must provide clear feedback on success or failure
State Transitions
Sync Job Status Transitions
pending→running(when sync starts)running→completed(when sync finishes successfully)running→failed(when sync encounters an error)pending→cancelled(when user cancels before start)running→cancelled(when user cancels during execution)
Session Expiration
- Active session remains valid until
expires_attimestamp - Session marked as invalid after expiration
- Automatic refresh attempted if refresh token exists