| Version 4 (modified by , 13 days ago) ( diff ) |
|---|
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
- 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;
- 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');
- Clicks on the "Create Listing" button.
- Owner enters listing information and submits it.
- 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;
Note:
See TracWiki
for help on using the wiki.
