Changes between Initial Version and Version 1 of UseCase05PrototypeImplementation


Ignore:
Timestamp:
02/07/26 20:06:26 (20 hours ago)
Author:
231035
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UseCase05PrototypeImplementation

    v1 v1  
     1= UseCase05 - Create a Listing
     2** Initiating actor: Owner **
     3== Description
     4An owner creates a listing for an animal they own. After creation, the system shows the created listing.
     5== Scenario
     61. Owner opens "My Animals" page.
     7{{{
     8SELECT
     9  a.animal_id,
     10  a.name,
     11  a.sex,
     12  a.date_of_birth,
     13  a.type,
     14  a.species,
     15  a.breed,
     16  a.located_name
     17FROM animals a
     18WHERE a.owner_id = (SELECT user_id FROM users WHERE username = 'client.mila')
     19ORDER BY a.animal_id DESC;
     20}}}
     212. Owner clicks on a specific animal.
     22{{{
     23SELECT
     24  a.animal_id,
     25  a.owner_id,
     26  a.name,
     27  a.sex,
     28  a.date_of_birth,
     29  a.photo_url,
     30  a.type,
     31  a.species,
     32  a.breed,
     33  a.located_name
     34FROM animals a
     35WHERE a.animal_id = 2
     36  AND a.owner_id = (SELECT user_id FROM users WHERE username = 'client.mila');
     37}}}
     383. Clicks on the "Create Listing" button.
     394. Owner enters listing information and submits it.
     405. System creates the lisitng.
     41{{{
     42INSERT INTO listings (owner_id, animal_id, status, price, description, created_at)
     43VALUES (
     44  (SELECT user_id FROM users WHERE username = 'client.mila'),
     45  (SELECT animal_id
     46   FROM animals
     47   WHERE name = 'Max'
     48     AND owner_id = (SELECT user_id FROM users WHERE username = 'client.mila')
     49   LIMIT 1),
     50  'ACTIVE',
     51  45.00,
     52  'A cute male puppy that it is already vaccinated.',
     53  NOW()
     54)
     55RETURNING listing_id;
     56}}}
     57
     58
     59
     60
     61