p7-projekt / api-backend

Backend API
MIT License
0 stars 0 forks source link

Fixes/71 ensures the check for if exercises exists is done in the ins… #72

Closed KristianS93 closed 1 week ago

KristianS93 commented 1 week ago

Description

Solves the data race when trying to create a session. As I understand it, if another transaction deletes an exercise during an insertion transaction, the transaction will fail based on the foreign key constraints. The verification if the exercises are available for the author is now done inside the transaction, thus we can interrupt the transaction if the exercises does not belong to the user inside the given transaction.

Resolved Issue

Fixes #71

Changes

Remove a function from exercise repo and add a new to session repo and change the function in session service