Skip to content

[Feature]: Proposal Acceptance & Contract Creation Service #217

Description

@SudiptaPaul-31

🔍 Problem Statement

Description

When a client accepts a freelancer’s proposal, the system should automatically generate a corresponding contract record. This ensures a seamless transition from proposal stage to contract execution, while maintaining data integrity and preventing conflicts.


Flow

  1. Proposal Accepted — client confirms acceptance of a freelancer’s proposal.
  2. Validate Project — ensure the project is active, not already bound to another accepted proposal.
  3. Create Contract — generate a new contract record linked to the accepted proposal.
  4. Create Milestones — initialize contract milestones based on the proposal’s breakdown (if provided).
  5. Initialize Escrow Status — set escrow state to Pending Funding until client deposits funds.

Acceptance Criteria

  • ✅ Database transaction for atomicity — all steps (proposal acceptance → contract creation → milestone setup → escrow initialization) must occur within a single transaction to prevent partial state.
  • ✅ Prevent multiple accepted proposals per project — enforce uniqueness so only one proposal can be accepted per project.
  • ✅ Maintain proposal → contract relationship — contracts must reference the originating proposal ID for traceability.
  • ✅ Status updates — proposal status changes to Accepted, contract status set to Draft or Pending Funding.
  • ✅ Error handling — rollback transaction if any step fails (e.g., milestone creation error).

Additional Notes

  • Data model considerations:

    • Proposal → Contract one-to-one relationship.
    • Contract → Milestones one-to-many relationship.
    • Escrow state tied to contract lifecycle.
  • Authorization:

    • Only clients can accept proposals.
    • Freelancers cannot trigger contract creation directly.
  • Audit trail:

    • Log acceptance event, contract creation, and escrow initialization with timestamps and actor IDs.

Future Enhancements

  • 🔹 Automatic notification to freelancer upon contract creation.
  • 🔹 Smart contract integration (blockchain-based escrow).
  • 🔹 Contract versioning for milestone updates.
  • 🔹 Analytics on proposal-to-contract conversion rates.

📈 Expected Impact

High — Would significantly improve user experience

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions