Harvest Finance needs a Vault Model in the backend to manage deposits, withdrawals, and rewards. Contributors will implement the database model and create API endpoints to fetch vault information for the frontend.
This issue lays the foundation for all vault-related features, including Deposit, Withdraw, and Reward Calculation APIs.
Objectives
Design a Vault database model
Implement CRUD API endpoints for vaults
Ensure data validation and integrity
Integrate with the frontend dashboard and vault overview
Requirements
1️⃣ Vault Model
Fields (example):
id: Unique vault ID
name: Vault name
token: Token symbol
apy: Annual Percentage Yield (placeholder for now)
totalDeposits: Total assets deposited
capacity: Max vault size
createdAt, updatedAt
2️⃣ Vault API Endpoints
GET /vaults — List all vaults
GET /vaults/:id — Get details of a single vault
POST /vaults — Create a vault (admin only)
PUT /vaults/:id — Update vault details (admin only)
DELETE /vaults/:id — Delete a vault (admin only)
3️⃣ Data Validation
Ensure required fields are present
Validate token symbols and APY values
Enforce vault capacity limits
Technical Suggestions
Backend: NestJS
Database: PostgreSQL (or Supabase)
ORM: TypeORM (already in use)
Validation: class-validator for DTOs
Follow project REST API structure and naming conventions
Expected Outcome
Vault model fully implemented in the database
API endpoints operational with proper validation
Frontend can fetch vaults for dashboard and landing page
Clean, maintainable code
Acceptance Criteria
Vault endpoints return correct data
Model enforces data integrity
Endpoints tested (unit or integration tests optional but recommended)
Fully documented API routes
Harvest Finance needs a Vault Model in the backend to manage deposits, withdrawals, and rewards. Contributors will implement the database model and create API endpoints to fetch vault information for the frontend.
This issue lays the foundation for all vault-related features, including Deposit, Withdraw, and Reward Calculation APIs.
Objectives
Design a Vault database model
Implement CRUD API endpoints for vaults
Ensure data validation and integrity
Integrate with the frontend dashboard and vault overview
Requirements
1️⃣ Vault Model
Fields (example):
id: Unique vault ID
name: Vault name
token: Token symbol
apy: Annual Percentage Yield (placeholder for now)
totalDeposits: Total assets deposited
capacity: Max vault size
createdAt, updatedAt
2️⃣ Vault API Endpoints
GET /vaults — List all vaults
GET /vaults/:id — Get details of a single vault
POST /vaults — Create a vault (admin only)
PUT /vaults/:id — Update vault details (admin only)
DELETE /vaults/:id — Delete a vault (admin only)
3️⃣ Data Validation
Ensure required fields are present
Validate token symbols and APY values
Enforce vault capacity limits
Technical Suggestions
Backend: NestJS
Database: PostgreSQL (or Supabase)
ORM: TypeORM (already in use)
Validation: class-validator for DTOs
Follow project REST API structure and naming conventions
Expected Outcome
Vault model fully implemented in the database
API endpoints operational with proper validation
Frontend can fetch vaults for dashboard and landing page
Clean, maintainable code
Acceptance Criteria
Vault endpoints return correct data
Model enforces data integrity
Endpoints tested (unit or integration tests optional but recommended)
Fully documented API routes