Conversation
orgid normalization script added
Entity-delete-flow
middle-ware-added
config-file-handled
Entity api changes for SCP
package freeze
updated-api-doc
Added state to childHeirarchy
Develop - Staging
Develop - staging
changed-version
Count added for entities find
getting-version-from-package
Sorting in subEntityList API
release notes updated
|
Caution Review failedThe pull request is closed. 📝 WalkthroughWalkthroughThis PR introduces entity deletion capabilities with optional recursive deletion, Kafka event streaming for deletion analytics, admin-role-based authorization, deletion audit logging, and enhanced sub-entity listing with sorting and parent information features. Service version bumped to 3.4.0 with dependency upgrades. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Route as Routes<br/>(Express)
participant AuthMW as checkAdminRole<br/>(Middleware)
participant Controller as Admin<br/>Controller
participant Helper as AdminHelper
participant Database as Database
participant Kafka as Kafka<br/>Producer
Client->>Route: DELETE /admin/deleteEntity/:id
Route->>AuthMW: Validate admin role
AuthMW->>AuthMW: Extract & verify JWT<br/>(Native/Keycloak)
AuthMW->>AuthMW: Extract roles from token
alt Admin Role Present
AuthMW->>Controller: next()
else Non-Admin
AuthMW-->>Client: 403 Forbidden<br/>(ADMIN_ROLE_REQUIRED)
Note over Client: Access denied
end
Controller->>Helper: allowRecursiveDelete<br/>(entityId, allowRecursiveDelete,<br/>tenantId, deletedBy)
Helper->>Database: Check entity exists
alt Entity Not Found
Helper-->>Client: 400 Error<br/>(ENTITY_NOT_FOUND)
end
Helper->>Database: Find related entities<br/>(groups, linked entities)
Helper->>Helper: Build deletion set<br/>(root + recursive)
Helper->>Database: removeDocuments<br/>(deletion filter)
par Post-Deletion Tasks
Helper->>Database: pullEntityFromGroups<br/>(unlink from parent groups)
Helper->>Database: deletionAuditLogs.create<br/>(log deletions)
Helper->>Kafka: pushEntityDeleteKafkaEvent<br/>(entityIds, metadata)
Kafka-->>Kafka: Publish to<br/>RESOURCE_DELETION_TOPIC
end
Helper-->>Controller: Return deletion summary<br/>(counts, IDs)
Controller-->>Client: 200 OK<br/>(ENTITIES_DELETED_SUCCESSFULLY)
sequenceDiagram
participant Client
participant Controller as Entities<br/>Controller
participant Helper as Entities<br/>Helper
participant Database as Database
participant Aggregation as MongoDB<br/>Aggregation
Client->>Controller: GET /entities/subEntityList<br/>?parentInfoRequired=true<br/>&sortOrder=asc<br/>&sortKey=name
Controller->>Helper: subEntityList<br/>(entityId, ..., parentInfoRequired,<br/>sortOrder, sortKey)
Helper->>Helper: Validate sortOrder/sortKey<br/>(asc/desc, name/externalId)
Helper->>Database: Fetch sub-entities<br/>with sorting
alt parentInfoRequired = true
Helper->>Aggregation: Fetch parent hierarchy<br/>(ancestors aggregation)
Aggregation-->>Helper: Parent tree data
Helper->>Helper: Compute hierarchy levels<br/>Build groupEntityMap
Helper->>Helper: Enrich each result<br/>with parent type fields<br/>(labels/names)
end
Helper-->>Controller: Return enriched results<br/>(with parent info, sorted)
Controller-->>Client: 200 OK<br/>(entities with parent details)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Poem
✨ Finishing touches
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.40.5)src/api-doc/Entity Management API's.postman_collection.json/bin/bash: -c: line 1: unexpected EOF while looking for matching `'' 🔧 Gitleaks (8.30.0)src/api-doc/Entity Management API's.postman_collection.json/bin/bash: -c: line 1: unexpected EOF while looking for matching `'' 🔧 Biome (2.1.2)src/api-doc/Entity Management API's.postman_collection.json/bin/bash: -c: line 1: unexpected EOF while looking for matching `'' 🔧 Checkov (3.2.334)src/api-doc/Entity Management API's.postman_collection.json/bin/bash: -c: line 1: unexpected EOF while looking for matching `'' 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 |
staging code migration for 3.4 prod-release
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.