== User opens dashboard == === Actors === User === Scenario === 1. The user clicks on the button with their username [[Image(clickUsername.png)]] 2. A dashboard with their information, favorited builds and their own builds is displayed. {{{ SELECT username, email FROM users WHERE id = $userId LIMIT 1; }}} {{{ SELECT id, user_id, name, created_at, total_price FROM build WHERE user_id = $userId ORDER BY created_at DESC; }}} {{{ SELECT b.id, b.user_id, b.name, b.created_at, b.total_price, COALESCE(AVG(rb.value::float), 0) AS avgRating FROM build AS b INNER JOIN favorite_build AS fb ON b.id = fb.build_id LEFT JOIN rating_build AS rb ON b.id = rb.build_id WHERE fb.user_id = $userId GROUP BY b.id, b.user_id, b.name, b.created_at, b.total_price ORDER BY COALESCE(AVG(rb.value::float), 0) DESC; }}} [[Image(userDashboard.png)]]