Merge branch 'develop' into Warenkorb

This commit is contained in:
Fabian 2025-04-26 09:26:30 +00:00
commit db5fde4e51
14 changed files with 981 additions and 216 deletions

5
.gitignore vendored
View File

@ -104,7 +104,6 @@ dist
# vuepress v2.x temp and cache directory # vuepress v2.x temp and cache directory
.temp .temp
.cache
# Docusaurus cache and generated files # Docusaurus cache and generated files
.docusaurus .docusaurus
@ -132,3 +131,7 @@ dist
.pnp.* .pnp.*
/.idea/git_toolbox_blame.xml /.idea/git_toolbox_blame.xml
.package.json
.package-lock.json
.package.json
.package-lock.json

View File

@ -1,3 +1,3 @@
# Webshop # Webshop
Webshop Autohändler Webshop für Modellautos

View File

@ -1,170 +0,0 @@
CREATE TABLE `discount`
(
`deleted_at` INT(8) NOT NULL,
`name` VARCHAR(255) NOT NULL,
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`description` TEXT NOT NULL,
`discount_percent` DECIMAL(8, 2) NOT NULL,
`modified_at` INT(8) NOT NULL,
`created_at` INT(8) NOT NULL,
`active` BOOLEAN NOT NULL
);
CREATE TABLE `user_address`
(
`address_line1` VARCHAR(255) NOT NULL,
`city` VARCHAR(255) NOT NULL,
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`country` VARCHAR(2) NOT NULL,
`user_id` INT UNSIGNED NOT NULL,
`mobile` VARCHAR(255) NOT NULL,
`postal_code` INT NOT NULL,
`address_line2` VARCHAR(255) NOT NULL,
`telephone` VARCHAR(255) NOT NULL
);
ALTER TABLE
`user_address`
ADD UNIQUE `user_address_mobile_unique` (`mobile`);
ALTER TABLE
`user_address`
ADD UNIQUE `user_address_telephone_unique` (`telephone`);
CREATE TABLE `product_inventory`
(
`created_at` INT(8) NOT NULL,
`modified_at` INT(8) NOT NULL,
`quantity` INT NOT NULL,
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`deleted_at` INT(8) NOT NULL
);
CREATE TABLE `payment_details`
(
`order_id` INT NOT NULL,
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`status` VARCHAR(255) NOT NULL,
`provider` VARCHAR(255) NOT NULL,
`modified_at` INT(8) NOT NULL,
`amount` INT NOT NULL,
`created_at` INT(8) NOT NULL
);
CREATE TABLE `order_details`
(
`payment_id` INT UNSIGNED NOT NULL,
`total` DECIMAL(8, 2) NOT NULL,
`modified_at` INT(8) NOT NULL,
`created_at` INT(8) NOT NULL,
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`user_id` INT UNSIGNED NOT NULL
);
CREATE TABLE `order_items`
(
`modified_at` INT(8) NOT NULL,
`user_id` BIGINT NOT NULL,
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`quantity` INT NOT NULL,
`order_id` INT UNSIGNED NOT NULL,
`created_at` INT(8) NOT NULL,
`product_id` INT UNSIGNED NOT NULL
);
CREATE TABLE `user_payment`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`provider` VARCHAR(255) NOT NULL,
`account_no` VARCHAR(255) NOT NULL,
`expiry` DATE NOT NULL,
`payment_type` VARCHAR(255) NOT NULL,
`user_id` INT UNSIGNED NOT NULL
);
CREATE TABLE `product`
(
`category_id` INT UNSIGNED NOT NULL,
`model` VARCHAR(255) NOT NULL,
`color` VARCHAR(255) NOT NULL,
`engine` VARCHAR(255) NOT NULL,
`description` TEXT NOT NULL,
`make` VARCHAR(255) NOT NULL,
`inventory_id` INT UNSIGNED NOT NULL,
`discount_id` INT UNSIGNED NOT NULL,
`created_at` INT(8) NOT NULL,
`name` VARCHAR(255) NOT NULL,
`deleted_at` INT(8) NOT NULL,
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`modified_at` INT(8) NOT NULL,
`price` DECIMAL(8, 2) NOT NULL
);
CREATE TABLE `product_category`
(
`created_at` INT(8) NOT NULL,
`name` VARCHAR(255) NOT NULL,
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`modified_at` INT(8) NOT NULL,
`desc` TEXT NOT NULL,
`deleted_at` INT(8) NOT NULL
);
CREATE TABLE `user`
(
`is_active` BOOLEAN NOT NULL,
`lower_name` VARCHAR(255) NOT NULL,
`email` VARCHAR(255) NOT NULL,
`passwd_hash_algo` VARCHAR(255) NOT NULL,
`modified_at` INT(8) NOT NULL,
`is_admin` BOOLEAN NOT NULL,
`name` VARCHAR(255) NOT NULL,
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`created_at` INT(8) NOT NULL,
`passwd` VARCHAR(255) NOT NULL
);
ALTER TABLE
`user`
ADD UNIQUE `user_email_unique` (`email`);
CREATE TABLE `shopping_session`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`created_at` INT(8) NOT NULL,
`user_id` INT UNSIGNED NOT NULL,
`modified_at` INT(8) NOT NULL,
`total` DECIMAL(8, 2) NOT NULL
);
CREATE TABLE `cart_item`
(
`product_id` INT UNSIGNED NOT NULL,
`session_id` INT UNSIGNED NOT NULL,
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`created_at` INT(8) NOT NULL,
`modified_at` INT(8) NOT NULL,
`quantity` INT NOT NULL
);
ALTER TABLE
`product`
ADD CONSTRAINT `product_inventory_id_foreign` FOREIGN KEY (`inventory_id`) REFERENCES `product_inventory` (`id`);
ALTER TABLE
`order_items`
ADD CONSTRAINT `order_items_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `order_details` (`id`);
ALTER TABLE
`product`
ADD CONSTRAINT `product_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `product_category` (`id`);
ALTER TABLE
`order_details`
ADD CONSTRAINT `order_details_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE
`cart_item`
ADD CONSTRAINT `cart_item_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `product` (`id`);
ALTER TABLE
`order_items`
ADD CONSTRAINT `order_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `product` (`id`);
ALTER TABLE
`user_address`
ADD CONSTRAINT `user_address_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE
`order_details`
ADD CONSTRAINT `order_details_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payment_details` (`id`);
ALTER TABLE
`product`
ADD CONSTRAINT `product_discount_id_foreign` FOREIGN KEY (`discount_id`) REFERENCES `discount` (`id`);
ALTER TABLE
`user_payment`
ADD CONSTRAINT `user_payment_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE
`shopping_session`
ADD CONSTRAINT `shopping_session_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE
`cart_item`
ADD CONSTRAINT `cart_item_session_id_foreign` FOREIGN KEY (`session_id`) REFERENCES `shopping_session` (`id`);

View File

@ -1,24 +0,0 @@
drop table if exists cart_item;
drop table if exists discount;
drop table if exists oder_items;
drop table if exists order_details;
drop table if exists payment_details;
drop table if exists product;
drop table if exists product_category;
drop table if exists product_inventory;
drop table if exists shopping_session;
drop table if exists user;
drop table if exists user_address;
drop table if exists user_payment;

View File

@ -0,0 +1,146 @@
DROP DATABASE IF EXISTS webshop;
CREATE DATABASE IF NOT EXISTS `webshop`
CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `webshop`;
CREATE TABLE `user`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL,
`lower_name` VARCHAR(255) NOT NULL,
`email` VARCHAR(255) NOT NULL DEFAULT 'NONE',
`passwd` VARCHAR(255) NOT NULL DEFAULT 'NONE',
`passwd_hash_algo` VARCHAR(255) NOT NULL DEFAULT 'NONE',
`is_admin` BOOLEAN NOT NULL DEFAULT '0'
);
ALTER TABLE
`user`
ADD UNIQUE `user_email_unique` (`email`);
CREATE TABLE `user_address`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`user_id` INT UNSIGNED NOT NULL,
`address_line1` VARCHAR(255) NOT NULL,
`address_line2` VARCHAR(255) NOT NULL,
`city` VARCHAR(255) NOT NULL,
`postal_code` INT NOT NULL,
`country` VARCHAR(2) NOT NULL,
`telephone` VARCHAR(255) NOT NULL
);
ALTER TABLE
`user_address`
ADD UNIQUE `user_address_telephone_unique` (`telephone`);
CREATE TABLE `user_payment`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`user_id` INT UNSIGNED NOT NULL,
`payment_type` VARCHAR(255) NOT NULL,
`provider` VARCHAR(255) NOT NULL,
`account_no` VARCHAR(255) NOT NULL,
`expiry` DATE NOT NULL
);
CREATE TABLE `shopping_session`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`user_id` INT UNSIGNED NOT NULL,
`total` DECIMAL(8, 2) NOT NULL
);
CREATE TABLE `cart_item`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`session_id` INT UNSIGNED NOT NULL,
`product_id` INT UNSIGNED NOT NULL,
`quantity` INT NOT NULL
);
CREATE TABLE `payment_details`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`order_id` INT NOT NULL,
`amount` INT NOT NULL,
`provider` VARCHAR(255) NOT NULL,
`status` VARCHAR(255) NOT NULL
);
CREATE TABLE `product`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL,
`make` VARCHAR(255) NOT NULL,
`model` VARCHAR(255) NOT NULL,
`description` TEXT NOT NULL,
`category_id` INT UNSIGNED NOT NULL,
`price` DECIMAL(8, 2) NOT NULL,
`discount_id` INT UNSIGNED NOT NULL,
`created_at` DATE NOT NULL
);
CREATE TABLE `discount`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL,
`description` TEXT NOT NULL,
`discount_percent` DECIMAL(8, 2) NOT NULL,
`active` BOOLEAN NOT NULL
);
CREATE TABLE `order_items`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`order_id` INT UNSIGNED NOT NULL,
`product_id` INT UNSIGNED NOT NULL,
`quantity` INT NOT NULL,
`user_id` BIGINT NOT NULL
);
CREATE TABLE `product_category`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL
);
CREATE TABLE `order_details`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`user_id` INT UNSIGNED NOT NULL,
`total` DECIMAL(8, 2) NOT NULL,
`payment_id` INT UNSIGNED NOT NULL
);
CREATE TABLE `product_pictures`
(
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
`product_id` INT UNSIGNED NOT NULL,
`picture_base64` TEXT NOT NULL,
`is_primary` BOOLEAN NOT NULL
);
ALTER TABLE
`product_pictures`
ADD CONSTRAINT `product_pictures_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `product` (`id`);
ALTER TABLE
`user_payment`
ADD CONSTRAINT `user_payment_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE
`order_details`
ADD CONSTRAINT `order_details_payment_id_foreign` FOREIGN KEY (`payment_id`) REFERENCES `payment_details` (`id`);
ALTER TABLE
`order_details`
ADD CONSTRAINT `order_details_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE
`order_items`
ADD CONSTRAINT `order_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `product` (`id`);
ALTER TABLE
`product`
ADD CONSTRAINT `product_discount_id_foreign` FOREIGN KEY (`discount_id`) REFERENCES `discount` (`id`);
ALTER TABLE
`shopping_session`
ADD CONSTRAINT `shopping_session_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE
`product`
ADD CONSTRAINT `product_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `product_category` (`id`);
ALTER TABLE
`user_address`
ADD CONSTRAINT `user_address_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`);
ALTER TABLE
`order_items`
ADD CONSTRAINT `order_items_order_id_foreign` FOREIGN KEY (`order_id`) REFERENCES `order_details` (`id`);
ALTER TABLE
`cart_item`
ADD CONSTRAINT `cart_item_session_id_foreign` FOREIGN KEY (`session_id`) REFERENCES `shopping_session` (`id`);
ALTER TABLE
`cart_item`
ADD CONSTRAINT `cart_item_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `product` (`id`);

View File

@ -0,0 +1,643 @@
USE webshop;
-- Product Categories
INSERT INTO product_category (id, name)
VALUES (1, 'Electronics');
INSERT INTO product_category (id, name)
VALUES (2, 'Home Appliances');
INSERT INTO product_category (id, name)
VALUES (3, 'Clothing');
INSERT INTO product_category (id, name)
VALUES (4, 'Sports');
INSERT INTO product_category (id, name)
VALUES (5, 'Books');
-- Discounts
INSERT INTO discount (id, name, description, discount_percent, active)
VALUES (1, 'Spring Sale', 'Description for Spring Sale', 15, TRUE);
INSERT INTO discount (id, name, description, discount_percent, active)
VALUES (2, 'Black Friday', 'Description for Black Friday', 40, TRUE);
INSERT INTO discount (id, name, description, discount_percent, active)
VALUES (3, 'New User', 'Description for New User', 10, TRUE);
INSERT INTO discount (id, name, description, discount_percent, active)
VALUES (4, 'Clearance', 'Description for Clearance', 25, TRUE);
INSERT INTO discount (id, name, description, discount_percent, active)
VALUES (5, 'Holiday Deal', 'Description for Holiday Deal', 20, TRUE);
-- Users
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (1, 'User1', LOWER('User1'), 'user1@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (2, 'User2', LOWER('User2'), 'user2@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (3, 'User3', LOWER('User3'), 'user3@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (4, 'User4', LOWER('User4'), 'user4@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (5, 'User5', LOWER('User5'), 'user5@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (6, 'User6', LOWER('User6'), 'user6@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (7, 'User7', LOWER('User7'), 'user7@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (8, 'User8', LOWER('User8'), 'user8@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (9, 'User9', LOWER('User9'), 'user9@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (10, 'User10', LOWER('User10'), 'user10@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (11, 'User11', LOWER('User11'), 'user11@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (12, 'User12', LOWER('User12'), 'user12@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (13, 'User13', LOWER('User13'), 'user13@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (14, 'User14', LOWER('User14'), 'user14@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (15, 'User15', LOWER('User15'), 'user15@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (16, 'User16', LOWER('User16'), 'user16@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (17, 'User17', LOWER('User17'), 'user17@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (18, 'User18', LOWER('User18'), 'user18@example.com', 'password123', 'bcrypt', FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (19, 'User19', LOWER('User19'), 'user19@example.com', 'password123', 'bcrypt',FALSE);
INSERT INTO user (id, name, lower_name, email, passwd, passwd_hash_algo, is_admin)
VALUES (20, 'User20', LOWER('User20'), 'user20@example.com', 'password123', 'bcrypt', FALSE);
-- User Addresses
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (1, '123 Main St', 'Apt 1', 'Berlin', 10001, 'DE', '1234567891');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (2, '123 Main St', 'Apt 2', 'Toronto', 10002, 'DE', '1234567892');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (3, '123 Main St', 'Apt 3', 'New York', 10003, 'GB', '1234567893');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (4, '123 Main St', 'Apt 4', 'Paris', 10004, 'DE', '1234567894');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (5, '123 Main St', 'Apt 5', 'Paris', 10005, 'FR', '1234567895');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (6, '123 Main St', 'Apt 6', 'New York', 10006, 'DE', '1234567896');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (7, '123 Main St', 'Apt 7', 'Berlin', 10007, 'FR', '1234567897');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (8, '123 Main St', 'Apt 8', 'Paris', 10008, 'US', '1234567898');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (9, '123 Main St', 'Apt 9', 'London', 10009, 'FR', '1234567899');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (10, '123 Main St', 'Apt 10', 'Paris', 10010, 'CA', '12345678910');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (11, '123 Main St', 'Apt 11', 'London', 10011, 'DE', '12345678911');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (12, '123 Main St', 'Apt 12', 'London', 10012, 'US', '12345678912');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (13, '123 Main St', 'Apt 13', 'Toronto', 10013, 'US', '12345678913');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (14, '123 Main St', 'Apt 14', 'Toronto', 10014, 'CA', '12345678914');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (15, '123 Main St', 'Apt 15', 'Paris', 10015, 'CA', '12345678915');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (16, '123 Main St', 'Apt 16', 'London', 10016, 'US', '12345678916');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (17, '123 Main St', 'Apt 17', 'New York', 10017, 'CA', '12345678917');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (18, '123 Main St', 'Apt 18', 'Berlin', 10018, 'GB', '12345678918');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (19, '123 Main St', 'Apt 19', 'Berlin', 10019, 'DE', '12345678919');
INSERT INTO user_address (user_id, address_line1, address_line2, city, postal_code, country, telephone)
VALUES (20, '123 Main St', 'Apt 20', 'Berlin', 10020, 'GB', '12345678920');
-- User Payments
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (1, 'Credit Card', 'Stripe', 'ACCNO0001', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (2, 'Debit Card', 'Visa', 'ACCNO0002', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (3, 'PayPal', 'Stripe', 'ACCNO0003', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (4, 'PayPal', 'Visa', 'ACCNO0004', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (5, 'Debit Card', 'MasterCard', 'ACCNO0005', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (6, 'Credit Card', 'Visa', 'ACCNO0006', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (7, 'Debit Card', 'Stripe', 'ACCNO0007', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (8, 'PayPal', 'Stripe', 'ACCNO0008', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (9, 'Credit Card', 'MasterCard', 'ACCNO0009', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (10, 'PayPal', 'Stripe', 'ACCNO0010', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (11, 'PayPal', 'Visa', 'ACCNO0011', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (12, 'Debit Card', 'PayPal', 'ACCNO0012', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (13, 'PayPal', 'PayPal', 'ACCNO0013', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (14, 'PayPal', 'MasterCard', 'ACCNO0014', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (15, 'Credit Card', 'PayPal', 'ACCNO0015', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (16, 'Debit Card', 'Visa', 'ACCNO0016', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (17, 'Credit Card', 'PayPal', 'ACCNO0017', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (18, 'Debit Card', 'MasterCard', 'ACCNO0018', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (19, 'Debit Card', 'PayPal', 'ACCNO0019', '2026-12-31');
INSERT INTO user_payment (user_id, payment_type, provider, account_no, expiry)
VALUES (20, 'PayPal', 'Stripe', 'ACCNO0020', '2026-12-31');
-- Products
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (1, 'Product1', 'BrandA', 'Model1', 'Description for Product1', 5, 318.94, 2, '2024-06-16');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (2, 'Product2', 'BrandC', 'Model2', 'Description for Product2', 5, 521.19, 5, '2025-03-05');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (3, 'Product3', 'BrandB', 'Model3', 'Description for Product3', 2, 230.04, 2, '2024-08-12');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (4, 'Product4', 'BrandC', 'Model4', 'Description for Product4', 1, 147.85, 4, '2025-03-02');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (5, 'Product5', 'BrandA', 'Model5', 'Description for Product5', 4, 520.02, 3, '2024-09-08');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (6, 'Product6', 'BrandC', 'Model6', 'Description for Product6', 4, 146.06, 5, '2024-07-08');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (7, 'Product7', 'BrandC', 'Model7', 'Description for Product7', 1, 862.11, 3, '2025-03-20');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (8, 'Product8', 'BrandC', 'Model8', 'Description for Product8', 1, 313.82, 2, '2024-10-17');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (9, 'Product9', 'BrandA', 'Model9', 'Description for Product9', 2, 491.74, 2, '2025-01-17');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (10, 'Product10', 'BrandB', 'Model10', 'Description for Product10', 3, 182.49, 3, '2025-01-02');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (11, 'Product11', 'BrandB', 'Model11', 'Description for Product11', 4, 907.39, 3, '2025-01-29');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (12, 'Product12', 'BrandB', 'Model12', 'Description for Product12', 2, 962.56, 2, '2024-07-01');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (13, 'Product13', 'BrandC', 'Model13', 'Description for Product13', 5, 933.24, 5, '2024-05-24');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (14, 'Product14', 'BrandB', 'Model14', 'Description for Product14', 2, 474.63, 1, '2024-11-26');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (15, 'Product15', 'BrandC', 'Model15', 'Description for Product15', 5, 112.99, 1, '2024-07-14');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (16, 'Product16', 'BrandA', 'Model16', 'Description for Product16', 5, 92.21, 5, '2024-06-21');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (17, 'Product17', 'BrandB', 'Model17', 'Description for Product17', 1, 30.15, 4, '2024-10-04');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (18, 'Product18', 'BrandA', 'Model18', 'Description for Product18', 2, 169.85, 1, '2024-11-07');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (19, 'Product19', 'BrandB', 'Model19', 'Description for Product19', 5, 559.7, 1, '2024-09-12');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (20, 'Product20', 'BrandB', 'Model20', 'Description for Product20', 1, 617.8, 4, '2024-04-26');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (21, 'Product21', 'BrandB', 'Model21', 'Description for Product21', 1, 353.15, 4, '2024-04-24');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (22, 'Product22', 'BrandA', 'Model22', 'Description for Product22', 4, 827.72, 1, '2024-04-17');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (23, 'Product23', 'BrandB', 'Model23', 'Description for Product23', 4, 24.71, 2, '2025-03-24');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (24, 'Product24', 'BrandB', 'Model24', 'Description for Product24', 1, 452.61, 1, '2024-07-06');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (25, 'Product25', 'BrandA', 'Model25', 'Description for Product25', 3, 245.66, 2, '2024-05-20');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (26, 'Product26', 'BrandA', 'Model26', 'Description for Product26', 4, 741.09, 2, '2024-12-23');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (27, 'Product27', 'BrandB', 'Model27', 'Description for Product27', 2, 549.64, 2, '2025-01-28');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (28, 'Product28', 'BrandC', 'Model28', 'Description for Product28', 3, 93.43, 2, '2024-07-15');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (29, 'Product29', 'BrandC', 'Model29', 'Description for Product29', 1, 610.66, 1, '2024-08-07');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (30, 'Product30', 'BrandC', 'Model30', 'Description for Product30', 4, 537.6, 3, '2024-06-24');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (31, 'Product31', 'BrandB', 'Model31', 'Description for Product31', 4, 377.7, 1, '2024-06-20');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (32, 'Product32', 'BrandA', 'Model32', 'Description for Product32', 4, 353.25, 2, '2024-09-20');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (33, 'Product33', 'BrandB', 'Model33', 'Description for Product33', 4, 550.94, 3, '2024-08-02');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (34, 'Product34', 'BrandA', 'Model34', 'Description for Product34', 1, 692.25, 4, '2024-04-16');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (35, 'Product35', 'BrandB', 'Model35', 'Description for Product35', 4, 249.37, 3, '2024-05-10');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (36, 'Product36', 'BrandC', 'Model36', 'Description for Product36', 4, 418.07, 1, '2024-08-18');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (37, 'Product37', 'BrandC', 'Model37', 'Description for Product37', 1, 455.82, 4, '2024-04-27');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (38, 'Product38', 'BrandA', 'Model38', 'Description for Product38', 4, 664.72, 1, '2024-12-28');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (39, 'Product39', 'BrandB', 'Model39', 'Description for Product39', 3, 80.6, 1, '2024-10-18');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (40, 'Product40', 'BrandA', 'Model40', 'Description for Product40', 4, 28.12, 4, '2024-09-05');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (41, 'Product41', 'BrandA', 'Model41', 'Description for Product41', 3, 251.78, 5, '2025-02-08');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (42, 'Product42', 'BrandC', 'Model42', 'Description for Product42', 4, 144.43, 1, '2024-05-11');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (43, 'Product43', 'BrandA', 'Model43', 'Description for Product43', 5, 748.88, 3, '2025-01-04');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (44, 'Product44', 'BrandB', 'Model44', 'Description for Product44', 5, 882.23, 1, '2024-08-19');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (45, 'Product45', 'BrandB', 'Model45', 'Description for Product45', 3, 899.3, 4, '2024-07-03');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (46, 'Product46', 'BrandC', 'Model46', 'Description for Product46', 4, 272.38, 4, '2024-11-11');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (47, 'Product47', 'BrandB', 'Model47', 'Description for Product47', 3, 470.78, 2, '2024-10-28');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (48, 'Product48', 'BrandC', 'Model48', 'Description for Product48', 2, 116.97, 1, '2024-09-13');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (49, 'Product49', 'BrandA', 'Model49', 'Description for Product49', 5, 30.57, 4, '2024-09-18');
INSERT INTO product (id, name, make, model, description, category_id, price, discount_id, created_at)
VALUES (50, 'Product50', 'BrandB', 'Model50', 'Description for Product50', 2, 861.84, 4, '2024-11-26');
-- Product Pictures
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (1, 'mnELxugt4Ydr4FUssyH+bkSevIrNl/KBGyH8LLhxFKI=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (2, 'mr6UQfVtBB6Gj7MaxDer/zNGsEeJ3DHH5JzLZmKUC+c=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (3, 'yCeHteIvMo3LNNxflAknKAm3TUm6bI/+cUe4mCyp5Vs=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (4, 'A1trFKv8HmX7+WxtkRAod/QbH2xKBUr3AS0sh7OT+oI=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (5, 'zdfKP/uLcgmMv1x4v+5FA2gEGK00yW2HJDHemYAxEBk=', TRUE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (6, 'wFpi7y31rFU7VICwWc8ONnx2ApSFSaF1do/ozuoENTM=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (7, 'KkpNEMOR/cMQ3zv7mjdiMG8lWh6x7S6C8vQFzqN8YYk=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (8, 'VadAqdlySAPOguy/vVfGGaUzbMciyv9niqjS2peB79c=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (9, 'pecXJbykN65n5BwAuGiWEiW2YRP1vxk5JUaBB7Z2QKE=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (10, 'JRkmNYuGySf+MCx+dPRj5cVMOu0AhHEUhSeKWGvsoM0=', TRUE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (11, 'Tln4hU4s5Nyx5wkzA/kCn4puKxHqfrdpiEaOn+Dsj0c=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (12, 'rmlebzsSR28Xl8W7HrrCetU/Xlww/m750el2QgCLrtw=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (13, 'aSXu2+PDwlE0bJ7+JgifoIRYmNFgpf4Rac1Hih3OaoQ=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (14, '0nTDMczLNN5MmLM9CecyZyNHSjAg3+hj3QIEKjEheIw=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (15, 'eKKF0BWqGh977FJNERzlZH01xvLCJLfWO507tFctImA=', TRUE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (16, 'Qx0W4ZIOI3EWcdESsMm3Wp/NEfeGssKrTD4D7hH3bzs=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (17, 't70dXq30C82ca1wRo7TmG3GBEa1MrTccl6uVbOYUcf8=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (18, 'o2xac1ar86EUPNi/q+FJEqvfIjIVUTBBKCmHoMaAqKU=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (19, 'j252AyKpFxiTVlXHar/vicn1NBzUoZtMOA7V+bVSuto=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (20, 'ddoRalgx15Oq2XgG83ksnZYnr38k3bgytWyuvMwPVNc=', TRUE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (21, 'iPcGIdcvwInGY3mc6wMKYyfAagIz5ZRjmfbbtg2+fDc=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (22, 'vtP3wxpUhcgg+M1BQV88MlIWbsOU0FkT/3qiDEJfjsM=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (23, 'lkMSOWhVUXQJwj8qui8OsevJp+a8drNyYY1PdsF9ofQ=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (24, 'OXZP3Y5ZNRREjBlK49W4oESBVc1CaPPPOJXi6mlH6n4=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (25, '1ODn0qkTCPxfapjkV8baMp+KuFrkbaLhTZfb9NQgUPU=', TRUE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (26, 'bgz2EcoOVDRagfBNLi8aPMx3yE8TbmQryWKsT7dI35c=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (27, '5KkXTV4R2M4vbf9/1R4F1pEqt02AlU6BGcUSTzD/8PI=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (28, 'ZXLkPF69pEUGz7/asGZ/n1n1yOfknrWYFv13SpvpJ9s=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (29, 'DC8UtBTDA80YqgOKxu2jNfdm4Y8JpxzuCoRiHbAiT10=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (30, 'OFm88w/1zT7DQjOVXcANhLLD6khvrF3UI7b56KmBzaU=', TRUE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (31, 'DfPzNf2+gQ9fx7QGxDY2t8VL0rtizZGY8zPvzAbqMIk=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (32, 'w89sMLHYMX7IW5ykCvu4BW448GkG4/MAWt89jbkr7YI=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (33, 'syvLhg+8VIt4Gihgq+FtmPABuD3sAMTdDlyhOu85Kqo=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (34, '2fDRzCfntjtZAneqqyzr3hD6RV/0Ad/YmCwTwjNlenc=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (35, 'ygca9b8poneJF/3RS5Kr5GMfH7+kv6m0VFDDvknfwfE=', TRUE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (36, 'tRriLe4gYRGOepP/Bn0kb6ChEKoOfKMxgnmxOh1sgS0=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (37, 'ir5yC2KMiX0w7fnaGNp85WrZU04Mgc59KWr0hkx6DIc=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (38, 'oNw9xNd/JfmOFAVX+sKWiLfH2ipyP/z/wW4dmaPN2qM=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (39, 'D+mT9AXixD432UIBcTQBZ9sd+d6W6MsnJaSOWom2DxA=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (40, 'QbjTL1bK2X5GE2KGpisiI9UIBboZhv+zFH2S16cl2E0=', TRUE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (41, 'MrUZXSdNCy3Uiochw8wSQjMu4veozWLywvp3IlbIQwo=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (42, 'i2+PZBqElXU+yUCGWRpz/HOxy2RMbmFz+9Z/JWkOgHU=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (43, 'D73S1+s3ILVdRaXj0ow+baD0QAtBCUh6jNVyYkKx3Cs=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (44, 'gHDoV2NuiBiDGJEIWLy32zrFRQb5C0ocSIgKjYs1E84=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (45, 'ks4WUYGB7sv8hFgK+H3v72t7HXDMcArsRdtj2U9B798=', TRUE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (46, '4pX2NjrxNZCSy96Uj3yXSbcM+CZ8N0WZTKVzuEl4kls=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (47, 'lY+/60wB02mXhaMBw2vcGhkYyOHUxgw0ItOqcb+wM/Q=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (48, '/QDMi1jgaR9dDlJEKLte5Zf+aMe+7Z3BLdndbgOIDO4=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (49, 'oyYP6vIP1QfDWGJBF8DJrzrx9o44aH4tnXOGCPQfEF8=', FALSE);
INSERT INTO product_pictures (product_id, picture_base64, is_primary)
VALUES (50, 'fstdpDDpSI+KUdWR7zzqlsaHRQ82Elx396/DLJXgf6o=', TRUE);
-- Shopping Sessions
INSERT INTO shopping_session (id, user_id, total)
VALUES (1, 1, 538.84);
INSERT INTO shopping_session (id, user_id, total)
VALUES (2, 2, 734.36);
INSERT INTO shopping_session (id, user_id, total)
VALUES (3, 3, 1680.53);
INSERT INTO shopping_session (id, user_id, total)
VALUES (4, 4, 303.57);
INSERT INTO shopping_session (id, user_id, total)
VALUES (5, 5, 1924.56);
INSERT INTO shopping_session (id, user_id, total)
VALUES (6, 6, 46.64);
INSERT INTO shopping_session (id, user_id, total)
VALUES (7, 7, 266.57);
INSERT INTO shopping_session (id, user_id, total)
VALUES (8, 8, 1503.89);
INSERT INTO shopping_session (id, user_id, total)
VALUES (9, 9, 1808.29);
INSERT INTO shopping_session (id, user_id, total)
VALUES (10, 10, 1890.97);
INSERT INTO shopping_session (id, user_id, total)
VALUES (11, 11, 30.01);
INSERT INTO shopping_session (id, user_id, total)
VALUES (12, 12, 1479.1);
INSERT INTO shopping_session (id, user_id, total)
VALUES (13, 13, 1559.22);
INSERT INTO shopping_session (id, user_id, total)
VALUES (14, 14, 1612.68);
INSERT INTO shopping_session (id, user_id, total)
VALUES (15, 15, 1905.59);
INSERT INTO shopping_session (id, user_id, total)
VALUES (16, 16, 141.6);
INSERT INTO shopping_session (id, user_id, total)
VALUES (17, 17, 496.74);
INSERT INTO shopping_session (id, user_id, total)
VALUES (18, 18, 1678.68);
INSERT INTO shopping_session (id, user_id, total)
VALUES (19, 19, 1140.02);
INSERT INTO shopping_session (id, user_id, total)
VALUES (20, 20, 872.75);
-- Cart Items
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (1, 1, 40, 3);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (2, 1, 26, 1);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (3, 2, 19, 4);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (4, 2, 23, 4);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (5, 3, 4, 3);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (6, 3, 6, 5);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (7, 4, 21, 3);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (8, 4, 26, 4);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (9, 5, 20, 1);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (10, 5, 3, 1);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (11, 6, 22, 2);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (12, 6, 1, 3);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (13, 7, 49, 1);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (14, 7, 45, 1);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (15, 8, 7, 3);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (16, 8, 20, 5);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (17, 9, 21, 2);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (18, 9, 13, 2);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (19, 10, 41, 4);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (20, 10, 21, 3);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (21, 11, 19, 5);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (22, 11, 36, 3);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (23, 12, 10, 4);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (24, 12, 38, 5);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (25, 13, 16, 3);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (26, 13, 2, 1);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (27, 14, 22, 4);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (28, 14, 44, 3);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (29, 15, 14, 1);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (30, 15, 14, 2);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (31, 16, 25, 4);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (32, 16, 1, 2);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (33, 17, 33, 3);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (34, 17, 42, 4);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (35, 18, 48, 4);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (36, 18, 18, 5);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (37, 19, 21, 5);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (38, 19, 26, 2);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (39, 20, 36, 3);
INSERT INTO cart_item (id, session_id, product_id, quantity)
VALUES (40, 20, 36, 3);
-- Orders and Payment Details
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (1, 1, 650, 'MasterCard', 'Failed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (1, 1, 650, 1);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (2, 2, 241, 'MasterCard', 'Pending');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (2, 2, 241, 2);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (3, 3, 134, 'PayPal', 'Failed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (3, 3, 134, 3);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (4, 4, 761, 'Stripe', 'Completed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (4, 4, 761, 4);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (5, 5, 356, 'Stripe', 'Failed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (5, 5, 356, 5);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (6, 6, 187, 'Visa', 'Failed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (6, 6, 187, 6);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (7, 7, 610, 'MasterCard', 'Completed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (7, 7, 610, 7);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (8, 8, 457, 'PayPal', 'Completed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (8, 8, 457, 8);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (9, 9, 178, 'MasterCard', 'Failed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (9, 9, 178, 9);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (10, 10, 156, 'Stripe', 'Failed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (10, 10, 156, 10);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (11, 11, 919, 'PayPal', 'Pending');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (11, 11, 919, 11);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (12, 12, 877, 'MasterCard', 'Failed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (12, 12, 877, 12);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (13, 13, 746, 'Visa', 'Completed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (13, 13, 746, 13);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (14, 14, 440, 'Stripe', 'Completed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (14, 14, 440, 14);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (15, 15, 983, 'Stripe', 'Completed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (15, 15, 983, 15);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (16, 16, 530, 'Visa', 'Failed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (16, 16, 530, 16);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (17, 17, 900, 'Visa', 'Completed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (17, 17, 900, 17);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (18, 18, 338, 'Stripe', 'Completed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (18, 18, 338, 18);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (19, 19, 759, 'PayPal', 'Pending');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (19, 19, 759, 19);
INSERT INTO payment_details (id, order_id, amount, provider, status)
VALUES (20, 20, 956, 'Stripe', 'Completed');
INSERT INTO order_details (id, user_id, total, payment_id)
VALUES (20, 20, 956, 20);
-- Order Items
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (1, 1, 21, 3, 1);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (2, 1, 25, 2, 1);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (3, 2, 22, 2, 2);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (4, 2, 27, 1, 2);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (5, 3, 15, 2, 3);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (6, 3, 32, 2, 3);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (7, 4, 17, 3, 4);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (8, 4, 28, 1, 4);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (9, 5, 47, 1, 5);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (10, 5, 34, 3, 5);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (11, 6, 16, 3, 6);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (12, 6, 19, 1, 6);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (13, 7, 17, 2, 7);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (14, 7, 10, 1, 7);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (15, 8, 40, 3, 8);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (16, 8, 29, 2, 8);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (17, 9, 23, 1, 9);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (18, 9, 13, 3, 9);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (19, 10, 8, 1, 10);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (20, 10, 2, 3, 10);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (21, 11, 27, 1, 11);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (22, 11, 4, 1, 11);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (23, 12, 27, 1, 12);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (24, 12, 10, 2, 12);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (25, 13, 8, 2, 13);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (26, 13, 22, 2, 13);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (27, 14, 33, 1, 14);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (28, 14, 46, 2, 14);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (29, 15, 37, 1, 15);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (30, 15, 10, 2, 15);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (31, 16, 27, 3, 16);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (32, 16, 26, 2, 16);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (33, 17, 15, 2, 17);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (34, 17, 12, 3, 17);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (35, 18, 39, 2, 18);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (36, 18, 26, 1, 18);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (37, 19, 15, 1, 19);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (38, 19, 29, 1, 19);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (39, 20, 16, 3, 20);
INSERT INTO order_items (id, order_id, product_id, quantity, user_id)
VALUES (40, 20, 8, 1, 20);

View File

@ -1,17 +0,0 @@
const mysql = require('mysql');
const connection = mysql.createConnection({
host: "localhost",
user: "root",
password: "",
database: "webshop"
});
connection.connect(function (err) {
if (err) throw err;
console.log("Connected to database");
connection.query("SELECT * FROM user", function (err, result) {
if (err) throw err;
console.log(result);
})
});

132
package-lock.json generated
View File

@ -9,10 +9,12 @@
"version": "1.0.0", "version": "1.0.0",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"app-root-path": "^3.1.0",
"dotenv": "^16.4.7", "dotenv": "^16.4.7",
"express": "^4.21.2", "express": "^4.21.2",
"express-session": "^1.18.1", "express-session": "^1.18.1",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"mysql2": "^3.12.0",
"path": "^0.12.7" "path": "^0.12.7"
} }
}, },
@ -28,11 +30,29 @@
"node": ">= 0.6" "node": ">= 0.6"
} }
}, },
"node_modules/app-root-path": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-3.1.0.tgz",
"integrity": "sha512-biN3PwB2gUtjaYy/isrU3aNWI5w+fAfvHkSvCKeQGxhmYpwKFUxudR3Yya+KqVRHBmEDYh+/lTozYCFbmzX4nA==",
"license": "MIT",
"engines": {
"node": ">= 6.0.0"
}
},
"node_modules/array-flatten": { "node_modules/array-flatten": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==" "integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg=="
}, },
"node_modules/aws-ssl-profiles": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/aws-ssl-profiles/-/aws-ssl-profiles-1.1.2.tgz",
"integrity": "sha512-NZKeq9AfyQvEeNlN0zSYAaWrmBffJh3IELMZfRpJVWgrpEbtEpnjvzqBPf+mxoI287JohRDoa+/nsfqqiZmF6g==",
"license": "MIT",
"engines": {
"node": ">= 6.0.0"
}
},
"node_modules/bignumber.js": { "node_modules/bignumber.js": {
"version": "9.0.0", "version": "9.0.0",
"resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.0.tgz",
@ -151,6 +171,15 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/denque": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz",
"integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==",
"license": "Apache-2.0",
"engines": {
"node": ">=0.10"
}
},
"node_modules/depd": { "node_modules/depd": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
@ -343,6 +372,15 @@
"url": "https://github.com/sponsors/ljharb" "url": "https://github.com/sponsors/ljharb"
} }
}, },
"node_modules/generate-function": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz",
"integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==",
"license": "MIT",
"dependencies": {
"is-property": "^1.0.2"
}
},
"node_modules/get-intrinsic": { "node_modules/get-intrinsic": {
"version": "1.2.4", "version": "1.2.4",
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz",
@ -455,11 +493,47 @@
"node": ">= 0.10" "node": ">= 0.10"
} }
}, },
"node_modules/is-property": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz",
"integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==",
"license": "MIT"
},
"node_modules/isarray": { "node_modules/isarray": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ=="
}, },
"node_modules/long": {
"version": "5.2.3",
"resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz",
"integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==",
"license": "Apache-2.0"
},
"node_modules/lru-cache": {
"version": "7.18.3",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz",
"integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==",
"license": "ISC",
"engines": {
"node": ">=12"
}
},
"node_modules/lru.min": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/lru.min/-/lru.min-1.1.1.tgz",
"integrity": "sha512-FbAj6lXil6t8z4z3j0E5mfRlPzxkySotzUHwRXjlpRh10vc6AI6WN62ehZj82VG7M20rqogJ0GLwar2Xa05a8Q==",
"license": "MIT",
"engines": {
"bun": ">=1.0.0",
"deno": ">=1.30.0",
"node": ">=8.0.0"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wellwelwel"
}
},
"node_modules/media-typer": { "node_modules/media-typer": {
"version": "0.3.0", "version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
@ -538,6 +612,59 @@
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
}, },
"node_modules/mysql2": {
"version": "3.12.0",
"resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.12.0.tgz",
"integrity": "sha512-C8fWhVysZoH63tJbX8d10IAoYCyXy4fdRFz2Ihrt9jtPILYynFEKUUzpp1U7qxzDc3tMbotvaBH+sl6bFnGZiw==",
"license": "MIT",
"dependencies": {
"aws-ssl-profiles": "^1.1.1",
"denque": "^2.1.0",
"generate-function": "^2.3.1",
"iconv-lite": "^0.6.3",
"long": "^5.2.1",
"lru.min": "^1.0.0",
"named-placeholders": "^1.1.3",
"seq-queue": "^0.0.5",
"sqlstring": "^2.3.2"
},
"engines": {
"node": ">= 8.0"
}
},
"node_modules/mysql2/node_modules/iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
"license": "MIT",
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/mysql2/node_modules/sqlstring": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.3.tgz",
"integrity": "sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==",
"license": "MIT",
"engines": {
"node": ">= 0.6"
}
},
"node_modules/named-placeholders": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.3.tgz",
"integrity": "sha512-eLoBxg6wE/rZkJPhU/xRX1WTpkFEwDJEN96oxFrTsqBdbT5ec295Q+CoHrL9IT0DipqKhmGcaZmwOt8OON5x1w==",
"license": "MIT",
"dependencies": {
"lru-cache": "^7.14.1"
},
"engines": {
"node": ">=12.0.0"
}
},
"node_modules/negotiator": { "node_modules/negotiator": {
"version": "0.6.3", "version": "0.6.3",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz", "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
@ -747,6 +874,11 @@
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
}, },
"node_modules/seq-queue": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz",
"integrity": "sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q=="
},
"node_modules/serve-static": { "node_modules/serve-static": {
"version": "1.16.2", "version": "1.16.2",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz",

View File

@ -11,10 +11,14 @@
"license": "ISC", "license": "ISC",
"description": "Webshop Autohändler", "description": "Webshop Autohändler",
"dependencies": { "dependencies": {
"app-root-path": "^3.1.0",
"dotenv": "^16.4.5",
"express": "^4.21.1",
"dotenv": "^16.4.7", "dotenv": "^16.4.7",
"express": "^4.21.2", "express": "^4.21.2",
"express-session": "^1.18.1", "express-session": "^1.18.1",
"mysql": "^2.18.1", "mysql": "^2.18.1",
"mysql2": "^3.12.0",
"path": "^0.12.7" "path": "^0.12.7"
} }
} }

View File

@ -2,7 +2,7 @@
APP_PORT=3000 APP_PORT=3000
# configuration for db access # configuration for db access
DB_HOST=172.0.0.1:3306 DB_HOST=localhost
DB_USER=root DB_USER=root
DB_PASSWORD= DB_PASSWORD=
DB_DATABASE= DB_DATABASE=webshop

View File

@ -1,5 +1,7 @@
const mysql = require('mysql2'); const mysql = require('mysql2');
require('dotenv').config({path:'process.env'}); require('dotenv').config({path: 'C:/Daten/Webshop/process.env'});
//to-do: '.env' Dateien aus anderen Directories aufrufen ohne absoluten Pfad
// require("dotenv").config({path:'C:/Daten/Webshop/process.env'})
const connection = mysql.createConnection({ const connection = mysql.createConnection({
host : process.env.DB_HOST, host : process.env.DB_HOST,

12
scripts/modules/login.js Normal file
View File

@ -0,0 +1,12 @@
require('mysql2')
let userInput = "test1"
let appRoot = require('app-root-path')
let dbConnect = require(appRoot + '/scripts/modules/db-connect.js')
dbConnect.query("SELECT * FROM webshop.user WHERE email = " + "'" + userInput + "'", function (err, result) {
if (err) throw err
console.log(result)
})
dbConnect.end()

View File

@ -0,0 +1,17 @@
const mysql = require('mysql');
const connection = mysql.createConnection({
host: "localhost",
user: "root",
password: "",
database: "webshop"
})
connection.connect(function (err) {
if (err) throw err
console.log("Connected to database")
connection.query("SELECT * FROM webshop.product LIMIT 10", function (err, result) {
if (err) throw err
console.log(result)
})
})

View File

@ -0,0 +1,17 @@
const mysql = require('mysql');
const connection = mysql.createConnection({
host: "localhost",
user: "root",
password: "",
database: "webshop"
})
connection.connect(function (err) {
if (err) throw err
console.log("Connected to database")
connection.query("SELECT * FROM webshop.user WHERE ID = 15", function (err, result) {
if (err) throw err
console.log(result)
})
})