| | 1 | == User opens dashboard == |
| | 2 | |
| | 3 | === Actors === |
| | 4 | User, Admin |
| | 5 | |
| | 6 | === Scenario === |
| | 7 | 1. The user opens the completed builds page, opens the details popup for a build |
| | 8 | 2. The user can click on the "ADD TO FAVORITES" button to toggle whether the build is favorited or not |
| | 9 | |
| | 10 | {{{ |
| | 11 | SELECT 1 |
| | 12 | FROM favorite_build |
| | 13 | WHERE user_id = $userId AND build_id = $buildId |
| | 14 | LIMIT 1; |
| | 15 | |
| | 16 | -- if favorite |
| | 17 | DELETE FROM favorite_build |
| | 18 | WHERE user_id = $userId AND build_id = $buildId; |
| | 19 | |
| | 20 | -- if NOT favorite |
| | 21 | INSERT INTO favorite_build (user_id, build_id) |
| | 22 | VALUES ($userId, $buildId); |
| | 23 | }}} |