Skip to content

feat(backend): env validation with Joi + submissions module#50

Open
middalukawunti-lang wants to merge 1 commit into
BountyOnChain:mainfrom
middalukawunti-lang:feat/env-validation-and-submissions-module
Open

feat(backend): env validation with Joi + submissions module#50
middalukawunti-lang wants to merge 1 commit into
BountyOnChain:mainfrom
middalukawunti-lang:feat/env-validation-and-submissions-module

Conversation

@middalukawunti-lang
Copy link
Copy Markdown

Summary

Resolves both issues assigned to @middalukawunti-lang.


Issue #12 — chore(backend): add environment validation with Joi

  • Installed @nestjs/config and joi
  • ConfigModule.forRoot with a Joi schema validating:
    • DATABASE_URL (required)
    • JWT_SECRET (required)
    • STELLAR_NETWORK — must be testnet or mainnet (required)
    • PORT — defaults to 4000
  • App now fails fast with a clear error if any required var is missing
  • TypeOrmModule migrated to forRootAsync so it reads from ConfigService
  • .env.example updated with all required keys and descriptions

Closes #12


Issue #9 — feat(backend): scaffold submissions module

New module at src/submissions/ with full CRUD + approval flow:

Method Route Auth Description
POST /bounties/:id/submissions JWT Create a submission (link + optional notes)
GET /bounties/:id/submissions JWT (owner only) List submissions for a bounty
PATCH /bounties/:id/submissions/:subId/approve JWT (owner only) Approve + trigger Soroban release call
PATCH /bounties/:id/submissions/:subId/reject JWT (owner only) Reject a submission
  • Only one submission can be approved per bounty (returns 400 otherwise)
  • Approving marks the bounty as COMPLETED
  • Soroban contract release is called via @stellar/stellar-sdk on approval (skipped gracefully if SOROBAN_CONTRACT_ID is not set)
  • Added optional notes column to Submission entity

Closes #9

- Issue BountyOnChain#12: add ConfigModule.forRoot with Joi schema validating
  DATABASE_URL, JWT_SECRET, STELLAR_NETWORK (testnet|mainnet), PORT
  (default 4000); app fails fast on missing vars; update .env.example

- Issue BountyOnChain#9: scaffold submissions module
  POST   /bounties/:id/submissions              — create (JWT required)
  GET    /bounties/:id/submissions              — list (owner only, JWT)
  PATCH  /bounties/:id/submissions/:s/approve  — approve + Soroban release call
  PATCH  /bounties/:id/submissions/:s/reject   — reject (owner only, JWT)
  Enforces one approval per bounty.

Closes BountyOnChain#9, Closes BountyOnChain#12
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.

chore(backend): add environment validation with Joi feat(backend): scaffold submissions module

1 participant