Repository navigation
OBJ-80 — Restore API (creates a new version) - #26
Merged
objectgyan merged 2 commits intoMay 17, 2026
Merged
Conversation
POST /api/documents/{id}/restore?version=N creates a new document_versions
row whose body is copied from version N, with version_number = MAX+1 and
restored_from = N. Version N is never mutated. Returns 404 when the document
or the requested version does not exist.
The restored_from column was already present from the AddDocumentVersions
migration (OBJ-76), so no new migration is required.
OBJ-80 M4.5 — Restore API (creates a new version)
Milestone: M4 · Wave: 2 SummaryImplement Acceptance
Validation
Branch / PRBranch from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /api/documents/{id}/restore?version=Nendpoint that creates a newdocument_versionsrow by copying the body of version N, settingversion_number = MAX+1andrestored_from = N.restored_from(nullable int) column was already present from the OBJ-76AddDocumentVersionsmigration.Changes
IDocumentServiceRestoreVersionAsync(documentId, fromVersionNumber)methodDocumentServiceFOR UPDATElock for monotonic version numberingProgram.csPOST /api/documents/{id:guid}/restoreminimal API endpointRestoreApiTests.csvalidate-obj-80.ps1Test plan
scripts/validate-obj-80.ps1exits 0version_number=4, restored_from=1after restoring v1 of 3-version doc