Skip to content

239 240 241 242 schema validation fixes - #388

Merged
Mystery-CLI merged 5 commits into
Ethereal-Future:mainfrom
Xoulomon:239-240-241-242-schema-validation-fixes
Apr 24, 2026
Merged

239 240 241 242 schema validation fixes#388
Mystery-CLI merged 5 commits into
Ethereal-Future:mainfrom
Xoulomon:239-240-241-242-schema-validation-fixes

Conversation

@Xoulomon

Copy link
Copy Markdown
Contributor

Changes Implemented

Issue #242: Consolidate Duplicate User Model Field Blocks

  • File: backend/prisma/schema.prisma
  • Change: Consolidated the User model which had duplicate field declarations
  • Impact: Fixes Prisma client generation errors caused by duplicate id, publicKey, createdAt, updatedAt, sentTxs, and receivedTxs fields
  • Commit: 309c33b

Issue #239: Add Database Index on PaymentStream

  • File: backend/prisma/schema.prisma
  • Change: Added composite index @@index([status, lastProcessedAt]) to PaymentStream model
  • Impact: Optimizes streaming worker queries that filter by status = 'ACTIVE' and check lastProcessedAt, eliminating full table scans
  • Performance: Significantly improves query performance for active payment stream processing
  • Commit: 6edc9f6

Issue #240: Change dateOfBirth from String to DateTime

  • Files:
    • backend/prisma/schema.prisma - Schema type change
    • backend/src/compliance/kycCollector.js - Validation logic
  • Changes:
    • Changed dateOfBirth field type from String to DateTime in KYCRecord model
    • Added validation in kycCollector.submitKYC() to ensure dateOfBirth is a valid date
    • Converts input to ISO string format for consistent storage
  • Impact: Prevents invalid date strings (e.g., "yesterday", "N/A") from being stored; enables proper age verification and date comparison logic
  • Commits: a7a6287, 6aa9fec

Issue #241: Add Validation for Quiet Hours

  • File: backend/src/notifications/preferences.js
  • Change: Added application-level validation in updatePreferences() function
  • Validation Rules:
    • quietHoursStart must be an integer between 0-23
    • quietHoursEnd must be an integer between 0-23
    • Throws descriptive error messages for invalid values
  • Impact: Prevents invalid quiet hour values (e.g., 25, -1) from breaking notification logic
  • Defense-in-Depth: Complements existing express-validator checks in the route handler
  • Commit: 75ae7d8

Testing Recommendations

  • Verify Prisma client generates successfully: npx prisma generate
  • Test KYC submission with invalid dates: "invalid-date", "2026-13-45", etc.
  • Test quiet hours validation with boundary values: 0, 23, 24, -1
  • Verify PaymentStream queries use the new index (check query plans)
  • Run existing test suite to ensure no regressions

Migration Notes

Closes

Closes #239
Closes #240
Closes #241
Closes #242

@drips-wave

drips-wave Bot commented Apr 24, 2026

Copy link
Copy Markdown

@Xoulomon Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Mystery-CLI
Mystery-CLI merged commit 4e21f03 into Ethereal-Future:main Apr 24, 2026
8 of 29 checks passed
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.

has duplicate model field blocks quiet hours not validated as 0–23 is a — no date validation has no database index on +

3 participants