feat(api): GET /changelog/{entryId}/diff — full before/after schemas

This commit is contained in:
Александр Зимин
2026-05-12 08:51:28 +00:00
parent aa5fcac0fc
commit 72268f9add
4 changed files with 194 additions and 0 deletions
+34
View File
@@ -100,6 +100,40 @@ Time-travel modal — список всех schema versions с change summaries.
**Complexity:** medium. Нужна таблица `dictionary_schema_history` (если
ещё нет — версия + JSON snapshot + author + timestamp).
### 1.1 Full diff payload — `GET /api/v1/dictionaries/{name}/changelog/{entryId}/diff`
✅ Shipped v2.4.0+ (MR !120).
Возвращает полные `before` / `after` schemas для конкретной changelog
entry — фронт делает side-by-side render в History tab / TimeTravel
preview. `entryId` приходит из `ChangelogEntry.id` field.
Response:
```json
{
"id": 4711,
"dictionaryName": "satellite",
"eventType": "DEFINITION_UPDATED",
"kind": "definition_update",
"occurredAt": "2026-05-12T10:00:00Z",
"publishedBy": { "sub": "u-42", "name": "zimin.an" },
"before": { "type": "object", "properties": { ... } },
"after": { "type": "object", "properties": { ... } },
"summary": {
"added": ["properties.altitude"],
"removed": [],
"changed": ["properties.operator"]
}
}
```
Errors:
- 404 `changelog_entry_not_found` — id не существует, принадлежит
другому dict'у, либо не schema-timeline event (record-level/unrelated).
Existence не утекает через ID enumeration (одинаковая ошибка для
всех 404 кейсов).
---
## 2. Records snapshots — `GET /api/v1/dictionaries/{name}/snapshots`