Make ChildSchoolRelation part of Child entity #693
Labels
Status: Idea
to be considered and discussed - don't start work yet
Type: Improvement
Improvement/Extension of existing feature with benefit for the user
Type: Refactoring / Technical Enh.
Technical Enhancement without changes for the user
Milestone
Problem
Currently, we have the
ChildSchoolRelation
objects which link children to schools in a M:N relationship. This has quite bad performance, because often additional database requests need to be made for linked entities (in theChildrenService
, a call needs to be made for each child to get the current school).Solution
Make the
ChildSchoolRelation
part of theChild
entity by adding aschoolHistroy
property to this class. This property is an array of objects, which contain the ID of the visited school, the class and a start and end date. To make it possible to get all children that are currently visiting a certain school, a view needs to be built which for each child emits theschooldID
for each entry inschoolHistory
that does not have an end date (and directly include the child document using linked documents.A data migration for current users needs to be implemented.
Outlook
This solution could be implemented very flexible. Which would allow to define any kind of M:N relationship as a property. It could be evaluated whether this can be one with a moderate amount of work.
The text was updated successfully, but these errors were encountered: