From 793d3e02e12b6f8b7869ac6b6d8be65297b6cd3c Mon Sep 17 00:00:00 2001 From: Nicksname Date: Fri, 16 Jun 2023 12:18:13 +0200 Subject: [PATCH 1/8] Aufsetzen von MariaDB --- db_scripts/README.md | 11 +++++++++++ db_scripts/create_server.sql | 3 +++ 2 files changed, 14 insertions(+) create mode 100644 db_scripts/README.md create mode 100644 db_scripts/create_server.sql diff --git a/db_scripts/README.md b/db_scripts/README.md new file mode 100644 index 0000000..6337559 --- /dev/null +++ b/db_scripts/README.md @@ -0,0 +1,11 @@ +# Datenbank + +## Aufsetzen + +Zu Beginn sollte die Datenbank heruntergeladen werden [Anleitung](https://mariadb.com/kb/en/getting-installing-and-upgrading-mariadb/). + +Nach der Installation muss auf der Datenbank ein Server definiert werden. Dazu muss eine Systemtabelle des DB-Servers editiert werden. für die Tests gewählte Konfiguration findet sich unter ./create_server.sql weitere Informationen finden sich [unter](https://mariadb.com/kb/en/create-server/). + + +https://wiki.archlinux.org/title/MariaDB +mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql \ No newline at end of file diff --git a/db_scripts/create_server.sql b/db_scripts/create_server.sql new file mode 100644 index 0000000..eb23b75 --- /dev/null +++ b/db_scripts/create_server.sql @@ -0,0 +1,3 @@ +CREATE SERVER IF NOT EXISTS s +FOREIGN DATA WRAPPER mysql +OPTIONS (USER 'REMOTE', HOST '127.0.0.1', DATABASE 'test'); \ No newline at end of file From d711eef20d8ff7c36209ed7f630c37b252d39e24 Mon Sep 17 00:00:00 2001 From: Nicksname Date: Fri, 16 Jun 2023 14:07:02 +0200 Subject: [PATCH 2/8] Umstellung auf Sqlite * Anpassung des Erstellungsscripts * Beschreibung des Zugriffs und Einlesen der Datei (momentan noch nicht funktional) --- .gitignore | 3 ++- db_scripts/README.md | 13 ++++----- db_scripts/create.sql | 62 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 db_scripts/create.sql diff --git a/.gitignore b/.gitignore index 723ef36..2dd30b6 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -.idea \ No newline at end of file +.idea +db/* \ No newline at end of file diff --git a/db_scripts/README.md b/db_scripts/README.md index 6337559..f56a297 100644 --- a/db_scripts/README.md +++ b/db_scripts/README.md @@ -1,11 +1,12 @@ # Datenbank -## Aufsetzen +## Aufsetzen - SQLite -Zu Beginn sollte die Datenbank heruntergeladen werden [Anleitung](https://mariadb.com/kb/en/getting-installing-and-upgrading-mariadb/). +Erstellen / Verbinden mit der Datenbank +```sqlite3 ../db/test.db``` -Nach der Installation muss auf der Datenbank ein Server definiert werden. Dazu muss eine Systemtabelle des DB-Servers editiert werden. für die Tests gewählte Konfiguration findet sich unter ./create_server.sql weitere Informationen finden sich [unter](https://mariadb.com/kb/en/create-server/). +Tabellen anlegen (nach Verbindung durch *sqlite3* besteht) +```.read create.sql``` - -https://wiki.archlinux.org/title/MariaDB -mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql \ No newline at end of file +In einem Schritt: +```sqlite3 ../db/test.db -init create.sql``` diff --git a/db_scripts/create.sql b/db_scripts/create.sql new file mode 100644 index 0000000..b91c817 --- /dev/null +++ b/db_scripts/create.sql @@ -0,0 +1,62 @@ +CREATE TABLE IF NOT EXISTS mitglied ( + mitglied_id INT NOT NULL PRIMARY KEY, + haushalt VARCHAR(100) NOT NULL, + erweiterter_haushalt VARCHAR(100), + einlage INT NOT NULL, + guthaben INT NOT NULL, + kontoauszuege BOOLEAN NOT NULL, + aktiv BOOLEAN NOT NULL +); + +CREATE TABLE IF NOT EXISTS transaktion_art ( + art_id INT NOT NULL PRIMARY KEY, + art VARCHAR(50) NOT NULL +); + +INSERT INTO transaktion_art(art_id, art) VALUES (1, 'monatlicher_beitrag'); +INSERT INTO transaktion_art(art_id, art) VALUES (2, 'aufladung'); +INSERT INTO transaktion_art(art_id, art) VALUES (3, 'einkauf'); + +CREATE TABLE IF NOT EXISTS transaktion ( + transaktion_id INT NOT NULL PRIMARY KEY, + mitglied_id INT NOT NULL, + art_id INT NOT NULL, + datum DATE NOT NULL, + BETRAG INT NOT NULL, + CONSTRAINT fk_mitglied_transaktion FOREIGN KEY (mitglied_id) REFERENCES mitglied(mitglied_id), + CONSTRAINT fk_art_transaktion FOREIGN KEY (art_id) REFERENCES transaktion_art(art_id) +); + +CREATE TABLE IF NOT EXISTS monatlicher_beitrag ( + monatlicher_beitrag_id INT NOT NULL PRIMARY KEY, + mitglied_id INT NOT NULL, + anfangsdatum DATE NOT NULL, + enddatum DATE NOT NULL, + beitrag INT NOT NULL, + CONSTRAINT fk_mitglied_beitrag FOREIGN KEY (mitglied_id) REFERENCES mitglied(mitglied_id) +); + +CREATE TABLE IF NOT EXISTS mwst ( + mwst_id INT NOT NULL PRIMARY KEY, + prozent INT NOT NULL +); + +INSERT INTO mwst(mwst_id, prozent) VALUES (1, 7); +INSERT INTO mwst(mwst_id, prozent) VALUES (2, 19); + +CREATE TABLE IF NOT EXISTS einheit( + einheit_id INT NOT NULL PRIMARY KEY, + bezeichung VARCHAR(50) NOT NULL +); + +INSERT INTO einheit(menge_id, bezeichnung) VALUES (1, 'stueck'); +INSERT INTO einheit(menge_id, bezeichnung) VALUES (2, 'menge'); + +CREATE TABLE IF NOT EXISTS artikel ( + artikel_id INT NOT NULL PRIMARY KEY, + einheit_id INT NOT NULL, + mwst_id INT NOT NULL, + preis INT NOT NULL, + CONSTRAINT fk_mwst_artikel FOREIGN KEY (mwst_id) REFERENCES mwst(mwst_id), + CONSTRAINT fk_einheit_artikel FOREIGN KEY (einheit_id) REFERENCES einheit(einheit_id) +); From 9f9bf7205b3bd402ee678681fca586371679b96b Mon Sep 17 00:00:00 2001 From: fdenzer Date: Fri, 23 Jun 2023 10:48:27 +0200 Subject: [PATCH 3/8] fix inconsistency --- db_scripts/create.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db_scripts/create.sql b/db_scripts/create.sql index b91c817..23daa87 100644 --- a/db_scripts/create.sql +++ b/db_scripts/create.sql @@ -49,8 +49,8 @@ CREATE TABLE IF NOT EXISTS einheit( bezeichung VARCHAR(50) NOT NULL ); -INSERT INTO einheit(menge_id, bezeichnung) VALUES (1, 'stueck'); -INSERT INTO einheit(menge_id, bezeichnung) VALUES (2, 'menge'); +INSERT INTO einheit(einheit_id, bezeichnung) VALUES (1, 'stueck'); +INSERT INTO einheit(einheit_id, bezeichnung) VALUES (2, 'menge'); CREATE TABLE IF NOT EXISTS artikel ( artikel_id INT NOT NULL PRIMARY KEY, From f0bb37c38c5f696a5aaa54b1d6c21797d2eb0c2b Mon Sep 17 00:00:00 2001 From: Nicksname Date: Fri, 23 Jun 2023 12:29:29 +0200 Subject: [PATCH 4/8] Tippfehler korrigiert --- db_scripts/create.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db_scripts/create.sql b/db_scripts/create.sql index 23daa87..b7b1480 100644 --- a/db_scripts/create.sql +++ b/db_scripts/create.sql @@ -46,7 +46,7 @@ INSERT INTO mwst(mwst_id, prozent) VALUES (2, 19); CREATE TABLE IF NOT EXISTS einheit( einheit_id INT NOT NULL PRIMARY KEY, - bezeichung VARCHAR(50) NOT NULL + bezeichnung VARCHAR(50) NOT NULL ); INSERT INTO einheit(einheit_id, bezeichnung) VALUES (1, 'stueck'); @@ -59,4 +59,4 @@ CREATE TABLE IF NOT EXISTS artikel ( preis INT NOT NULL, CONSTRAINT fk_mwst_artikel FOREIGN KEY (mwst_id) REFERENCES mwst(mwst_id), CONSTRAINT fk_einheit_artikel FOREIGN KEY (einheit_id) REFERENCES einheit(einheit_id) -); +); \ No newline at end of file From ee0c6190a588fde6342c894dc04a9f030730d590 Mon Sep 17 00:00:00 2001 From: Nicksname Date: Fri, 23 Jun 2023 13:10:33 +0200 Subject: [PATCH 5/8] =?UTF-8?q?Datei=20zum=20L=C3=B6schen=20der=20Tabellen?= =?UTF-8?q?=20angelegt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db_scripts/drop.sql | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 db_scripts/drop.sql diff --git a/db_scripts/drop.sql b/db_scripts/drop.sql new file mode 100644 index 0000000..b22754a --- /dev/null +++ b/db_scripts/drop.sql @@ -0,0 +1,7 @@ +DROP TABLE IF EXISTS mitglied; +DROP TABLE IF EXISTS transaktion_art; +DROP TABLE IF EXISTS transaktion; +DROP TABLE IF EXISTS monatlicher_beitrag; +DROP TABLE IF EXISTS mwst; +DROP TABLE IF EXISTS einheit; +DROP TABLE IF EXISTS artikel; From 26d0735bcfbe9e797b4a11ddc058f370ca2d540d Mon Sep 17 00:00:00 2001 From: Nicksname Date: Fri, 23 Jun 2023 14:43:54 +0200 Subject: [PATCH 6/8] Trash-Filter aktualisiert --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2dd30b6..7a162b9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .idea -db/* \ No newline at end of file +db/* +backend/target/* + From 220025e109a313367b1745721a5b76422ef1cdd1 Mon Sep 17 00:00:00 2001 From: Frank Denzer Date: Sat, 15 Jul 2023 16:09:03 +0200 Subject: [PATCH 7/8] add readme content: branches --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index bfd31cd..e4cde26 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,13 @@ # Mitgliederladen + +## Development branches + +backend +: RESTful (Level 2, JSON over RPC) API using Rust-lang (and probably (actix web framework)[https://actix.rs] plus (utoipa\[sic! 🍺 beer-branded punny name\])[https://github.com/juhaku/utoipa] + +db_scripts +: Database connection using Rust-lang and SQLx + +main +: frontend client as flutter app \ No newline at end of file From 3bfab0bcaee6ba130a265fab9012926e0db7a29e Mon Sep 17 00:00:00 2001 From: Frank Denzer Date: Sat, 15 Jul 2023 16:17:58 +0200 Subject: [PATCH 8/8] fix readme --- README.md | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e4cde26..5462d3e 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,33 @@ ## Development branches backend -: RESTful (Level 2, JSON over RPC) API using Rust-lang (and probably (actix web framework)[https://actix.rs] plus (utoipa\[sic! 🍺 beer-branded punny name\])[https://github.com/juhaku/utoipa] +: Server component, using Rust/SQL, offering API (via HTTP/2?) db_scripts -: Database connection using Rust-lang and SQLx +: SQL scripts main -: frontend client as flutter app \ No newline at end of file +: frontend client as flutter app + + + +## Tech used + +### Backend + +- Database connection using Rust-lang and SQLx + +- RESTful (Level 2, JSON over RPC) API using Rust-lang (and probably (actix web framework)[https://actix.rs] plus (utoipa\[sic! 🍺 beer-branded punny name\])[https://github.com/juhaku/utoipa] + +## Frontend + +- Google Flutter using Dart. + +Target platforms? + +- probably Android[^1], iOS[^2]. +- Debug target could be desktop for fastest deployment. Production targets: Perhaps desktop and/or web, if wanted. + + +[1]: via APK? Via Play Store or F-Droid? Then Registration as Play store developer (for charity or one time purchase with credit card?) needed. +[2]: Registration as Apple developer for charity needed. \ No newline at end of file