Changes between Version 2 and Version 3 of UseCase05


Ignore:
Timestamp:
01/25/26 14:59:49 (2 weeks ago)
Author:
231035
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • UseCase05

    v2 v3  
    1616  a.located_name
    1717FROM animals a
    18 WHERE a.owner_id = $1
     18WHERE a.owner_id = (SELECT user_id FROM users WHERE username = 'client.mila')
    1919ORDER BY a.animal_id DESC;
    2020}}}
    21212. 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}}}
    22383. Clicks on the "Create Listing" button.
    23394. Owner enters listing information and submits it.
     
    2541{{{
    2642INSERT INTO listings (owner_id, animal_id, status, price, description, created_at)
    27 VALUES ($1, $2, 'ACTIVE', $3, $4, NOW())
     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's already vaccinated.',
     53  NOW()
     54)
    2855RETURNING listing_id;
    2956}}}