Changes between Initial Version and Version 1 of RemoveComponentFromBuild


Ignore:
Timestamp:
12/29/25 01:16:08 (16 hours ago)
Author:
233051
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RemoveComponentFromBuild

    v1 v1  
     1== Add component to build ==
     2
     3=== Actors ===
     4User, Admin
     5
     6=== Scenario ===
     71. In the forge, after the user chooses the desired existing component they click on the trash can icon
     82. The server removes the component from the build
     9
     10{{{
     11BEGIN;
     12
     13SELECT *
     14FROM build
     15WHERE id = $buildId
     16  AND user_id = $userId
     17LIMIT 1;
     18
     19DELETE FROM build_component
     20WHERE build_id = $buildId
     21  AND component_id = $componentId;
     22
     23SELECT c.price
     24FROM build_component bc
     25JOIN components c ON c.id = bc.component_id
     26WHERE bc.build_id = $buildId;
     27
     28UPDATE build
     29SET total_price = (
     30  SELECT COALESCE(ROUND(SUM(c.price), 2), 0)
     31  FROM build_component bc
     32  JOIN components c ON c.id = bc.component_id
     33  WHERE bc.build_id = $buildId
     34)
     35WHERE id = $buildId;
     36}}}