Currently the Employee-Section relationship is inconsistent and bidirectional:
- Employee has a free text String section field instead of a proper reference
- Section stores a List employeeIds creating a bidirectional relationship
that requires keeping two places in sync
The relationship should be owned by Employee only, same pattern as Loan owning
references to Book and Customer.
Tasks
- Replace String section in Employee with String sectionId referencing the Section MongoDB ID
- Remove employeeIds list from Section — employee owns the relationship
- Add findBySectionId(String sectionId) to EmployeeRepository
- Update EmployeeService and EmployeeController accordingly
- Update SectionService and SectionController accordingly
Note
This is a breaking change — existing employee documents will need migration.
Currently the Employee-Section relationship is inconsistent and bidirectional:
that requires keeping two places in sync
The relationship should be owned by Employee only, same pattern as Loan owning
references to Book and Customer.
Tasks
Note
This is a breaking change — existing employee documents will need migration.