-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(schema): add gender and nationality fields to EndUser model #2991
Conversation
- Introduce Gender enum to represent user gender options - Add nationality and passportNumber fields to EndUser model - Refactor Alert model for better readability (Your schema changes are so dramatic, they deserve a Netflix series)
WalkthroughThis pull request introduces enhancements to the EndUser model in the workflows service database schema. A new Gender enum is created with 'male', 'female', and 'other' values. The EndUser table is expanded with optional fields for address (as a JSONB object), gender, nationality, and passport number. Accompanying migration SQL script and Prisma schema are updated to reflect these changes, with minor formatting adjustments to other models like Alert and Counterparty. Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
services/workflows-service/prisma/migrations/20250127124649_add_enduser_fields/migration.sql (1)
4-8
: Consider adding column length constraints for VARCHAR fields.While the implementation is correct, it's recommended to specify maximum lengths for VARCHAR columns to prevent potential data issues.
ALTER TABLE "EndUser" ADD COLUMN "address" JSONB, ADD COLUMN "gender" "Gender", -ADD COLUMN "nationality" VARCHAR, -ADD COLUMN "passportNumber" VARCHAR; +ADD COLUMN "nationality" VARCHAR(2), +ADD COLUMN "passportNumber" VARCHAR(50);services/workflows-service/prisma/schema.prisma (1)
80-83
: Consider adding field validations for nationality and passport.While the implementation is correct, consider adding:
- Field validation for nationality using ISO 3166-1 alpha-2 country codes
- Length constraints for passport numbers
// Add these validators in your API layer const validateNationality = (nationality: string) => { return /^[A-Z]{2}$/.test(nationality.toUpperCase()); }; const validatePassport = (passport: string) => { return passport.length <= 50; };
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
services/workflows-service/prisma/migrations/20250127124649_add_enduser_fields/migration.sql
(1 hunks)services/workflows-service/prisma/schema.prisma
(6 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: Analyze (javascript)
- GitHub Check: test_windows
- GitHub Check: test_linux
- GitHub Check: build (windows-latest)
- GitHub Check: lint
- GitHub Check: build (ubuntu-latest)
🔇 Additional comments (4)
services/workflows-service/prisma/migrations/20250127124649_add_enduser_fields/migration.sql (1)
1-2
: LGTM! Gender enum implementation looks good.The enum values follow SQL naming conventions and include standard gender options.
services/workflows-service/prisma/schema.prisma (3)
56-60
: LGTM! Gender enum is well-defined.The enum values are consistent with the SQL migration and follow Prisma conventions.
835-836
: LGTM! Formatting changes in Alert model.The changes only involve formatting improvements, maintaining the same functionality.
Also applies to: 846-847, 856-858
914-916
: LGTM! Formatting changes in Counterparty model.The changes only involve formatting improvements for relation names, maintaining the same functionality.
|
(Your schema changes are so dramatic, they deserve a Netflix series)
Summary by CodeRabbit
New Features
Refactor