= UseCase05 - Create a Listing ** Initiating actor: Owner ** == Description An owner creates a listing for an animal they own. After creation, the system shows the created listing. == Scenario 1. Owner opens "My Animals" page. {{{ SELECT a.animal_id, a.name, a.sex, a.date_of_birth, a.type, a.species, a.breed, a.located_name FROM animals a WHERE a.owner_id = (SELECT user_id FROM users WHERE username = 'client.mila') ORDER BY a.animal_id DESC; }}} 2. Owner clicks on a specific animal. {{{ SELECT a.animal_id, a.owner_id, a.name, a.sex, a.date_of_birth, a.photo_url, a.type, a.species, a.breed, a.located_name FROM animals a WHERE a.animal_id = 2 AND a.owner_id = (SELECT user_id FROM users WHERE username = 'client.mila'); }}} 3. Clicks on the "Create Listing" button. 4. Owner enters listing information and submits it. 5. System creates the lisitng. {{{ INSERT INTO listings (owner_id, animal_id, status, price, description, created_at) VALUES ( (SELECT user_id FROM users WHERE username = 'client.mila'), (SELECT animal_id FROM animals WHERE name = 'Max' AND owner_id = (SELECT user_id FROM users WHERE username = 'client.mila') LIMIT 1), 'ACTIVE', 45.00, 'A cute male puppy that it is already vaccinated.', NOW() ) RETURNING listing_id; }}}