release: v3.3.22 – develop → staging#844
Conversation
…es; update tenantQueries to fetch raw data
…leForApprovedRequest to broadcast user update events
… environment variables
Adopt old/new event payloads and replace change-sets with extractDelta
feat(auth): allow admin override of tenant/org
…o add-db-find-api
feat(admin): add raw SELECT query execution API with pagination
|
@coderabbitai summary |
✅ Actions performedSummary regeneration triggered. |
|
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 ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
WalkthroughIntroduces env-driven header constants and admin override logic, adds raw SQL query execution feature for admins with validation utilities, switches DTO event payloads from changedValues to oldValues/newValues, implements delta extraction, updates tenant/organization services to use deltas and raw Sequelize returns, adjusts controllers to new headers, extends locales, and registers a new distributed table. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant AdminClient as Admin Client
participant AdminController as Controller: admin.executeRawQuery
participant Validator as Validator
participant RawUtils as rawQueryUtils
participant AdminService as Service: AdminHelper
participant DB as Database
AdminClient->>AdminController: POST /v1/admin/raw-query { query, pageNo, pageSize }
AdminController->>Validator: validate(req)
Validator-->>AdminController: ok | error
alt validation ok
AdminController->>AdminService: executeRawQuery(query, adminUserId, pageNo, pageSize)
AdminService->>RawUtils: validateQuerySecurity(query)
RawUtils-->>AdminService: ok | error
alt secure
AdminService->>RawUtils: getPaginationParams(pageNo, pageSize)
RawUtils-->>AdminService: { limit, offset }
AdminService->>DB: SELECT ... LIMIT/OFFSET
DB-->>AdminService: rows
AdminService->>DB: SELECT COUNT(*) FROM (query) t
DB-->>AdminService: total
AdminService-->>AdminController: { rows, pageNo, pageSize, total }
AdminController-->>AdminClient: 200 payload
else insecure
AdminService-->>AdminController: error
AdminController-->>AdminClient: 400/422 error
end
else validation error
AdminController-->>AdminClient: 400 error
end
sequenceDiagram
autonumber
participant Client as Client
participant Auth as Middleware: authenticator
participant OrgQueries as organizationQueries
participant Next as Next Handler
Client->>Auth: Request with token + headers
Auth->>Auth: Decode token -> decodedToken
alt role === ADMIN and override headers present
Auth->>Auth: Read headers (ORG_CODE_HEADER, TENANT_CODE_HEADER)
Auth->>OrgQueries: getByCode(tenant_code, org_code)
OrgQueries-->>Auth: organization { id, code } | null
alt organization found
Auth->>Auth: Override decodedToken { organization_id, organization_code, tenant_code }
Auth-->>Next: proceed early
else not found
Auth-->>Client: 400 INVALID_ORG_OR_TENANT_CODE
end
else non-admin or no overrides
Auth->>Auth: Use tenant_code from header/domain
Auth-->>Next: proceed
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (22)
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. Comment |
Summary by CodeRabbit