Changes between Version 2 and Version 3 of AddComponent


Ignore:
Timestamp:
12/29/25 11:33:06 (33 hours ago)
Author:
233051
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AddComponent

    v2 v3  
    22224. After the admin clicks create component, the popup disappears and if we check popup with all the cpus we can see that the new cpu is inserted successfully.
    2323
     24{{{
     25BEGIN;
     26
     27INSERT INTO components (name, brand, price, img_url, type)
     28VALUES ($name, $brand, $price, $imgUrl, $type)
     29RETURNING id AS new_component_id
     30
     31-- if type == 'cpu'
     32INSERT INTO cpu (component_id, socket, cores, threads, base_clock, boost_clock, tdp)
     33VALUES ($new_component_id, $socket, $cores, $threads, $base_clock, $boost_clock, $tdp);
     34
     35INSERT INTO cooler_cpu_sockets (cooler_id, socket)
     36VALUES ($new_component_id, $socket);
     37
     38-- if type == 'gpu'
     39INSERT INTO gpu (component_id, vram, tdp, base_clock, boost_clock, chipset, length)
     40VALUES ($new_component_id, $vram, $tdp, $base_clock, $boost_clock, $chipset, $length);
     41
     42-- if type == 'memory'
     43INSERT INTO memory (component_id, type, speed, capacity, modules)
     44VALUES ($new_component_id, $memory_type, $speed, $capacity, $modules);
     45
     46-- if type == 'storage'
     47INSERT INTO storage (component_id, type, capacity, form_factor)
     48VALUES ($new_component_id, $storage_type, $capacity, $form_factor);
     49
     50-- if type == 'power_supply'
     51INSERT INTO power_supply (component_id, type, wattage, form_factor)
     52VALUES ($new_component_id, $psu_type, $wattage, $form_factor);
     53
     54-- if type == 'motherboard'
     55INSERT INTO motherboard (component_id, socket, chipset, form_factor, ram_type, num_ram_slots, max_ram_capacity, pci_express_slots)
     56VALUES ($new_component_id, $socket, $chipset, $form_factor, $ram_type, $num_ram_slots, $max_ram_capacity, $pci_express_slots);
     57
     58-- if type == 'case'
     59INSERT INTO pc_case (component_id, cooler_max_height, gpu_max_length)
     60VALUES ($new_component_id, $cooler_max_height, $gpu_max_length);
     61
     62INSERT INTO case_storage_form_factors (case_id, form_factor, num_slots)
     63VALUES ($new_component_id, $sf_form_factor, $sf_num_slots);
     64
     65INSERT INTO case_ps_form_factors (case_id, form_factor)
     66VALUES ($new_component_id, $pf_form_factor);
     67
     68INSERT INTO case_mobo_form_factors (case_id, form_factor)
     69VALUES ($new_component_id, $mf_form_factor);
     70
     71-- if type == 'cooler'
     72INSERT INTO cooler (component_id, type, height, max_tdp_supported)
     73VALUES ($new_component_id, $cooler_type, $height, $max_tdp_supported);
     74
     75-- if type == 'memory_card'
     76INSERT INTO memory_card (component_id, num_slots, interface)
     77VALUES ($new_component_id, $num_slots, $interface);
     78
     79-- if type == 'optical_drive'
     80INSERT INTO optical_drive (component_id, form_factor, type, interface, write_speed, read_speed)
     81VALUES ($new_component_id, $form_factor, $optical_type, $interface, $write_speed, $read_speed);
     82
     83-- if type == 'sound_card'
     84INSERT INTO sound_card (component_id, sample_rate, bit_depth, chipset, interface, channel)
     85VALUES ($new_component_id, $sample_rate, $bit_depth, $chipset, $interface, $channel);
     86
     87-- if$type == 'cables'
     88INSERT INTO cables (component_id, length_cm, type)
     89VALUES ($new_component_id, $length_cm, $cable_type);
     90
     91-- if type == 'network_adapter'
     92INSERT INTO network_adapter (component_id, wifi_version, interface, num_antennas)
     93VALUES ($new_component_id, $wifi_version, $interface, $num_antennas);
     94
     95-- if type == 'network_card'
     96INSERT INTO network_card (component_id, num_ports, speed, interface)
     97VALUES ($new_component_id, $num_ports, $speed, $interface);
     98
     99COMMIT;
     100}}}
     101
    24102[[Image(newComponent.png, width=800, height=420)]]