Added changes for new AcademicYear#749
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (7)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
|
There was a problem hiding this comment.
Code Review
This pull request introduces Kafka event publishing for cohort academic years and cohort members, refines variable naming for consistency, and updates academic year deactivation to include audit metadata. The review feedback highlights an inconsistency in the Kafka event publishing mechanism, recommending the use of an internal wrapper to ensure schema uniformity, and notes a deviation from standard logging patterns in error handling.
| this.kafkaService.publishCohortMemberEvent('created', enrichedData, enrichedData.cohortMembershipId).catch(error => { | ||
| LoggerUtil.error( | ||
| `Failed to publish cohort member created event to Kafka`, | ||
| `Error: ${error.message}`, | ||
| enrichedData.cohortAcademicYearId | ||
| ) | ||
| }) |
There was a problem hiding this comment.
Inconsistent Kafka event publishing. In createCohortMembers, you are calling this.kafkaService.publishCohortMemberEvent directly, whereas in updateCohortMembers (line 792), you use the internal wrapper this.publishCohortMemberEvent. The internal wrapper is designed to enrich the event payload with custom fields (like subject, fees, etc.). Bypassing it here means the 'created' event will have a different schema and less data than the 'updated' event, which can cause issues for downstream consumers.
| this.kafkaService.publishCohortMemberEvent('created', enrichedData, enrichedData.cohortMembershipId).catch(error => { | |
| LoggerUtil.error( | |
| `Failed to publish cohort member created event to Kafka`, | |
| `Error: ${error.message}`, | |
| enrichedData.cohortAcademicYearId | |
| ) | |
| }) | |
| this.publishCohortMemberEvent('created', savedCohortMember, apiId).catch(error => { | |
| LoggerUtil.error( | |
| `Failed to publish cohort member created event to Kafka`, | |
| `Error: ${error.message}`, | |
| apiId | |
| ) | |
| }) |
| LoggerUtil.error( | ||
| `Failed to publish cohort member created event to Kafka`, | ||
| `Error: ${error.message}`, | ||
| enrichedData.cohortAcademicYearId | ||
| ) |
There was a problem hiding this comment.


For creating he new AcademicYear changed added the updatedBY field addition when the acadmicYear in inactivated
Added the kafka pulish Event for cohortAcademicYear for created event