diff --git a/00-backend/src/main/java/de/htwsaar/webshop/WebshopApplication.java b/00-backend/src/main/java/de/htwsaar/webshop/WebshopApplication.java index 9bb5a36..785b566 100644 --- a/00-backend/src/main/java/de/htwsaar/webshop/WebshopApplication.java +++ b/00-backend/src/main/java/de/htwsaar/webshop/WebshopApplication.java @@ -11,5 +11,4 @@ public class WebshopApplication { System.setProperty("server.port", BASE_PORT); SpringApplication.run(WebshopApplication.class, args); } - } diff --git a/00-backend/src/main/resources/db/DBv1.sql b/00-backend/src/main/resources/db/DBv1.sql new file mode 100644 index 0000000..2adfb4b --- /dev/null +++ b/00-backend/src/main/resources/db/DBv1.sql @@ -0,0 +1,56 @@ +CREATE TABLE IF NOT EXISTS ArticleConfigurations( + id INTEGER PRIMARY KEY NOT NULL, + articleId INTEGER NOT NULL, + name TEXT NOT NULL, + FOREIGN KEY (articleId) REFERENCES Articles(id) + ON DELETE CASCADE + ON UPDATE CASCADE +); + +CREATE TABLE IF NOT EXISTS Customers( + id INTEGER PRIMARY KEY NOT NULL, + name TEXT NOT NULL, --nachname + surname TEXT NOT NULL, --vorname, + address TEXT NOT NULL, + country TEXT NOT NULL, + zip TEXT NOT NULL +); + +CREATE TABLE IF NOT EXISTS Orders( + id INTEGER PRIMARY KEY NOT NULL, + customerId INTEGER NOT NULL, + time INTEGER NOT NULL, --unix millis or epoch, TBD + FOREIGN KEY (customerId) REFERENCES Customers(id) + ON DELETE CASCADE + ON UPDATE CASCADE +); + +-- Each Article-Configuration in the order gets their own of this one +CREATE TABLE IF NOT EXISTS OrderItems( + orderId INTEGER NOT NULL, + articleId INTEGER NOT NULL, + articleConfId INTEGER NULL, + amount INTEGER NOT NULL, + + CONSTRAINT cAmount CHECK (amount > 0), + FOREIGN KEY (orderId) REFERENCES Orders(id) + ON DELETE CASCADE + ON UPDATE CASCADE, + FOREIGN KEY (articleId) REFERENCES Articles(id) + ON DELETE SET NULL + ON UPDATE CASCADE, + FOREIGN KEY (articleConfId) REFERENCES ArticleConfigurations(id) + ON DELETE SET NULL + ON UPDATE CASCADE +); + +CREATE TABLE IF NOT EXISTS Accounts( + id INTEGER PRIMARY KEY NOT NULL, + customerId INTEGER NOT NULL, + email TEXT NOT NULL, + password TEXT NOT NULL, + lang_i18n TEXT NOT NULL, + FOREIGN KEY (customerId) REFERENCES Customers(id) + ON DELETE CASCADE + ON UPDATE CASCADE +); \ No newline at end of file diff --git a/00-backend/src/main/resources/db/initdb.sql b/00-backend/src/main/resources/db/initdb.sql index a0fb199..43ed362 100644 --- a/00-backend/src/main/resources/db/initdb.sql +++ b/00-backend/src/main/resources/db/initdb.sql @@ -27,4 +27,4 @@ CREATE TABLE IF NOT EXISTS Reviews( content TEXT NULL, FOREIGN KEY (articleId) REFERENCES Articles(id), CONSTRAINT c_rating CHECK ( rating >= 0 AND rating <= 10) -) \ No newline at end of file +); \ No newline at end of file diff --git a/README.md b/README.md index fb90bce..038ea1c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,51 @@ -# webshop +# DPS Webshop Webshop-Projekt für htw saar Digitale Produktionssysteme + +## Prerequisites + +- ``git`` installed & added to PATH +- Java Development Kit 17 (we recommend using OpenJDK with Hotspot) installed & added to PATH +- Maven >= 3.9.9 installed & added to PATH +- ``npm`` installed & added to PATH +- An Internet Connection (to download the Maven Dependencies) + +## Compile + +- Make sure you fulfill all prerequisites +- Clone files & submodules with: + ```shell + git clone git@github.com:FlorianSpeicher04/webshop.git + ``` + +### Backend +- (Optional) change the ``BASE_PORT`` in [WebshopApplication.java](00-backend/src/main/java/de/htwsaar/webshop/WebshopApplication.java) from 8085 to something else +- Compile with: + ```shell + mvn clean package + ``` +### Frontend +- Compile with: + ```shell + npm install + ``` + +## Run + +### 🥰 Unix Systems + +- TODO: make script +```shell + +``` +### 🤮 Windows + +- TODO: make script +```shell + +``` + +# Contributors +- Laura Katharina Dolibois +- Mathusan Saravanapavan +- Florian Speicher +- Tim Wall