-
Notifications
You must be signed in to change notification settings - Fork 19
Partial unique index on user_roles; composite lookups, new validators #834
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
Conversation
…k-upload Refactor keying and queries for external entities and CSV invite meta
fix[validation]: organization deactivation validation and error messages(BUG-3834)
fix[db]: create migration for unique user roles index with soft-delete(BUG-3842)
fix[validation]: add profileById validation for user queries(BUG-3833)
fix[validation]: improve validation messages for user role apis (BUG-3835)
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughIntroduces a migration replacing a hard unique constraint with a partial unique index on user_roles. Updates external entity mapping logic and user invite lookups to composite keys. Adds org deactivation pre-checks and a new validator. Tightens user-role validators. Adds a user profile lookup validator. Updates localization strings. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor C as Client
participant V as Validator (v1/admin.deactivateOrg)
participant S as AdminService.deactivateOrg
participant DB as Database
C->>V: Request: DELETE /orgs/:id (tenant-id)
V-->>C: 400 on validation error
V->>S: Validated request
S->>DB: SELECT org by id & tenant
alt Not found
S-->>C: 404 ORG_NOT_FOUND
else Already inactive
S-->>C: 409 ORG_ALREADY_INACTIVE
else Active
S->>DB: UPDATE org set inactive
alt Rows affected == 0
S-->>C: 500 ORG_DEACTIVATION_FAILED
else Success
S->>DB: UPDATE related users inactive (async/next)
S-->>C: 200 Organization deactivated
end
end
sequenceDiagram
autonumber
participant Caller
participant U as utils.fetchAndMapAllExternalEntities
participant Ext as External Source
Caller->>U: fetchAndMapAllExternalEntities()
U->>Ext: Fetch entities
Ext-->>U: Entities with metaInformation
U->>U: normalize(externalId,type) -> key = "externalid|type"
alt externalId or type missing
U->>U: skip entry, keep accumulator
else
U->>U: map[key] = { _id, externalId, entityType, ... }
end
U-->>Caller: composite-keyed map
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🧪 Early access (Sonnet 4.5): enabledWe are currently testing the Sonnet 4.5 model, which is expected to improve code review quality. However, this model may lead to increased noise levels in the review comments. Please disable the early access features if the noise level causes any inconvenience. Note:
Comment |
|
@coderabbitai summary |
✅ Actions performedSummary regeneration triggered. |
|
@coderabbitai summary |
✅ Actions performedSummary regeneration triggered. |
Allow digits in organization names for create/update in v1 validator
Summary by CodeRabbit
New Features
Bug Fixes
Chores