feat: add off-chain document reference handling for milestones#88
Open
Austinaminu2 wants to merge 1 commit intoDisciplr-Org:mainfrom
Open
feat: add off-chain document reference handling for milestones#88Austinaminu2 wants to merge 1 commit intoDisciplr-Org:mainfrom
Austinaminu2 wants to merge 1 commit intoDisciplr-Org:mainfrom
Conversation
Contributor
|
@can you resolve the conflicts? |
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.
Closes #19
What this PR does
Implements support for milestones that reference off-chain documents (URLs + optional content hashes stored in DB).
Files added
db/migrations/20260226000000_add_milestone_document_references.cjs— migration for milestone_document_references tablesrc/types/milestoneDocument.ts— TypeScript interfaces for document reference schemasrc/services/milestoneDocumentValidator.ts— validation service for URLs and content hashessrc/routes/milestoneDocuments.ts— REST endpoints for creating and querying document referencessrc/services/milestoneDocumentValidator.test.ts— 24 unit testsFiles modified
src/index.ts— mounts /api/milestone-documents routerpackage.json— fixed pre-existing JSON syntax errors (duplicate keys, missing commas)jest.config.ts— updated testMatch to cover src/**/*.test.tsSchema
Table:
milestone_document_referencesid— primary keyvault_id— foreign key to vaultslabel— human-readable name for the documenturl— https URL to the off-chain document (max 2048 chars)content_hash— optional hex-encoded hash for integrity verificationhash_algorithm— sha256 or sha512created_at,updated_atAPI endpoints
POST /api/milestone-documents— create a document referenceGET /api/milestone-documents?vaultId=<id>— list references for a vaultGET /api/milestone-documents/:id— get a single referenceDELETE /api/milestone-documents/:id— remove a referenceSecure URL handling strategy
https://URLs are accepted — http, ftp, data URIs are all rejectedALLOWED_DOC_DOMAINSenvironment variable (comma-separated hostnames). Subdomains are also matched. If not set, any https domain is accepted.Content hash validation
Tests
All 24 tests pass: