Changes between Initial Version and Version 1 of CloneBuild


Ignore:
Timestamp:
12/29/25 00:07:52 (9 hours ago)
Author:
233051
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CloneBuild

    v1 v1  
     1== Clone an existing build ==
     2
     3=== Actors ===
     4User, Admin
     5
     6=== Scenario ===
     71. The user opens the completed builds page, opens the details popup for a build
     82. The user clicks on the "CLONE & EDIT" button and is redirected to the forge page
     93. The forge is populated with identical data as the build that was cloned
     10
     11{{{
     12BEGIN;
     13
     14SELECT *
     15FROM build
     16WHERE id = $buildId
     17LIMIT 1;
     18
     19INSERT INTO build (user_id, name, created_at, description, total_price, is_approved)
     20SELECT
     21  $userId,
     22  (b.name || ' (copy)'),
     23  CURRENT_DATE,
     24  b.description,
     25  b.total_price,
     26  false
     27FROM build AS b
     28WHERE b.id = $buildId
     29RETURNING id;
     30
     31SELECT component_id
     32FROM build_component
     33WHERE build_id = $buildId;
     34
     35INSERT INTO build_component (build_id, component_id)
     36SELECT
     37  $newBuildId,
     38  bc.component_id
     39FROM build_component AS bc
     40WHERE bc.build_id = $buildId;
     41
     42COMMIT;
     43}}}