| | 1 | = Use-case 0002 Implementation - Sign up |
| | 2 | |
| | 3 | '''Initiating actor:''' Guest |
| | 4 | |
| | 5 | '''Other actors:''' None |
| | 6 | |
| | 7 | '''Description:''' |
| | 8 | A new guest wants to use the platform to find a sitter or offer services. They must register an account first. The system creates the main user record and links it to the specific role table (in this example Pet Owner) using a secure transaction. |
| | 9 | |
| | 10 | '''Scenario:''' |
| | 11 | 1. Guest clicks on the "Sign up" button. |
| | 12 | 2. Guest fills out their personal details and selects the "I am a Pet Owner" role. |
| | 13 | 3. Guest submits the form. |
| | 14 | 4. System creates the new user account and links it to the Pet Owner subtype table: |
| | 15 | {{{ |
| | 16 | #!sql |
| | 17 | Hibernate: |
| | 18 | select |
| | 19 | u1_0.user_id, |
| | 20 | case |
| | 21 | when u1_1.user_id is not null |
| | 22 | then 1 |
| | 23 | when u1_2.user_id is not null |
| | 24 | then 2 |
| | 25 | when u1_0.user_id is not null |
| | 26 | then 0 |
| | 27 | end, |
| | 28 | u1_0.email, |
| | 29 | u1_0.first_name, |
| | 30 | u1_0.last_name, |
| | 31 | u1_0.password, |
| | 32 | u1_0.username, |
| | 33 | u1_2.user_id |
| | 34 | from |
| | 35 | project.users u1_0 |
| | 36 | left join |
| | 37 | project.pet_owners u1_1 |
| | 38 | on u1_0.user_id=u1_1.user_id |
| | 39 | left join |
| | 40 | project.pet_sitters u1_2 |
| | 41 | on u1_0.user_id=u1_2.user_id |
| | 42 | where |
| | 43 | u1_0.username=? |
| | 44 | Hibernate: |
| | 45 | insert |
| | 46 | into |
| | 47 | project.users |
| | 48 | (email, first_name, last_name, password, username, user_id) |
| | 49 | values |
| | 50 | (?, ?, ?, ?, ?, ?) |
| | 51 | Hibernate: |
| | 52 | insert |
| | 53 | into |
| | 54 | project.pet_owners |
| | 55 | (user_id) |
| | 56 | values |
| | 57 | (?) |
| | 58 | }}} |
| | 59 | 5. System redirects the new user to the home page. |