Skip to content

feat: implement Project mongoose model (#70)#80

Merged
ayshadogo merged 2 commits into
Dfunder:mainfrom
BigBen-7:feature/project-mongoose-model
Jun 21, 2026
Merged

feat: implement Project mongoose model (#70)#80
ayshadogo merged 2 commits into
Dfunder:mainfrom
BigBen-7:feature/project-mongoose-model

Conversation

@BigBen-7

Copy link
Copy Markdown
Contributor

Summary

Closes #70

Implements the full Project/Campaign Mongoose schema as specified in the issue.

Changes

src/models/Project.model.js

  • All required fields: title, description, category, goalAmount, raisedAmount (default 0), currency (default XLM), owner (ref User), stellarAddress, status (draft | pending | active | rejected | completed), coverImage, documents[], startDate, endDate
  • timestamps: true for createdAt / updatedAt
  • Indexes on status and owner

src/__tests__/project.model.test.js (new)

  • 8 unit tests covering: default values, required field validation, enum rejection, all valid enum values, optional fields including subdocuments, and index registration

Test Results

PASS src/__tests__/project.model.test.js
  Project model schema
    ✓ saves with required fields and correct defaults
    ✓ rejects invalid status enum
    ✓ requires title
    ✓ requires owner
    ✓ requires goalAmount
    ✓ accepts all status enum values
    ✓ accepts optional fields
    ✓ has indexes on status and owner

Tests: 8 passed, 8 total

BigBen-7 added 2 commits June 21, 2026 17:39
Resolves Dfunder#70

- Add all required fields: title, description, category, goalAmount,
  raisedAmount (default 0), currency (default XLM), owner (ref User),
  stellarAddress, status (draft|pending|active|rejected|completed),
  coverImage, documents[], startDate, endDate, createdAt, updatedAt
- Add indexes on status and owner fields
- Add unit tests covering defaults, required field validation,
  enum validation, optional fields, and index registration

@ayshadogo ayshadogo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sharp Contributor

@ayshadogo ayshadogo merged commit f4b2279 into Dfunder:main Jun 21, 2026
1 check passed
@grantfox-oss grantfox-oss Bot mentioned this pull request Jun 21, 2026
3 tasks
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.

Create Project Mongoose Model

2 participants