Skip to content

[Feature]: Proposal Management API #216

Description

@SudiptaPaul-31

🔍 Problem Statement

Description

Implement backend APIs to handle freelancer proposals for client projects. This service will allow freelancers to submit, update, and delete proposals, while enabling clients to fetch and review them. It must enforce authorization, prevent duplicates, and manage proposal lifecycle states.


Endpoints

  • POST /api/projects/:projectId/proposals

    • Create a new proposal for a given project.
    • Body: { message, budget, deliveryTime, milestones? }
  • GET /api/projects/:projectId/proposals

    • Retrieve all proposals for a given project.
    • Supports query params for filtering by status.
  • PATCH /api/proposals/:id

    • Update an existing proposal (message, budget, delivery time, milestones).
    • Only allowed if proposal is still under review.
  • DELETE /api/proposals/:id

    • Remove a proposal.
    • Restricted to the freelancer who created it.

Requirements

  • Freelancer authorization — only authenticated freelancers can submit, update, or delete their own proposals.
  • Duplicate proposal prevention — enforce one active proposal per freelancer per project. Updates allowed, but no duplicate submissions.
  • Proposal status management — statuses include Submitted, Under Review, Accepted, Rejected, Updated.
  • Input validation — use Zod or equivalent schema validation for request payloads.

Acceptance Criteria

  • ✅ Authorization checks — proposals cannot be created/modified/deleted without valid freelancer authentication.
  • ✅ Duplicate prevention — backend rejects multiple submissions for the same project by the same freelancer.
  • ✅ Status transitions — proposals move through defined states; invalid transitions are blocked.
  • ✅ Validation errors — clear error messages returned for invalid inputs.
  • ✅ Consistent response format — all endpoints return structured JSON with success, data, and errors.
  • ✅ Empty and loading states — GET requests handle projects with no proposals gracefully.

Additional Notes

  • Database design:

    • Proposal table should include id, projectId, freelancerId, message, budget, deliveryTime, milestones, status, createdAt, updatedAt.
    • Indexes on projectId and freelancerId for efficient lookups.
  • Error handling:

    • Return 409 Conflict for duplicate proposals.
    • Return 403 Forbidden for unauthorized actions.
    • Return 404 Not Found for invalid proposal IDs.
  • Scalability:

    • Support pagination for GET requests.
    • Consider caching frequently accessed proposals.

Future Enhancements

  • 🔹 Proposal comparison API for clients.
  • 🔹 WebSocket/real-time updates for proposal status changes.
  • 🔹 Analytics endpoints (average budget, delivery time trends).

📈 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