wiki:UseCase03

Use-case 0003 - Add a Pet

Initiating actor: Pet Owner

Other actors: None

Description: A pet owner wants to add a new animal to their profile so they can request services for it. The system provides available pet categories for them to choose from, and then saves the new pet profile into the database.

Scenario:

  1. Pet Owner opens the "My Pets" page and clicks "Add new pet".
  2. System fetches all available pet species so the user can select one from a dropdown menu:
    SELECT pettype_id, species 
    FROM pet_types 
    ORDER BY species ASC;
    
  3. Owner selects "Dog", fills in the pet's name, age, and needs, and submits the form.
  4. System creates the pet record in the database, linking it to the owner:
    INSERT INTO pets (name, photo, age, special_needs, description, owner_id, pettype_id)
    VALUES (
        'Sharka',
        'sharka_photo.png',
        4,
        'Allergic to chicken',
        'A very energetic mixed breed.',
        (SELECT user_id FROM users WHERE username = 'owner_bojan'),
        (SELECT pettype_id FROM pet_types WHERE species = 'Dog')
    );
    
Last modified 2 hours ago Last modified on 05/08/26 02:57:49
Note: See TracWiki for help on using the wiki.