Repository navigation
Conversation
|
@olatechy0 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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
Adds a read-only contract revision history so clients and freelancers can see every change made to a contract, who made it, and when.
Closes #240
What's included
lib/db/migrations/012_contract_revisions.sql— append-onlycontract_revisionstable storing a full contract + milestone snapshot per revision. A trigger rejectsUPDATE/DELETEso history cannot be altered. Existing contracts are backfilled with a baseline snapshot.lib/contracts/revisions.ts— snapshot loading, diffing (budget, deadline, scope, status, currency), baseline bootstrapping and revision recording.app/api/contracts/[id]/revisions/route.ts— GET only. Returns 404 for unknown contract/user and 403 unless the caller is the contract's client or freelancer.app/api/milestones/[id]/route.ts— records a baseline (pre-change) and an update revision (post-change) around milestone edits, which is where budget, deadline and scope change.components/dashboard/contract-revision-history.tsx— revision timeline with author and timestamp, expandable highlighted diffs, side-by-side milestone comparison, responsive on mobile and desktop.app/dashboard/contracts/[id]/page.tsx— mounts the history section below the activity timeline.Acceptance criteria
diffSnapshots()+ colour-coded change rowsauthor_id/author_walletjoined tousers, rendered per rowTests
__tests__/lib/contract-revisions.test.ts— 7 diff cases__tests__/api/contract-revisions.test.ts— 6 route cases (read-only exports, 404s, 403, happy path, failure)__tests__/components/contract-revision-history.test.tsx— 3 component casesAll 16 pass.
eslintis clean on the changed files. The 3 failing test files in the full suite (deliverables, reviews, recommendations) fail identically onmainbefore this branch.