Skip to content

feat: implement POST /api/projects endpoint (#323)#495

Open
DevKingOche wants to merge 1 commit into
dev-fatima-24:mainfrom
DevKingOche:feat/323-post-projects-endpoint
Open

feat: implement POST /api/projects endpoint (#323)#495
DevKingOche wants to merge 1 commit into
dev-fatima-24:mainfrom
DevKingOche:feat/323-post-projects-endpoint

Conversation

@DevKingOche
Copy link
Copy Markdown

Summary

Closes #323

Changes

  • Added CreateProjectDto with class-validator decorators for all required fields: name, methodology, coordinates, description, documents
  • Added CoordinatesDto for nested coordinate validation (lat, lng)
  • Added createProject() service method that:
    • Stores project metadata in PostgreSQL via Prisma
    • Uses the first document CID as metadataCid (IPFS document reference)
    • Returns projectId, id, txHash, status, and metadataCid
  • Added POST /projects route scoped to project_developer and admin roles

Testing

POST /api/v1/projects
{
  "name": "Amazon Reforestation",
  "methodology": "VCS",
  "description": "Reforestation project in the Amazon basin",
  "coordinates": { "lat": -3.4653, "lng": -62.2159 },
  "documents": ["QmXoypizjW3WknFiJnKLwHCnL72vedxjQkDDP1mXWo6uco"]
}

Returns 400 with field-level errors on missing/invalid fields.

- Add CreateProjectDto with class-validator decorators for name,
  methodology, coordinates, description, and documents fields
- Add createProject() service method that stores project metadata
  in PostgreSQL, uses first document CID as metadataCid, and
  returns projectId and txHash
- Add POST /projects route scoped to project_developer and admin roles
- Returns 400 with field-level errors on invalid input via global ValidationPipe

Closes dev-fatima-24#323
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@DevKingOche 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! 🚀

Learn more about application limits

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BACKEND] Implement POST /api/projects endpoint for project registration

1 participant