Skip to content

feat: define ingestion payload schema with Zod validation #15 - #25

Closed
AayushJB03 wants to merge 1 commit into
madhav2348:mainfrom
AayushJB03:feat/ingestion-payload-schema
Closed

feat: define ingestion payload schema with Zod validation #15#25
AayushJB03 wants to merge 1 commit into
madhav2348:mainfrom
AayushJB03:feat/ingestion-payload-schema

Conversation

@AayushJB03

Copy link
Copy Markdown

Fixes #15

What this does

  • Adds src/server/types/ingestion.ts — Zod discriminated union schemas for all three ingestion sources (local, cloud/gdrive, telegram), with inferred TypeScript types exported as the shared source of truth
  • Updates POST /api/screenshots to validate both multipart/form-data (local file upload) and application/json (cloud/telegram) payloads via Zod, returning structured 400 responses with field-level error details
  • Adds API.md documenting all payload shapes, required/optional fields, and response formats

Changes

  • src/server/types/ingestion.ts (new)
  • src/app/api/screenshots/route.ts (updated)
  • API.md (new)
  • package.json / package-lock.json — adds zod

…av2348#15)

- Add src/server/types/ingestion.ts with Zod discriminated union schemas
  for local, cloud (gdrive), and telegram screenshot sources
- Export inferred TypeScript types as shared source of truth
- Update POST /api/screenshots to validate multipart/form-data (local)
  and application/json (cloud/telegram) with structured 400 error responses
- Add API.md documenting all payload shapes, fields, and response formats
@madhav2348

madhav2348 commented Jun 6, 2026

Copy link
Copy Markdown
Owner

Have you tested these changes you made @AayushJB03

@AayushJB03

Copy link
Copy Markdown
Author

No @madhav2348 I will test them once and let you know

@AayushJB03

Copy link
Copy Markdown
Author

I ran the TypeScript compiler check (tsc --noEmit) and ESLint — both pass with zero errors. The Zod schemas are fully typed and the route handler compiles correctly. @madhav2348
For a full runtime test I'd need the .env set up to start the dev server. Happy to do that if you can confirm the required environment variables, or I can add a test file if you'd prefer that approach.

@madhav2348

Copy link
Copy Markdown
Owner

good for now but you have to make pr in develop branch as per guidlines

@madhav2348 madhav2348 closed this Jun 14, 2026
@madhav2348

Copy link
Copy Markdown
Owner

duplicate #60

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Define accepted payload schema for local, cloud, and Telegram screenshot inputs

2 participants