Skip to content

[Backend] Admin and indexer mutation routes use ad-hoc inline validation instead of zod middleware #17

Description

@grantfox-oss

Telegram (ask questions / claim the issue here first): https://t.me/+DOylgFv1jyJlNzM0

Why this matters

Several mutating endpoints (webhook creation in src/controllers/indexerController.ts lines 494-520, reindex and quarantine-reprocess in adminRoutes) validate input with hand-written checks rather than the project's validate() + zod pattern used elsewhere, leading to inconsistent error shapes and gaps.

Acceptance criteria

  • Define zod schemas for webhook creation, reindex query params and quarantine reprocess bodies
  • Apply the existing validation middleware and remove the inline checks
  • Ensure error responses match the standardized zod error format from errorHandler
  • Add tests for invalid inputs on these routes

Files to touch

  • src/controllers/indexerController.ts
  • src/routes/adminRoutes.ts
  • src/routes/indexerRoutes.ts
  • src/middleware/validation.ts

Out of scope

  • Reworking the auth model on these routes
  • Adding new endpoints

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial CampaignCampaign: Official CampaignenhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions