Skip to content

[Database] - Fixed ManyToMany relations - #572

Merged
thomasdejaeghere merged 3 commits into
developmentfrom
549-many-to-many-relations-take-2
May 16, 2025
Merged

[Database] - Fixed ManyToMany relations#572
thomasdejaeghere merged 3 commits into
developmentfrom
549-many-to-many-relations-take-2

Conversation

@brieromb

Copy link
Copy Markdown
Contributor

removed the explicit userOfClass and studentOfGroup tables. Replaced that by many to many relations in the group and class tables.

@brieromb brieromb added this to the Milestone 3 milestone May 15, 2025
@brieromb brieromb self-assigned this May 15, 2025
@brieromb brieromb added enhancement New feature or request backend labels May 15, 2025
@brieromb
brieromb marked this pull request as ready for review May 15, 2025 16:16
@thomasdejaeghere

Copy link
Copy Markdown
Contributor

@brieromb Do we have a tests that checks if it's possible to add a student twice to a class or group. Because we need to be sure that fails. (make combo, userid and classid unique in classtypeorm f.e.)

@brieromb

brieromb commented May 16, 2025

Copy link
Copy Markdown
Contributor Author

@thomasdejaeghere TypeORM will make a table for this ManyToMany relation with primary key: the combination of a key from each of the 2 tables.

So adding a student twice to a group or a class should not be possible, as combinations of group/student are unique.

EDIT: wrote a test to confirm this, and adding a student to the same group twice is indeed not possible

@thomasdejaeghere thomasdejaeghere left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A nice addition to the database, makes everything more readable and eliminates the big queries

@thomasdejaeghere
thomasdejaeghere merged commit 9574f92 into development May 16, 2025
@thomasdejaeghere
thomasdejaeghere deleted the 549-many-to-many-relations-take-2 branch May 16, 2025 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants