== Product Update === Actors: **Registered Employee/Boss** **1.** A member of the personal opens a product from their store. **2.** The system checks if the member has permission to change products. {{{#!sql SELECT CASE WHEN EXISTS ( SELECT 1 FROM permissions WHERE personal_ID='0010002' AND (permission_type='BOSS' OR permission_type='MANAGER') ) THEN 'Yes' ELSE 'No' END AS has_permission; }}} **3.** After permission is confiremed, the registered user clicks "Edit product". **4.** The employee/boss makes changes. **5.** Application updates the data in {{{product}}}. {{{#!sql UPDATE product SET price = 44.99, availability = 15, description = 'Updated handmade wooden box' WHERE code = '00100001'; }}} **6.** If new pictures of the product, the data in {{{image}}} is updated accordingly. {{{#!sql INSERT INTO image(product_code, image) VALUES ('00100001', 'black-box-open.png'); }}} {{{#!sql DELETE FROM image WHERE product_code='00100001' AND image='black-box-side.png'; }}} **7.** If the colors in which the product is available changes, {{{color}}} is updated accordingly. {{{#!sql INSERT INTO color(product_code, color) VALUES ('00100001','Blue and White'); }}} {{{#!sql DELETE FROM color WHERE product_code='00100001' AND color='Black'; }}} **8.** The change is logged in {{{change}}}. {{{#!sql INSERT INTO change(date_and_time, product_code, changes) VALUES ('2025-12-30 15:40:35', '00100001', 'Changed color "Black" to "Blue and White"'); }}} **9.** The employee who made the change is logged in {{{makes_change}}}. {{{#!sql INSER INTO makes_change(personal_ID, change_date_time, product_code) VALUES ('0010002', '2025-12-30 15:40:35', '00100001'); }}}