mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-20 09:31:13 -05:00
feat: Implement versioning documentation
This commit is contained in:
34
docs/versioning/API.md
Normal file
34
docs/versioning/API.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# API Reference
|
||||
|
||||
**Complete API documentation for versioning functions and hooks**
|
||||
|
||||
## Database Functions
|
||||
|
||||
### create_relational_version()
|
||||
Trigger function - automatically creates versions on entity INSERT/UPDATE.
|
||||
|
||||
### get_version_diff(entity_type, from_version_id, to_version_id)
|
||||
Returns JSONB diff between two versions.
|
||||
|
||||
### cleanup_old_versions(entity_type, keep_versions)
|
||||
Deletes old versions, keeping N most recent per entity.
|
||||
|
||||
### rollback_to_version(entity_type, entity_id, target_version_id, changed_by, reason)
|
||||
Restores entity to previous version, creates new version with change_type='restored'.
|
||||
|
||||
## React Hooks
|
||||
|
||||
### useEntityVersions(entityType, entityId)
|
||||
Returns: `{ versions, currentVersion, loading, rollbackToVersion, ... }`
|
||||
|
||||
### useVersionComparison(entityType, fromVersionId, toVersionId)
|
||||
Returns: `{ diff, loading, error }`
|
||||
|
||||
## Components
|
||||
|
||||
- `<VersionIndicator />` - Version badge
|
||||
- `<EntityVersionHistory />` - Full timeline
|
||||
- `<VersionComparisonDialog />` - Side-by-side diff
|
||||
- `<RollbackDialog />` - Restore confirmation
|
||||
|
||||
See [FRONTEND.md](./FRONTEND.md) for detailed usage.
|
||||
Reference in New Issue
Block a user