diff --git a/.env~ b/.env~
deleted file mode 100644
index 352a322..0000000
--- a/.env~
+++ /dev/null
@@ -1,3 +0,0 @@
-R_DATABASES_URL=mysql://inventur:noiqC3OlFGVlRmU8KVPtyzVBLj4W9bbQhnu1zJ5cF75FH4JM2luhI2fvp5YXlTAuKr0Ayw2ZiUGfzortQ0GxqEQ5ICfEQgJtNfto@localhost:3306/inventur
-ROCKET_SECRET_KEY=xT0JL6E1W4P+DNh0bRecNwsgtk0QfJ62t5zxe920s00=
-ROCKET_CLIENT_SECRET=2vftRCu1WhaFezVoFgsNDlx66XOASBmX
diff --git a/.gitignore b/.gitignore
index ec4372c..f2aefc3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -184,3 +184,6 @@ cython_debug/
.env
/private/
Rocket.toml
+# For emacs
+**/*~
+**/.#*
diff --git a/Cargo.toml b/Cargo.toml
index 7af50cf..fda66ef 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,3 +1,21 @@
+# This file is part of inventur.
+# inventur is a simple web app using rocket to help maintain inventory data.
+# Copyright (C) 2024 Johannes Randerath
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+
[package]
name = "inventur"
version = "0.1.0"
diff --git a/db.sql b/db.sql
deleted file mode 100644
index 1708aec..0000000
--- a/db.sql
+++ /dev/null
@@ -1,201 +0,0 @@
-/*!999999\- enable the sandbox mode */
--- MariaDB dump 10.19 Distrib 10.11.8-MariaDB, for Linux (x86_64)
---
--- Host: localhost Database: inventur
--- ------------------------------------------------------
--- Server version 10.11.8-MariaDB
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8mb4 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-
---
--- Current Database: `inventur`
---
-
-CREATE DATABASE /*!32312 IF NOT EXISTS*/ `inventur` /*!40100 DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci */;
-
-USE `inventur`;
-
---
--- Table structure for table `__diesel_schema_migrations`
---
-
-DROP TABLE IF EXISTS `__diesel_schema_migrations`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `__diesel_schema_migrations` (
- `version` varchar(50) NOT NULL,
- `run_on` timestamp NOT NULL DEFAULT current_timestamp(),
- PRIMARY KEY (`version`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `__diesel_schema_migrations`
---
-
-LOCK TABLES `__diesel_schema_migrations` WRITE;
-/*!40000 ALTER TABLE `__diesel_schema_migrations` DISABLE KEYS */;
-INSERT INTO `__diesel_schema_migrations` VALUES
-('20240819150533','2024-08-19 19:57:15'),
-('20240819183025','2024-08-21 18:28:28'),
-('20240821180845','2024-08-21 18:43:01'),
-('20240821185127','2024-08-21 19:07:06'),
-('20240822171815','2024-08-22 18:07:34'),
-('20240822203903','2024-08-22 21:18:07'),
-('20240822205948','2024-08-27 12:00:00'),
-('20240827120510','2024-08-27 12:18:10');
-/*!40000 ALTER TABLE `__diesel_schema_migrations` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `jrcells`
---
-
-DROP TABLE IF EXISTS `jrcells`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `jrcells` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `cell_value` varchar(2048) NOT NULL,
- `jrentry_id` int(11) NOT NULL,
- `jrcolumn_id` int(11) NOT NULL,
- PRIMARY KEY (`id`),
- KEY `jrentry_id` (`jrentry_id`),
- KEY `jrcolumn_id` (`jrcolumn_id`),
- CONSTRAINT `jrcells_ibfk_1` FOREIGN KEY (`jrentry_id`) REFERENCES `jrentries` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `jrcells_ibfk_2` FOREIGN KEY (`jrcolumn_id`) REFERENCES `jrcolumns` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
-) ENGINE=InnoDB AUTO_INCREMENT=4604 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `jrcells`
---
-
-LOCK TABLES `jrcells` WRITE;
-/*!40000 ALTER TABLE `jrcells` DISABLE KEYS */;
-/*!40000 ALTER TABLE `jrcells` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `jrcolumns`
---
-
-DROP TABLE IF EXISTS `jrcolumns`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `jrcolumns` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(255) NOT NULL,
- `jrtable_id` int(11) NOT NULL,
- `id_in_table` int(11) NOT NULL,
- `column_type` int(11) NOT NULL DEFAULT 0,
- PRIMARY KEY (`id`),
- KEY `jrtable` (`jrtable_id`),
- CONSTRAINT `jrtable` FOREIGN KEY (`jrtable_id`) REFERENCES `jrtables` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
-) ENGINE=InnoDB AUTO_INCREMENT=64 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `jrcolumns`
---
-
-LOCK TABLES `jrcolumns` WRITE;
-/*!40000 ALTER TABLE `jrcolumns` DISABLE KEYS */;
-/*!40000 ALTER TABLE `jrcolumns` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `jrentries`
---
-
-DROP TABLE IF EXISTS `jrentries`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `jrentries` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `row_pos` int(11) NOT NULL,
- `jrtable_id` int(11) NOT NULL,
- PRIMARY KEY (`id`),
- KEY `jrtable_id` (`jrtable_id`),
- CONSTRAINT `jrentries_ibfk_1` FOREIGN KEY (`jrtable_id`) REFERENCES `jrtables` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
-) ENGINE=InnoDB AUTO_INCREMENT=1602 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `jrentries`
---
-
-LOCK TABLES `jrentries` WRITE;
-/*!40000 ALTER TABLE `jrentries` DISABLE KEYS */;
-/*!40000 ALTER TABLE `jrentries` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `jrtables`
---
-
-DROP TABLE IF EXISTS `jrtables`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `jrtables` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `name` varchar(255) NOT NULL,
- `owner_id` int(11) NOT NULL,
- PRIMARY KEY (`id`),
- KEY `fk_owner_id` (`owner_id`),
- CONSTRAINT `fk_owner_id` FOREIGN KEY (`owner_id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
-) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `jrtables`
---
-
-LOCK TABLES `jrtables` WRITE;
-/*!40000 ALTER TABLE `jrtables` DISABLE KEYS */;
-/*!40000 ALTER TABLE `jrtables` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
--- Table structure for table `users`
---
-
-DROP TABLE IF EXISTS `users`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `users` (
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `username` varchar(255) NOT NULL,
- `email` varchar(512) NOT NULL,
- PRIMARY KEY (`id`)
-) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping data for table `users`
---
-
-LOCK TABLES `users` WRITE;
-/*!40000 ALTER TABLE `users` DISABLE KEYS */;
-/*!40000 ALTER TABLE `users` ENABLE KEYS */;
-UNLOCK TABLES;
-/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-
--- Dump completed on 2024-08-27 22:05:31
diff --git a/inventur_db/Cargo.toml b/inventur_db/Cargo.toml
index d383fb2..e6dd540 100644
--- a/inventur_db/Cargo.toml
+++ b/inventur_db/Cargo.toml
@@ -1,3 +1,21 @@
+# This file is part of inventur.
+# inventur is a simple web app using rocket to help maintain inventory data.
+# Copyright (C) 2024 Johannes Randerath
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+
[package]
name = "inventur_db"
version = "0.1.0"
diff --git a/inventur_db/diesel.toml b/inventur_db/diesel.toml
index 46a657a..df72bdd 100644
--- a/inventur_db/diesel.toml
+++ b/inventur_db/diesel.toml
@@ -1,3 +1,21 @@
+# This file is part of inventur.
+# inventur is a simple web app using rocket to help maintain inventory data.
+# Copyright (C) 2024 Johannes Randerath
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+
# For documentation on how to configure this file,
# see https://diesel.rs/guides/configuring-diesel-cli
diff --git a/inventur_db/migrations/2024-08-19-150533_create_table/down.sql b/inventur_db/migrations/2024-08-19-150533_create_table/down.sql
index faf6537..4858e25 100644
--- a/inventur_db/migrations/2024-08-19-150533_create_table/down.sql
+++ b/inventur_db/migrations/2024-08-19-150533_create_table/down.sql
@@ -1 +1,19 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
DROP TABLE jrtables;
diff --git a/inventur_db/migrations/2024-08-19-150533_create_table/up.sql b/inventur_db/migrations/2024-08-19-150533_create_table/up.sql
index 644b799..3de0e86 100644
--- a/inventur_db/migrations/2024-08-19-150533_create_table/up.sql
+++ b/inventur_db/migrations/2024-08-19-150533_create_table/up.sql
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
CREATE TABLE jrtables (
id INTEGER AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(255) NOT NULL,
diff --git a/inventur_db/migrations/2024-08-19-183025_create_jrcolumns/down.sql b/inventur_db/migrations/2024-08-19-183025_create_jrcolumns/down.sql
index bbcd7de..26700f8 100644
--- a/inventur_db/migrations/2024-08-19-183025_create_jrcolumns/down.sql
+++ b/inventur_db/migrations/2024-08-19-183025_create_jrcolumns/down.sql
@@ -1 +1,19 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
DROP TABLE jrcolumns;
diff --git a/inventur_db/migrations/2024-08-19-183025_create_jrcolumns/down.sql~ b/inventur_db/migrations/2024-08-19-183025_create_jrcolumns/down.sql~
deleted file mode 100644
index d9a93fe..0000000
--- a/inventur_db/migrations/2024-08-19-183025_create_jrcolumns/down.sql~
+++ /dev/null
@@ -1 +0,0 @@
--- This file should undo anything in `up.sql`
diff --git a/inventur_db/migrations/2024-08-19-183025_create_jrcolumns/up.sql b/inventur_db/migrations/2024-08-19-183025_create_jrcolumns/up.sql
index 0f1e9a7..b59849a 100644
--- a/inventur_db/migrations/2024-08-19-183025_create_jrcolumns/up.sql
+++ b/inventur_db/migrations/2024-08-19-183025_create_jrcolumns/up.sql
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
CREATE TABLE jrcolumns (
id INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
diff --git a/inventur_db/migrations/2024-08-19-183025_create_jrcolumns/up.sql~ b/inventur_db/migrations/2024-08-19-183025_create_jrcolumns/up.sql~
deleted file mode 100644
index 0f1e9a7..0000000
--- a/inventur_db/migrations/2024-08-19-183025_create_jrcolumns/up.sql~
+++ /dev/null
@@ -1,9 +0,0 @@
-CREATE TABLE jrcolumns (
- id INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
- name VARCHAR(255) NOT NULL,
- jrtable_id INTEGER NOT NULL,
- FOREIGN KEY jrtable(jrtable_id) REFERENCES jrtables(id)
- ON DELETE CASCADE
- ON UPDATE CASCADE,
- id_in_table INTEGER NOT NULL
-);
diff --git a/inventur_db/migrations/2024-08-21-180845_create_jrentry/down.sql b/inventur_db/migrations/2024-08-21-180845_create_jrentry/down.sql
index ecd7840..2ce7d2f 100644
--- a/inventur_db/migrations/2024-08-21-180845_create_jrentry/down.sql
+++ b/inventur_db/migrations/2024-08-21-180845_create_jrentry/down.sql
@@ -1 +1,19 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
DROP TABLE jrentries;
diff --git a/inventur_db/migrations/2024-08-21-180845_create_jrentry/down.sql~ b/inventur_db/migrations/2024-08-21-180845_create_jrentry/down.sql~
deleted file mode 100644
index d9a93fe..0000000
--- a/inventur_db/migrations/2024-08-21-180845_create_jrentry/down.sql~
+++ /dev/null
@@ -1 +0,0 @@
--- This file should undo anything in `up.sql`
diff --git a/inventur_db/migrations/2024-08-21-180845_create_jrentry/up.sql b/inventur_db/migrations/2024-08-21-180845_create_jrentry/up.sql
index 09ac916..4b8c864 100644
--- a/inventur_db/migrations/2024-08-21-180845_create_jrentry/up.sql
+++ b/inventur_db/migrations/2024-08-21-180845_create_jrentry/up.sql
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
CREATE TABLE jrentries (
id INTEGER AUTO_INCREMENT NOT NULL PRIMARY KEY,
row_pos INTEGER NOT NULL,
diff --git a/inventur_db/migrations/2024-08-21-180845_create_jrentry/up.sql~ b/inventur_db/migrations/2024-08-21-180845_create_jrentry/up.sql~
deleted file mode 100644
index b37f10d..0000000
--- a/inventur_db/migrations/2024-08-21-180845_create_jrentry/up.sql~
+++ /dev/null
@@ -1 +0,0 @@
--- Your SQL goes here
diff --git a/inventur_db/migrations/2024-08-21-185127_create_jrcell/down.sql b/inventur_db/migrations/2024-08-21-185127_create_jrcell/down.sql
index 3af7819..a289d05 100644
--- a/inventur_db/migrations/2024-08-21-185127_create_jrcell/down.sql
+++ b/inventur_db/migrations/2024-08-21-185127_create_jrcell/down.sql
@@ -1 +1,19 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
DROP TABLE jrcells;
diff --git a/inventur_db/migrations/2024-08-21-185127_create_jrcell/down.sql~ b/inventur_db/migrations/2024-08-21-185127_create_jrcell/down.sql~
deleted file mode 100644
index d9a93fe..0000000
--- a/inventur_db/migrations/2024-08-21-185127_create_jrcell/down.sql~
+++ /dev/null
@@ -1 +0,0 @@
--- This file should undo anything in `up.sql`
diff --git a/inventur_db/migrations/2024-08-21-185127_create_jrcell/up.sql b/inventur_db/migrations/2024-08-21-185127_create_jrcell/up.sql
index c7091d8..47bb68f 100644
--- a/inventur_db/migrations/2024-08-21-185127_create_jrcell/up.sql
+++ b/inventur_db/migrations/2024-08-21-185127_create_jrcell/up.sql
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
CREATE TABLE jrcells (
id INTEGER AUTO_INCREMENT NOT NULL,
PRIMARY KEY(id),
diff --git a/inventur_db/migrations/2024-08-21-185127_create_jrcell/up.sql~ b/inventur_db/migrations/2024-08-21-185127_create_jrcell/up.sql~
deleted file mode 100644
index b37f10d..0000000
--- a/inventur_db/migrations/2024-08-21-185127_create_jrcell/up.sql~
+++ /dev/null
@@ -1 +0,0 @@
--- Your SQL goes here
diff --git a/inventur_db/migrations/2024-08-22-171815_drop_num_fields/down.sql b/inventur_db/migrations/2024-08-22-171815_drop_num_fields/down.sql
index 3df77ef..c5073b3 100644
--- a/inventur_db/migrations/2024-08-22-171815_drop_num_fields/down.sql
+++ b/inventur_db/migrations/2024-08-22-171815_drop_num_fields/down.sql
@@ -1,2 +1,20 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
ALTER TABLE jrtables
ADD num_fields INTEGER NOT NULL;
diff --git a/inventur_db/migrations/2024-08-22-171815_drop_num_fields/down.sql~ b/inventur_db/migrations/2024-08-22-171815_drop_num_fields/down.sql~
deleted file mode 100644
index d9a93fe..0000000
--- a/inventur_db/migrations/2024-08-22-171815_drop_num_fields/down.sql~
+++ /dev/null
@@ -1 +0,0 @@
--- This file should undo anything in `up.sql`
diff --git a/inventur_db/migrations/2024-08-22-171815_drop_num_fields/up.sql b/inventur_db/migrations/2024-08-22-171815_drop_num_fields/up.sql
index c49cac8..da02160 100644
--- a/inventur_db/migrations/2024-08-22-171815_drop_num_fields/up.sql
+++ b/inventur_db/migrations/2024-08-22-171815_drop_num_fields/up.sql
@@ -1,2 +1,20 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
ALTER TABLE jrtables
DROP COLUMN num_fields;
diff --git a/inventur_db/migrations/2024-08-22-171815_drop_num_fields/up.sql~ b/inventur_db/migrations/2024-08-22-171815_drop_num_fields/up.sql~
deleted file mode 100644
index b37f10d..0000000
--- a/inventur_db/migrations/2024-08-22-171815_drop_num_fields/up.sql~
+++ /dev/null
@@ -1 +0,0 @@
--- Your SQL goes here
diff --git a/inventur_db/migrations/2024-08-22-203903_create_users/#up.sql# b/inventur_db/migrations/2024-08-22-203903_create_users/#up.sql#
new file mode 100644
index 0000000..edff528
--- /dev/null
+++ b/inventur_db/migrations/2024-08-22-203903_create_users/#up.sql#
@@ -0,0 +1,24 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+CREATE TABLE users (
+ id INTEGER AUTO_INCREMENT NOT NULL,
+ PRIMARY KEY(id),
+ username VARCHAR(255) NOT NULL,
+ email VARCHAR(512) NOT NULL
+);
diff --git a/inventur_db/migrations/2024-08-22-203903_create_users/down.sql b/inventur_db/migrations/2024-08-22-203903_create_users/down.sql
index cc1f647..08da082 100644
--- a/inventur_db/migrations/2024-08-22-203903_create_users/down.sql
+++ b/inventur_db/migrations/2024-08-22-203903_create_users/down.sql
@@ -1 +1,19 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
DROP TABLE users;
diff --git a/inventur_db/migrations/2024-08-22-203903_create_users/down.sql~ b/inventur_db/migrations/2024-08-22-203903_create_users/down.sql~
deleted file mode 100644
index d9a93fe..0000000
--- a/inventur_db/migrations/2024-08-22-203903_create_users/down.sql~
+++ /dev/null
@@ -1 +0,0 @@
--- This file should undo anything in `up.sql`
diff --git a/inventur_db/migrations/2024-08-22-203903_create_users/up.sql b/inventur_db/migrations/2024-08-22-203903_create_users/up.sql
index e71bc19..edff528 100644
--- a/inventur_db/migrations/2024-08-22-203903_create_users/up.sql
+++ b/inventur_db/migrations/2024-08-22-203903_create_users/up.sql
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
CREATE TABLE users (
id INTEGER AUTO_INCREMENT NOT NULL,
PRIMARY KEY(id),
diff --git a/inventur_db/migrations/2024-08-22-203903_create_users/up.sql~ b/inventur_db/migrations/2024-08-22-203903_create_users/up.sql~
deleted file mode 100644
index b37f10d..0000000
--- a/inventur_db/migrations/2024-08-22-203903_create_users/up.sql~
+++ /dev/null
@@ -1 +0,0 @@
--- Your SQL goes here
diff --git a/inventur_db/migrations/2024-08-22-205948_add_owner_to_table/down.sql b/inventur_db/migrations/2024-08-22-205948_add_owner_to_table/down.sql
index 8778314..8fb5b76 100644
--- a/inventur_db/migrations/2024-08-22-205948_add_owner_to_table/down.sql
+++ b/inventur_db/migrations/2024-08-22-205948_add_owner_to_table/down.sql
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
SET FOREIGN_KEY_CHECKS=0;
UPDATE TABLE jrtables
DROP COLUMN owner_id
diff --git a/inventur_db/migrations/2024-08-22-205948_add_owner_to_table/down.sql~ b/inventur_db/migrations/2024-08-22-205948_add_owner_to_table/down.sql~
deleted file mode 100644
index d9a93fe..0000000
--- a/inventur_db/migrations/2024-08-22-205948_add_owner_to_table/down.sql~
+++ /dev/null
@@ -1 +0,0 @@
--- This file should undo anything in `up.sql`
diff --git a/inventur_db/migrations/2024-08-22-205948_add_owner_to_table/up.sql b/inventur_db/migrations/2024-08-22-205948_add_owner_to_table/up.sql
index 2f72bb3..af1da75 100644
--- a/inventur_db/migrations/2024-08-22-205948_add_owner_to_table/up.sql
+++ b/inventur_db/migrations/2024-08-22-205948_add_owner_to_table/up.sql
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE jrtables
ADD owner_id INTEGER NOT NULL;
diff --git a/inventur_db/migrations/2024-08-22-205948_add_owner_to_table/up.sql~ b/inventur_db/migrations/2024-08-22-205948_add_owner_to_table/up.sql~
deleted file mode 100644
index b37f10d..0000000
--- a/inventur_db/migrations/2024-08-22-205948_add_owner_to_table/up.sql~
+++ /dev/null
@@ -1 +0,0 @@
--- Your SQL goes here
diff --git a/inventur_db/migrations/2024-08-27-120510_add_column_type/down.sql b/inventur_db/migrations/2024-08-27-120510_add_column_type/down.sql
index 91fa6b0..883bb44 100644
--- a/inventur_db/migrations/2024-08-27-120510_add_column_type/down.sql
+++ b/inventur_db/migrations/2024-08-27-120510_add_column_type/down.sql
@@ -1,2 +1,20 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
ALTER TABLE jrcolumns
DROP COLUMN column_type;
diff --git a/inventur_db/migrations/2024-08-27-120510_add_column_type/down.sql~ b/inventur_db/migrations/2024-08-27-120510_add_column_type/down.sql~
deleted file mode 100644
index d9a93fe..0000000
--- a/inventur_db/migrations/2024-08-27-120510_add_column_type/down.sql~
+++ /dev/null
@@ -1 +0,0 @@
--- This file should undo anything in `up.sql`
diff --git a/inventur_db/migrations/2024-08-27-120510_add_column_type/up.sql b/inventur_db/migrations/2024-08-27-120510_add_column_type/up.sql
index 5f50c1b..360971a 100644
--- a/inventur_db/migrations/2024-08-27-120510_add_column_type/up.sql
+++ b/inventur_db/migrations/2024-08-27-120510_add_column_type/up.sql
@@ -1,2 +1,20 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
ALTER TABLE jrcolumns
ADD column_type INTEGER NOT NULL DEFAULT 0;
diff --git a/inventur_db/migrations/2024-08-27-120510_add_column_type/up.sql~ b/inventur_db/migrations/2024-08-27-120510_add_column_type/up.sql~
deleted file mode 100644
index b37f10d..0000000
--- a/inventur_db/migrations/2024-08-27-120510_add_column_type/up.sql~
+++ /dev/null
@@ -1 +0,0 @@
--- Your SQL goes here
diff --git a/inventur_db/src/bin/add_cell.rs~ b/inventur_db/src/bin/add_cell.rs~
deleted file mode 100644
index 7bd8dad..0000000
--- a/inventur_db/src/bin/add_cell.rs~
+++ /dev/null
@@ -1,28 +0,0 @@
-use inventur_db::*;
-use std::env::args;
-
-fn main() {
- let tblid = args()
- .nth(1)
- .expect("Usage: add_cell .")
- .parse::()
- .expect("Expected a number.");
-
- let rowpos = args()
- .nth(2)
- .expect("Usage: add_cell .")
- .parse::()
- .expect("Expected a number.");
-
- let idintbl = args()
- .nth(3)
- .expect("Usage: add_cell .")
- .parse::()
- .expect("Expected a number.");
-
- let value = args()
- .nth(4)
- .expect("Usage: add_cell .");
-
- println!("{:?}", create_jrcell_relative(&mut establish_connection(), tblid, rowpos, idintbl, value));
-}
diff --git a/inventur_db/src/bin/add_column.rs b/inventur_db/src/bin/add_column.rs
index 7666534..168c9ae 100644
--- a/inventur_db/src/bin/add_column.rs
+++ b/inventur_db/src/bin/add_column.rs
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use inventur_db::*;
use std::env::args;
diff --git a/inventur_db/src/bin/add_column.rs~ b/inventur_db/src/bin/add_column.rs~
deleted file mode 100644
index 15d8166..0000000
--- a/inventur_db/src/bin/add_column.rs~
+++ /dev/null
@@ -1,15 +0,0 @@
-use inventur_db::*;
-use std::env::args;
-
-fn main() {
- let name = args()
- .nth(1)
- .expect("Name missing");
- let table_id = args()
- .nth(2)
- .expect("Table_id missing.")
- .parse::()
- .expect("Expected a number as table id.");
- let conn = &mut establish_connection();
- jrcolumns::create_jrcolumn(conn, name, table_id);
-}
diff --git a/inventur_db/src/bin/add_entry.rs b/inventur_db/src/bin/add_entry.rs
index 3254a59..1f4b4e6 100644
--- a/inventur_db/src/bin/add_entry.rs
+++ b/inventur_db/src/bin/add_entry.rs
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use inventur_db::*;
use std::env::args;
use std::io::{stdin, Read};
diff --git a/inventur_db/src/bin/add_entry.rs~ b/inventur_db/src/bin/add_entry.rs~
deleted file mode 100644
index e7445fe..0000000
--- a/inventur_db/src/bin/add_entry.rs~
+++ /dev/null
@@ -1,36 +0,0 @@
-use inventur_db::*;
-use std::env::args;
-use std::io::{stdin, Read};
-
-fn main() {
- let tblid = args()
- .nth(1)
- .expect("Usage: add_entry .")
- .parse::()
- .expect("Usage: add_entry .");
-
- let uid = args()
- .nth(2)
- .expect("Usage: add_entry .")
- .parse::()
- .expect("Usage: add_entry .");
-
- let conn = &mut establish_connection();
-
- let tbl = get_table(conn, tblid, uid);
- if tbl.is_none() {
- panic!("Table not found.");
- }
- let tbl = tbl.unwrap();
- let mut rows = Vec::new();
- for clm in tbl.column_names {
- println!("{}:", clm);
- let mut cell = String::new();
- stdin().read_line(&mut cell);
- rows.push(cell.clone());
- }
-
-
- println!("{}", add_row(conn, tblid, rows, uid).expect("Error"));
-
-}
diff --git a/inventur_db/src/bin/change_cell_value.rs b/inventur_db/src/bin/change_cell_value.rs
index 3e4c0ab..29fd2f5 100644
--- a/inventur_db/src/bin/change_cell_value.rs
+++ b/inventur_db/src/bin/change_cell_value.rs
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use inventur_db::*;
use std::env::args;
diff --git a/inventur_db/src/bin/change_cell_value.rs~ b/inventur_db/src/bin/change_cell_value.rs~
deleted file mode 100644
index f125f0e..0000000
--- a/inventur_db/src/bin/change_cell_value.rs~
+++ /dev/null
@@ -1,28 +0,0 @@
-use inventur_db::*;
-use std::env::args;
-
-fn main() {
- let tblid = args()
- .nth(1)
- .expect("Usage: change_cell_value .")
- .parse::()
- .expect("Expected a number.");
-
- let rowpos = args()
- .nth(2)
- .expect("Usage: change_cell_value .")
- .parse::()
- .expect("Expected a number.");
-
- let idintbl = args()
- .nth(3)
- .expect("Usage: change_cell_value .")
- .parse::()
- .expect("Expected a number.");
-
- let newvalue = args()
- .nth(4)
- .expect("Usage: change_cell_value .");
-
- println!("{:?}", jrcells::change_jrcell_value_relative(&mut establish_connection(), tblid, rowpos, idintbl, newvalue));
-}
diff --git a/inventur_db/src/bin/create_table.rs b/inventur_db/src/bin/create_table.rs
index 6f00563..c458cb7 100644
--- a/inventur_db/src/bin/create_table.rs
+++ b/inventur_db/src/bin/create_table.rs
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use inventur_db::*;
use std::io::stdin;
diff --git a/inventur_db/src/bin/create_table.rs~ b/inventur_db/src/bin/create_table.rs~
deleted file mode 100644
index c5f8678..0000000
--- a/inventur_db/src/bin/create_table.rs~
+++ /dev/null
@@ -1,38 +0,0 @@
-use inventur_db::*;
-use std::io::stdin;
-
-fn main() {
- let conn = &mut establish_connection();
-
- let mut name = String::new();
- let mut num_fields = String::new();
- let mut uid = String::new();
-
- println!("Name: ");
- stdin().read_line(&mut name).unwrap();
- let name = name.trim_end();
- println!("Number of fields: ");
- stdin().read_line(&mut num_fields);
- println!("Userid:");
- stdin().read_line(&mut uid);
- let uid = uid
- .trim()
- .parse::()
- .expect("Number expected.");
- let num_fields = num_fields
- .trim()
- .parse::()
- .expect("Number expected");
-
- let mut fields = Vec::new();
-
- for i in 0..num_fields {
- let mut field = String::new();
- stdin().read_line(&mut field);
- field.trim();
- fields.push(field);
- }
-
-
- println!("{}", create_table(conn, name.to_string(), fields, uid).unwrap());
-}
diff --git a/inventur_db/src/bin/create_user.rs b/inventur_db/src/bin/create_user.rs
index 2150c8b..85a9b3a 100644
--- a/inventur_db/src/bin/create_user.rs
+++ b/inventur_db/src/bin/create_user.rs
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use inventur_db::*;
use std::env::args;
diff --git a/inventur_db/src/bin/create_user.rs~ b/inventur_db/src/bin/create_user.rs~
deleted file mode 100644
index 2150c8b..0000000
--- a/inventur_db/src/bin/create_user.rs~
+++ /dev/null
@@ -1,14 +0,0 @@
-use inventur_db::*;
-use std::env::args;
-
-fn main() {
- let uname = args()
- .nth(1)
- .expect("Usage: create_user .");
-
- let mail = args()
- .nth(2)
- .expect("Usage: create_user .");
-
- println!("{}", register_or_login(&mut establish_connection(), uname, mail).unwrap().uid);
-}
diff --git a/inventur_db/src/bin/delete_cell.rs~ b/inventur_db/src/bin/delete_cell.rs~
deleted file mode 100644
index a988326..0000000
--- a/inventur_db/src/bin/delete_cell.rs~
+++ /dev/null
@@ -1,24 +0,0 @@
-use inventur_db::*;
-use std::env::args;
-
-fn main() {
- let tblid = args()
- .nth(1)
- .expect("Usage: add_cell .")
- .parse::()
- .expect("Expected a number.");
-
- let rowpos = args()
- .nth(2)
- .expect("Usage: add_cell .")
- .parse::()
- .expect("Expected a number.");
-
- let idintbl = args()
- .nth(3)
- .expect("Usage: add_cell .")
- .parse::()
- .expect("Expected a number.");
-
- println!("{:?}", delete_jrcell_relative(&mut establish_connection(), tblid, rowpos, idintbl));
-}
diff --git a/inventur_db/src/bin/delete_column.rs b/inventur_db/src/bin/delete_column.rs
index 6a57441..4ae5c10 100644
--- a/inventur_db/src/bin/delete_column.rs
+++ b/inventur_db/src/bin/delete_column.rs
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use inventur_db::*;
use std::env::args;
diff --git a/inventur_db/src/bin/delete_column.rs~ b/inventur_db/src/bin/delete_column.rs~
deleted file mode 100644
index a22909f..0000000
--- a/inventur_db/src/bin/delete_column.rs~
+++ /dev/null
@@ -1,20 +0,0 @@
-use inventur_db::*;
-use std::env::args;
-
-fn main() {
- let tblid = args()
- .nth(1)
- .expect("Table id missing.")
- .parse::()
- .expect("Expected a number.");
-
- let idintbl = args()
- .nth(2)
- .expect("Id in table missing.")
- .parse::()
- .expect("Expected a number.");
-
- let conn = &mut establish_connection();
-
- println!("{:?}", jrcolumns::delete_column_relative(conn, tblid, idintbl));
-}
diff --git a/inventur_db/src/bin/delete_entry.rs b/inventur_db/src/bin/delete_entry.rs
index eb5b0d1..e5fbb54 100644
--- a/inventur_db/src/bin/delete_entry.rs
+++ b/inventur_db/src/bin/delete_entry.rs
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use inventur_db::*;
use std::env::args;
diff --git a/inventur_db/src/bin/delete_entry.rs~ b/inventur_db/src/bin/delete_entry.rs~
deleted file mode 100644
index 4ccf63f..0000000
--- a/inventur_db/src/bin/delete_entry.rs~
+++ /dev/null
@@ -1,19 +0,0 @@
-use inventur_db::*;
-use std::env::args;
-
-fn main() {
- let tblid = args()
- .nth(1)
- .expect("Usage: delete_entry ")
- .parse::()
- .expect("Expected a number.");
-
- let rowpos = args()
- .nth(2)
- .expect("Usage: delete_entry ")
- .parse::()
- .expect("Expected a number.");
-
- jrentries::delete_jrentry_relative(&mut establish_connection(), tblid, rowpos);
-
-}
diff --git a/inventur_db/src/bin/delete_table.rs b/inventur_db/src/bin/delete_table.rs
index 29cf8e0..ff797c4 100644
--- a/inventur_db/src/bin/delete_table.rs
+++ b/inventur_db/src/bin/delete_table.rs
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use inventur_db::*;
use std::env::args;
diff --git a/inventur_db/src/bin/delete_table.rs~ b/inventur_db/src/bin/delete_table.rs~
deleted file mode 100644
index 33b928c..0000000
--- a/inventur_db/src/bin/delete_table.rs~
+++ /dev/null
@@ -1,12 +0,0 @@
-use inventur_db::*;
-use std::env::args;
-
-fn main() {
- let tblid = args()
- .nth(1)
- .expect("Usage: delete_jrtable .")
- .parse::()
- .expect("Expected a number.");
-
- println!("{:?}", jrtables::delete_jrtable(&mut establish_connection(), tblid));
-}
diff --git a/inventur_db/src/bin/delete_user.rs b/inventur_db/src/bin/delete_user.rs
index 45c064e..e27a20f 100644
--- a/inventur_db/src/bin/delete_user.rs
+++ b/inventur_db/src/bin/delete_user.rs
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use inventur_db::*;
use std::env::args;
diff --git a/inventur_db/src/bin/delete_user.rs~ b/inventur_db/src/bin/delete_user.rs~
deleted file mode 100644
index 197dd05..0000000
--- a/inventur_db/src/bin/delete_user.rs~
+++ /dev/null
@@ -1,19 +0,0 @@
-use inventur_db::*;
-use std::env::args;
-
-fn main() {
- let arg = args()
- .nth(1)
- .expect("Missing argument.");
-
- let conn = &mut establish_connection();
- let mut uid = users::get_uid_uname(conn, &arg);
- if uid.is_err() {
- uid = users::get_uid_email(conn, &arg);
- }
- if uid.is_err() {
- panic!("User not found!");
- }
- let uid = uid.unwrap();
- delete_user(conn, uid);
-}
diff --git a/inventur_db/src/bin/move_column.rs b/inventur_db/src/bin/move_column.rs
index 8265f0b..10e2707 100644
--- a/inventur_db/src/bin/move_column.rs
+++ b/inventur_db/src/bin/move_column.rs
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use std::env::args;
use inventur_db::*;
diff --git a/inventur_db/src/bin/move_column.rs~ b/inventur_db/src/bin/move_column.rs~
deleted file mode 100644
index f89a7ac..0000000
--- a/inventur_db/src/bin/move_column.rs~
+++ /dev/null
@@ -1,25 +0,0 @@
-use std::env::args;
-use inventur_db::*;
-
-fn main() {
- let tblid = args()
- .nth(1)
- .expect("Table id missing.")
- .parse::()
- .expect("Expected a number.");
-
- let idintbl = args()
- .nth(2)
- .expect("Id in table missing.")
- .parse::()
- .expect("Expected a number.");
-
- let newidintbl = args()
- .nth(3)
- .expect("New id in table missing.")
- .parse::()
- .expect("Expected a number.");
-
- let conn = &mut establish_connection();
- jrcolumns::move_column_relative(conn, tblid, idintbl, newidintbl);
-}
diff --git a/inventur_db/src/bin/move_entry.rs b/inventur_db/src/bin/move_entry.rs
index 05097d4..8c0cb11 100644
--- a/inventur_db/src/bin/move_entry.rs
+++ b/inventur_db/src/bin/move_entry.rs
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use inventur_db::*;
use std::env::args;
diff --git a/inventur_db/src/bin/move_entry.rs~ b/inventur_db/src/bin/move_entry.rs~
deleted file mode 100644
index 6d3ae3b..0000000
--- a/inventur_db/src/bin/move_entry.rs~
+++ /dev/null
@@ -1,25 +0,0 @@
-use inventur_db::*;
-use std::env::args;
-
-fn main() {
- let tblid = args()
- .nth(1)
- .expect("Usage: move_entry .")
- .parse::()
- .expect("Expected a number.");
-
- let rowpos = args()
- .nth(2)
- .expect("Usage: move_entry .")
- .parse::()
- .expect("Expected a number.");
-
- let newpos = args()
- .nth(3)
- .expect("Usage: move_entry .")
- .parse::()
- .expect("Expected a number.");
-
- println!("{:?}", jrentries::move_jrentry(&mut establish_connection(), tblid, rowpos, newpos));
-
-}
diff --git a/inventur_db/src/bin/rename_column.rs b/inventur_db/src/bin/rename_column.rs
index f94ac9a..4d15c09 100644
--- a/inventur_db/src/bin/rename_column.rs
+++ b/inventur_db/src/bin/rename_column.rs
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use inventur_db::*;
use std::env::args;
diff --git a/inventur_db/src/bin/rename_column.rs~ b/inventur_db/src/bin/rename_column.rs~
deleted file mode 100644
index cd5b841..0000000
--- a/inventur_db/src/bin/rename_column.rs~
+++ /dev/null
@@ -1,27 +0,0 @@
-use inventur_db::*;
-use std::env::args;
-
-fn main() {
- if args().len() != 4 {
- panic!("Usage: rename_column .");
- }
- let table_id = args()
- .nth(1)
- .unwrap()
- .parse::()
- .expect("Table id must be a number.");
-
- let id_in_table = args()
- .nth(2)
- .unwrap()
- .parse::()
- .expect("id in table must be a number.");
-
- let name = args()
- .nth(3)
- .unwrap();
-
- let conn = &mut establish_connection();
-
- jrcolumns::rename_column_relative(conn, table_id, id_in_table, name);
-}
diff --git a/inventur_db/src/bin/rename_jrtable.rs b/inventur_db/src/bin/rename_jrtable.rs
index 06b951c..574c596 100644
--- a/inventur_db/src/bin/rename_jrtable.rs
+++ b/inventur_db/src/bin/rename_jrtable.rs
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use inventur_db::*;
use std::env::args;
diff --git a/inventur_db/src/bin/rename_jrtable.rs~ b/inventur_db/src/bin/rename_jrtable.rs~
deleted file mode 100644
index 1919592..0000000
--- a/inventur_db/src/bin/rename_jrtable.rs~
+++ /dev/null
@@ -1,23 +0,0 @@
-use inventur_db::*;
-use std::env::args;
-
-fn main() {
- let table_id = args()
- .nth(1)
- .expect("Usage: rename_jrtable .")
- .parse::()
- .expect("number expected for id.");
-
- let uid = args()
- .nth(2)
- .expect("Usage: rename_jrtable .")
- .parse::()
- .expect("Usage: rename_jrtable .");
-
- let new_name = args()
- .nth(3)
- .expect("Usage: rename_jrtable .");
-
- let conn = &mut establish_connection();
- rename_table(conn, table_id, uid, new_name);
-}
diff --git a/inventur_db/src/bin/show_table.rs b/inventur_db/src/bin/show_table.rs
index a408770..e53ec83 100644
--- a/inventur_db/src/bin/show_table.rs
+++ b/inventur_db/src/bin/show_table.rs
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use inventur_db::*;
use std::env::args;
diff --git a/inventur_db/src/bin/show_table.rs~ b/inventur_db/src/bin/show_table.rs~
deleted file mode 100644
index cbdf684..0000000
--- a/inventur_db/src/bin/show_table.rs~
+++ /dev/null
@@ -1,29 +0,0 @@
-use inventur_db::*;
-use std::env::args;
-
-fn main() {
- let tblid = args()
- .nth(1)
- .expect("Usage: show_table .")
- .parse::()
- .expect("Expected a number.");
- let tbl = get_table(&mut establish_connection(), tblid, 1);
- if tbl.is_none() {
- panic!("Couldn't get table.");
- }
- let tbl = tbl.unwrap();
- println!("Table {}: {}", tbl.tblid, tbl.name);
- println!();
- print!("|");
- for clm in tbl.column_names {
- print!(" {} |", clm);
- }
- println!();
- for row in tbl.rows {
- print!("|");
- for cell in row.cells {
- print!(" {} |", cell);
- }
- println!();
- }
-}
diff --git a/inventur_db/src/bin/show_tables.rs~ b/inventur_db/src/bin/show_tables.rs~
deleted file mode 100644
index 55112bd..0000000
--- a/inventur_db/src/bin/show_tables.rs~
+++ /dev/null
@@ -1,16 +0,0 @@
-use inventur_db::*;
-
-fn main() {
-
- let conn = &mut establish_connection();
- let results = get_all_tables(conn).expect("Error loading tables.");
-
- println!("Total: {} tables.", results.len());
- for table in results {
- println!("{}: {} has {} columns.", table.id, table.name, table.num_fields);
- let columns = get_columns_of(conn, table.id).expect(format!("Error reading columns for table {}.", table.id).as_str());
- for column in columns {
- print!("{} ", column.name);
- }
- }
-}
diff --git a/inventur_db/src/bin/show_user_tblids.rs b/inventur_db/src/bin/show_user_tblids.rs
index e6758df..a2c86de 100644
--- a/inventur_db/src/bin/show_user_tblids.rs
+++ b/inventur_db/src/bin/show_user_tblids.rs
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use inventur_db::*;
use std::env::args;
diff --git a/inventur_db/src/bin/show_user_tblids.rs~ b/inventur_db/src/bin/show_user_tblids.rs~
deleted file mode 100644
index 737ef9c..0000000
--- a/inventur_db/src/bin/show_user_tblids.rs~
+++ /dev/null
@@ -1,10 +0,0 @@
-use inventur_db::*;
-use std::env::args;
-
-fn main() {
- let uid = args()
- .nth(1)
- .parse::()
- .expect("Usage: show_user_tblids .");
- println!("{:?}", get_user_tblids(uid));
-}
diff --git a/inventur_db/src/jrcells.rs b/inventur_db/src/jrcells.rs
index d4d00d2..5220b15 100644
--- a/inventur_db/src/jrcells.rs
+++ b/inventur_db/src/jrcells.rs
@@ -1,3 +1,20 @@
+/* Simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use crate::schema;
use crate::models;
use crate::jrcolumns;
diff --git a/inventur_db/src/jrcells.rs~ b/inventur_db/src/jrcells.rs~
deleted file mode 100644
index 8c9d020..0000000
--- a/inventur_db/src/jrcells.rs~
+++ /dev/null
@@ -1,98 +0,0 @@
-use crate::schema;
-use crate::models;
-use crate::jrcolumns;
-use crate::jrentries;
-
-use models::{ Jrcell, NewJrcell };
-use schema::jrcells::dsl::{jrcells, id, jrentry_id, jrcolumn_id, cell_value};
-
-use diesel::prelude::*;
-use diesel::mysql::MysqlConnection;
-
-
-pub fn create_jrcell_relative(conn: &mut MysqlConnection, tblid: i32, rowpos: i32, idintbl: i32, value: String) -> Result {
- let ntrid = jrentries::get_jrentry_id(conn, tblid, rowpos);
- if ntrid.is_err() {
- return Err(ntrid.err().unwrap());
- }
- let ntrid = ntrid.unwrap();
- let clmid = jrcolumns::get_clmid_relative(conn, tblid, idintbl);
- if clmid.is_err() {
- return Err(clmid.err().unwrap());
- }
- let clmid = clmid.unwrap();
- create_jrcell(conn, ntrid, clmid, value)
-}
-
-pub fn change_jrcell_value_relative(conn: &mut MysqlConnection, tblid: i32, rowpos: i32, idintbl: i32, new_value: String) -> Result {
- let ntrid = jrentries::get_jrentry_id(conn, tblid, rowpos);
- if ntrid.is_err() {
- return Err(ntrid.err().unwrap());
- }
- let ntrid = ntrid.unwrap();
- let clmid = jrcolumns::get_clmid_relative(conn, tblid, idintbl);
- if clmid.is_err() {
- return Err(clmid.err().unwrap());
- }
- let clmid = clmid.unwrap();
- change_jrcell_value(conn, ntrid, clmid, new_value)
-}
-
-pub fn delete_jrcell_relative(conn: &mut MysqlConnection, tblid: i32, rowpos: i32, idintbl: i32) -> Result {
- let ntrid = jrentries::get_jrentry_id(conn, tblid, rowpos);
- if ntrid.is_err() {
- return Err(ntrid.err().unwrap());
- }
- let ntrid = ntrid.unwrap();
- let clmid = jrcolumns::get_clmid_relative(conn, tblid, idintbl);
- if clmid.is_err() {
- return Err(clmid.err().unwrap());
- }
- let clmid = clmid.unwrap();
- delete_jrcell(conn, ntrid, clmid)
-}
-
-pub fn create_jrcell(conn: &mut MysqlConnection, entryid: i32, columnid: i32, value: String) -> Result {
- use self::schema::jrentries::dsl::jrentries;
- use self::schema::jrcolumns::dsl::jrcolumns;
-
- let ntr = jrentries
- .find(entryid)
- .execute(conn);
- if ntr.is_err() {
- return ntr;
- }
-
- let clmn = jrcolumns
- .find(columnid)
- .execute(conn);
- if clmn.is_err() {
- return clmn;
- }
-
- let cell = NewJrcell { cell_value: value, jrentry_id: entryid, jrcolumn_id: columnid };
- diesel::insert_into(crate::schema::jrcells::table)
- .values(cell)
- .execute(conn)
-
-
-}
-
-pub fn change_jrcell_value(conn: &mut MysqlConnection, entryid: i32, columnid: i32, new_value: String) -> Result {
- diesel::update(jrcells.filter(jrentry_id.eq(entryid)).filter(jrcolumn_id.eq(columnid)))
- .set(cell_value.eq(new_value))
- .execute(conn)
-}
-
-pub fn delete_jrcell(conn: &mut MysqlConnection, entryid: i32, columnid: i32) -> Result {
- diesel::delete(jrcells.filter(jrentry_id.eq(entryid)).filter(jrcolumn_id.eq(columnid)))
- .execute(conn)
-}
-
-
-pub fn get_entry_cells(conn: &mut MysqlConnection, entryid: i32) -> Result, diesel::result::Error> {
- jrcells
- .filter(jrentry_id.eq(entryid))
- .select(Jrcell::as_select())
- .load(conn)
-}
diff --git a/inventur_db/src/jrcolumns.rs b/inventur_db/src/jrcolumns.rs
index 3543c5c..beda82d 100644
--- a/inventur_db/src/jrcolumns.rs
+++ b/inventur_db/src/jrcolumns.rs
@@ -1,3 +1,20 @@
+/* Simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use diesel::prelude::*;
use diesel::mysql::MysqlConnection;
use crate::models;
diff --git a/inventur_db/src/jrcolumns.rs~ b/inventur_db/src/jrcolumns.rs~
deleted file mode 100644
index 4d4b6c9..0000000
--- a/inventur_db/src/jrcolumns.rs~
+++ /dev/null
@@ -1,197 +0,0 @@
-use diesel::prelude::*;
-use diesel::mysql::MysqlConnection;
-use crate::models;
-use crate::schema;
-use crate::jrtables;
-use models::{ Jrcolumn, NewJrcolumn };
-use schema::jrcolumns::dsl::{ jrcolumns, id, name, jrtable_id, id_in_table };
-
-
-pub fn create_jrcolumn(conn: &mut MysqlConnection, tblid: i32, clmnname: String) -> Result {
- let ncols = jrtables::get_ncols(conn, tblid);
- if ncols.is_err() {
- return ncols;
- }
- let ncols = ncols.unwrap() as i32;
- let jrcolumn = NewJrcolumn { name: clmnname, jrtable_id: tblid, id_in_table: ncols + 1 };
- diesel::insert_into(crate::schema::jrcolumns::table)
- .values(&jrcolumn)
- .execute(conn)
-
-}
-
-pub fn create_jrcolumns(conn: &mut MysqlConnection, tblid: i32, names: Vec) -> Result {
- let mut cols : Vec = Vec::new();
- let ncols = jrtables::get_ncols(conn, tblid);
- if ncols.is_err() {
- return ncols;
- }
- let mut ncols = ncols.unwrap() as i32;
- for clmnname in names {
- ncols += 1;
- cols.push(NewJrcolumn { name: clmnname, jrtable_id: tblid, id_in_table: ncols});
- }
- let cols = cols;
-
- diesel::insert_into(crate::schema::jrcolumns::table)
- .values(&cols)
- .execute(conn)
-
-}
-
-pub fn get_last_column_id_of(conn: &mut MysqlConnection, tblid: i32) -> Result {
- jrcolumns
- .filter(jrtable_id.eq(tblid))
- .order(id_in_table.desc())
- .select(id)
- .first::(conn)
-}
-
-pub fn get_columns_of(conn: &mut MysqlConnection, tblid: i32) -> Result, diesel::result::Error> {
- jrcolumns
- .filter(jrtable_id.eq(tblid))
- .order(id_in_table.asc())
- .select(Jrcolumn::as_select())
- .load(conn)
-}
-
-pub fn get_clmid_relative(conn: &mut MysqlConnection, tblid: i32, idintbl: i32) -> Result {
- jrcolumns
- .filter(jrtable_id.eq(tblid))
- .filter(id_in_table.eq(idintbl))
- .select(id)
- .first::(conn)
-}
-
-pub fn rename_column_relative(conn: &mut MysqlConnection, tblid: i32, id_in_tbl: i32, new_name: String) -> Result {
- let clmid = get_clmid_relative(conn, tblid, id_in_tbl);
- if clmid.is_err() {
- return Err(clmid.err().unwrap());
- }
- rename_column(conn, clmid.unwrap(), new_name)
-}
-
-pub fn rename_column(conn: &mut MysqlConnection, clmnid: i32, new_name: String) -> Result {
- diesel::update(jrcolumns.find(clmnid))
- .set(name.eq(new_name))
- .execute(conn)
-}
-
-pub fn move_column_relative(conn: &mut MysqlConnection, tblid: i32, id_in_tbl: i32, new_id_in_tbl: i32) -> Result {
- let clmid = get_clmid_relative(conn, tblid, id_in_tbl);
- if clmid.is_err() {
- return Err(clmid.err().unwrap());
- }
- move_column(conn, clmid.unwrap(), new_id_in_tbl)
-}
-
-pub fn move_column(conn: &mut MysqlConnection, clmnid: i32, new_id_in_table: i32) -> Result{
- let tbl_id = jrcolumns
- .find(clmnid)
- .select(jrtable_id)
- .first::(conn);
-
- if tbl_id.is_err() {
- return Err(tbl_id.err().unwrap());
- }
- let tbl_id = tbl_id.unwrap();
-
- let cols = jrcolumns
- .filter(jrtable_id.eq(tbl_id))
- .order(id_in_table.asc())
- .select(Jrcolumn::as_select())
- .load(conn);
-
- if cols.is_err() {
- return Err(cols.err().unwrap());
- }
- let cols = cols.unwrap();
- let ncols = cols.len() as i32;
-
- if new_id_in_table > ncols || new_id_in_table < 0 {
- return Err(diesel::result::Error::NotFound);
- }
-
- let cur_id_in_table =
- jrcolumns
- .find(clmnid)
- .select(id_in_table)
- .first::(conn);
-
- if cur_id_in_table.is_err() {
- return Err(cur_id_in_table.err().unwrap());
- }
- let cur_id_in_table = cur_id_in_table.unwrap();
-
- let dir;
- let a;
- let b;
- if cur_id_in_table < new_id_in_table {
- dir = -1;
- a = cur_id_in_table + 1;
- b = new_id_in_table;
- } else {
- dir = 1;
- a = new_id_in_table;
- b = cur_id_in_table - 1;
- }
-
- for j in a..=b {
- let upd = diesel::update(jrcolumns.find(cols[(j-1) as usize].id))
- .set(id_in_table.eq(id_in_table + dir))
- .execute(conn);
- if upd.is_err() {
- return upd;
- }
- }
- diesel::update(jrcolumns.find(clmnid))
- .set(id_in_table.eq(new_id_in_table))
- .execute(conn)
-}
-
-pub fn delete_column_relative(conn: &mut MysqlConnection, tblid: i32, idinclm: i32) -> Result {
- let clmid = get_clmid_relative(conn, tblid, idinclm);
- if clmid.is_err() {
- return Err(clmid.err().unwrap());
- }
- delete_column(conn, clmid.unwrap())
-}
-
-pub fn delete_column(conn: &mut MysqlConnection, clmnid: i32) -> Result {
- let tblid = jrcolumns
- .find(clmnid)
- .select(jrtable_id)
- .first::(conn);
-
- if tblid.is_err() {
- return Err(tblid.err().unwrap());
- }
- let tblid = tblid.unwrap();
-
- let ncols = jrcolumns
- .filter(jrtable_id.eq(tblid))
- .execute(conn);
-
- if ncols.is_err() {
- return ncols;
- }
- let ncols = ncols.unwrap() as i32;
-
- let mv = move_column(conn, clmnid, ncols);
-
- if mv.is_err() {
- return mv;
- }
-
- diesel::delete(jrcolumns.find(clmnid))
- .execute(conn)
-}
-
-pub fn get_clmns_of(conn: &mut MysqlConnection, tblid: i32) -> Result, diesel::result::Error> {
- jrcolumns
- .filter(jrtable_id.eq(tblid))
- .order(id_in_table.asc())
- .select(Jrcolumn::as_select())
- .load(conn)
-}
-
diff --git a/inventur_db/src/jrentries.rs b/inventur_db/src/jrentries.rs
index 2226fd6..ec44c91 100644
--- a/inventur_db/src/jrentries.rs
+++ b/inventur_db/src/jrentries.rs
@@ -1,3 +1,20 @@
+/* Simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use crate::models;
use crate::schema;
diff --git a/inventur_db/src/jrentries.rs~ b/inventur_db/src/jrentries.rs~
deleted file mode 100644
index 7404504..0000000
--- a/inventur_db/src/jrentries.rs~
+++ /dev/null
@@ -1,131 +0,0 @@
-use crate::models;
-use crate::schema;
-
-use schema::jrentries::dsl::{jrentries, id, jrtable_id, row_pos};
-use models::{ Jrentry, NewJrentry };
-
-use diesel::prelude::*;
-use diesel::mysql::MysqlConnection;
-
-
-pub fn create_jrentry(conn: &mut MysqlConnection, tblid: i32) -> Result {
- let rowpos = jrentries
- .filter(jrtable_id.eq(tblid))
- .select(row_pos)
- .load::(conn);
-
- if rowpos.is_err() {
- return Err(rowpos.err().unwrap());
- }
- let rowpos = rowpos.unwrap().len() + 1;
-
- let ntr = NewJrentry { jrtable_id: tblid, row_pos: rowpos as i32 };
- diesel::insert_into(crate::schema::jrentries::table)
- .values(ntr)
- .execute(conn)
-}
-
-pub fn move_jrentry(conn: &mut MysqlConnection, tblid: i32, rowpos: i32, newrowpos: i32) -> Result {
- let ntrids = jrentries
- .filter(jrtable_id.eq(tblid))
- .order(row_pos.asc())
- .select(id)
- .load::(conn);
-
- if ntrids.is_err() {
- return Err(ntrids.err().unwrap());
- }
- let ntrids = ntrids.unwrap();
-
- let a;
- let b;
- let dir;
- let entryid = ntrids[(rowpos-1) as usize];
- if rowpos < newrowpos {
- a = rowpos + 1;
- b = newrowpos;
- dir = -1;
- }else {
- a = newrowpos;
- b = rowpos - 1;
- dir = 1;
- }
-
- for i in a..=b {
- let upd = diesel::update(jrentries.find(ntrids[(i-1) as usize]))
- .set(row_pos.eq(row_pos + dir))
- .execute(conn);
- if upd.is_err() {
- return upd;
- }
- }
-
- diesel::update(jrentries.find(entryid))
- .set(row_pos.eq(newrowpos))
- .execute(conn)
-
-}
-
-pub fn delete_jrentry_relative(conn: &mut MysqlConnection, tblid: i32, rowpos: i32) -> Result {
- let entryid = jrentries
- .filter(jrtable_id.eq(tblid))
- .filter(row_pos.eq(rowpos))
- .select(id)
- .first::(conn);
- if entryid.is_err() {
- return Err(entryid.err().unwrap());
- }
- delete_jrentry(conn, entryid.unwrap())
-
-}
-
-pub fn delete_jrentry(conn: &mut MysqlConnection, entryid: i32) -> Result {
- let rp = jrentries
- .find(entryid)
- .select(row_pos)
- .first::(conn);
-
- let tblid = jrentries
- .find(entryid)
- .select(jrtable_id)
- .first::(conn);
-
- if rp.is_err() {
- return Err(tblid.err().unwrap());
- }
-
- if tblid.is_err() {
- return Err(tblid.err().unwrap());
- }
-
- let rp = rp.unwrap();
- let tblid = tblid.unwrap();
-
- let nr = jrentries
- .filter(jrtable_id.eq(tblid))
- .execute(conn);
-
- if nr.is_err() {
- return nr;
- }
- move_jrentry(conn, tblid, rp, nr.unwrap() as i32);
- diesel::delete(jrentries.find(entryid)).execute(conn)
-
-}
-
-pub fn get_jrentry_id(conn: &mut MysqlConnection, tblid: i32, rowpos: i32) -> Result {
-
- jrentries
- .filter(jrtable_id.eq(tblid))
- .filter(row_pos.eq(rowpos))
- .select(id)
- .first::(conn)
-
-}
-
-pub fn get_entries_of(conn: &mut MysqlConnection, tblid: i32) -> Result, diesel::result::Error> {
- jrentries
- .filter(jrtable_id.eq(tblid))
- .select(Jrentry::as_select())
- .load(conn)
-}
diff --git a/inventur_db/src/jrtables.rs b/inventur_db/src/jrtables.rs
index ae8c892..26897a7 100644
--- a/inventur_db/src/jrtables.rs
+++ b/inventur_db/src/jrtables.rs
@@ -1,3 +1,20 @@
+/* Simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use diesel::prelude::*;
use diesel::mysql::MysqlConnection;
use crate::models;
diff --git a/inventur_db/src/jrtables.rs~ b/inventur_db/src/jrtables.rs~
deleted file mode 100644
index f9f3b70..0000000
--- a/inventur_db/src/jrtables.rs~
+++ /dev/null
@@ -1,95 +0,0 @@
-use diesel::prelude::*;
-use diesel::mysql::MysqlConnection;
-use crate::models;
-use crate::schema;
-use crate::jrcolumns;
-use models::{ Jrtable, NewJrtable };
-use schema::jrtables::dsl::{ jrtables, id, name, owner_id };
-
-pub fn create_jrtable(conn: &mut MysqlConnection, tblname: &String, field_names: Vec, uid: i32) -> Result {
- let jrtable = NewJrtable { name: tblname.to_string(), owner_id: uid };
-
- let tbl = diesel::insert_into(crate::schema::jrtables::table)
- .values(&jrtable)
- .execute(conn);
-
- if tbl.is_err() {
- return Err(tbl.err().unwrap());
- }
- let tblid = jrtables
- .order(id.desc())
- .select(id)
- .first::(conn);
- if tblid.is_err() {
- return Err(tblid.err().unwrap());
- }
- let tblid = tblid.unwrap();
- let cols = jrcolumns::create_jrcolumns_empty_tbl(conn, tblid, field_names);
- if cols.is_err() {
- return Err(cols.err().unwrap());
- }
- Ok(tblid)
-
-}
-
-pub fn rename_jrtable(conn: &mut MysqlConnection, tblid: i32, new_name: &str) -> Result {
- diesel::update(jrtables.find(tblid))
- .set(name.eq(new_name))
- .execute(conn)
-}
-
-pub fn delete_jrtable(conn: &mut MysqlConnection, tblid: i32) -> Result {
- diesel::delete(jrtables.find(tblid))
- .execute(conn)
-}
-
-pub fn get_all_tables(conn: &mut MysqlConnection) -> Result, diesel::result::Error> {
- jrtables
- .select(Jrtable::as_select())
- .load(conn)
-}
-
-pub fn get_tbl(conn: &mut MysqlConnection, tblid: i32) -> Result {
- jrtables
- .find(tblid)
- .select(Jrtable::as_select())
- .first(conn)
-}
-
-pub fn get_ncols(conn: &mut MysqlConnection, tblid: i32) -> Result {
- use schema::jrcolumns::dsl::{ jrcolumns, jrtable_id };
-
- jrcolumns
- .filter(jrtable_id.eq(tblid))
- .execute(conn)
-}
-
-pub fn get_nrows(conn: &mut MysqlConnection, tblid: i32) -> Result {
- use schema::jrentries::dsl::{jrentries, jrtable_id};
-
- jrentries
- .filter(jrtable_id.eq(tblid))
- .execute(conn)
-}
-
-pub fn get_tblids_uid(conn: &mut MysqlConnection, uid: i32) -> Result, diesel::result::Error> {
- jrtables
- .filter(owner_id.eq(uid))
- .select(id)
- .load::(conn)
-}
-
-pub fn get_owner_id(conn: &mut MysqlConnection, tblid: i32) -> Result {
- jrtables
- .find(tblid)
- .select(owner_id)
- .first::(conn)
-}
-
-pub fn get_tbl_by_name_uid(conn: &mut MysqlConnection, tblname: &String, uid: i32) -> Result {
- jrtables
- .filter(owner_id.eq(uid))
- .filter(name.eq(tblname))
- .select(id)
- .first::(conn)
-}
diff --git a/inventur_db/src/lib.rs b/inventur_db/src/lib.rs
index 899e6eb..74dba12 100644
--- a/inventur_db/src/lib.rs
+++ b/inventur_db/src/lib.rs
@@ -1,4 +1,20 @@
-#![recursion_limit = "512"]
+/* Simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
//! Database API using the table style system provided by this crate
mod models;
mod schema;
diff --git a/inventur_db/src/lib.rs~ b/inventur_db/src/lib.rs~
deleted file mode 100644
index b7f35a4..0000000
--- a/inventur_db/src/lib.rs~
+++ /dev/null
@@ -1,314 +0,0 @@
-//! Database API using the table style system provided by this crate
-mod models;
-mod schema;
-mod jrtables;
-mod jrcolumns;
-mod jrentries;
-mod jrcells;
-mod users;
-
-use dotenvy::dotenv;
-use std::env;
-use diesel::mysql::MysqlConnection;
-use diesel::prelude::*;
-
-/// represents and summarised all relevant data of a table.
-/// Standard return type if whole tables should be returned
-pub struct Tbl {
- /// table id of the represented object
- pub tblid: i32,
- pub name: String,
- pub column_names: Vec,
- pub rows: Vec,
-}
-
-/// Represents a table's row.
-/// Internal data structure is abstracted until strings.
-pub struct TRow {
- pub row_pos: i32,
- pub cells: Vec,
-}
-
-/// Identifies a user
-/// All fields are unique within the db at any given point.
-pub struct User {
- /// User's unique id.
- pub uid: i32,
- pub uname: String,
- pub email: String,
-}
-
-/// Connect to database.
-/// Return value must be passed to most of the crate's functions.
-pub fn establish_connection() -> MysqlConnection {
- dotenv().ok();
- let db_url = env::var("DATABASE_URL").expect("No database url set.");
- MysqlConnection::establish(&db_url)
- .unwrap_or_else(|_| panic!("Couldn't open database."))
-}
-
-/// Fetch one whole table from the database. Identified by it's ID.
-/// Needs the id of the requesting user.
-/// Returns:
-/// A Tbl struct
-/// Or:
-/// None
-/// if the table was not found or
-/// if it could not be read or
-/// if the requesting user is not the table's owner or
-/// if there has been another error
-///
-pub fn get_table(conn: &mut MysqlConnection, tblid: i32, uid: i32) -> Option {
- let tbl = jrtables::get_tbl(conn, tblid);
- if tbl.is_err() {
- return None;
- }
- let tbl = tbl.unwrap();
- if tbl.owner_id != uid {
- return None;
- }
- let clmns = jrcolumns::get_clmns_of(conn, tblid);
- if clmns.is_err() {
- return None;
- }
- let clmns = clmns.unwrap();
- let mut clmn_nms = Vec::new();
- for clmn in &clmns {
- clmn_nms.push(clmn.name.clone());
- }
- let clmn_nms = clmn_nms;
- let mut clmn_ids = Vec::new();
- for clmn in clmns {
- clmn_ids.push(clmn.id);
- }
- let clmn_ids = clmn_ids;
- let rowids = jrentries::get_entries_of(conn, tblid);
- if rowids.is_err() {
- return None;
- }
- let rowids = rowids.unwrap();
- let mut rows = Vec::new();
- for rowid in rowids {
- let row = jrcells::get_entry_cells(conn, rowid.id);
- if row.is_err() {
- return None;
- }
- let row = row.unwrap();
- let mut data = Vec::new();
- for cell in row {
- data.push(cell.cell_value);
- }
- let data = data;
- rows.push(TRow { row_pos: rowid.row_pos, cells: data });
- }
- Some(Tbl { tblid: tbl.id, name: tbl.name, column_names: clmn_nms, rows: rows })
-}
-
-pub fn get_tblnames(conn: &mut MysqlConnection, tblids: Vec) -> Option> {
- let mut tblnames = Vec::new();
- for tblid in tblids {
- let tblname = jrtables::get_tbl(conn, tblid);
- if tblname.is_err() {
- return None;
- }
- tblnames.push(tblname.unwrap().name);
- }
- Some(tblnames)
-}
-
-/// Returns a Vec of the ids of a user's table if the user exists, else None.
-/// User is identified by its user ID.
-pub fn get_user_tblids(conn: &mut MysqlConnection, uid: i32) -> Option> {
- let tblids = jrtables::get_tblids_uid(conn, uid);
- if tblids.is_err() {
- return None;
- }
- Some(tblids.unwrap())
-}
-
-/// Change the name of a table.
-/// Needs the user ID of the requesting user.
-/// Returns Some(true) if the action seems to have been successful and the requesting user is the
-/// table's owner.
-/// None otherwise.
-pub fn rename_table(conn: &mut MysqlConnection, tblid: i32, new_name: String, uid: i32) -> Option {
- let owner = jrtables::get_owner_id(conn, tblid);
- if owner.is_err() || owner.unwrap() != uid {
- return None;
- }
- let rnm = jrtables::rename_jrtable(conn, tblid, &new_name);
- if rnm.is_err() {
- return None;
- }
- Some(true)
-}
-
-
-/// Delete a table.
-/// Needs the user ID of the requesting user.
-/// Returns Some(true) if the action seems to have been successful and the requesting user is the
-/// table's owner.
-/// None otherwise.
-pub fn delete_table(conn: &mut MysqlConnection, tblid: i32, uid: i32) -> Option {
- let owner = jrtables::get_owner_id(conn, tblid);
- if owner.is_err() || owner.unwrap() != uid {
- return None;
- }
- let dlt = jrtables::delete_jrtable(conn, tblid);
- if dlt.is_err() {
- return None;
- }
- Some(true)
-}
-
-
-/// Create a new table.
-/// Needs the user ID of the requesting user.
-/// Returns the id of the newly created table if the action seems to have been successful and the requesting user is the
-/// table's owner.
-/// None otherwise.
-pub fn create_table(conn: &mut MysqlConnection, name: String, field_names: Vec, uid: i32) -> Option {
- if jrtables::get_tbl_by_name_uid(conn, &name, uid).is_ok() {
- return None;
- }
- if jrtables::create_jrtable(conn, &name, field_names, uid).is_err() {
- return None;
- }
- let tblid = jrtables::get_tbl_by_name_uid(conn, &name, uid);
- if tblid.is_err() {
- return None;
- }
- Some(tblid.unwrap())
-}
-
-/// Returns a User struct of a requested user if the combination of username and email are
-/// consistent or both do not exist yet, in which case the user is newly created.
-pub fn register_or_login(conn: &mut MysqlConnection, uname: String, mail: String) -> Option {
- let mut uid = users::get_uid_email(conn, &mail);
- if uid.is_err() {
- if users::get_uid_uname(conn, &uname).is_ok() || users::create_user(conn, &uname, &mail).is_err() {
- return None;
- }
- uid = users::get_uid_email(conn, &mail);
- if uid.is_err() {
- return None;
- }
- }
- let uid = uid.unwrap();
- let nm = users::get_uname(conn, uid);
- if nm.is_err() || nm.unwrap() != uname {
- return None;
- }
- Some(User { uid: uid, uname: uname, email: mail })
-}
-
-pub fn delete_user(conn: &mut MysqlConnection, uid: i32) -> Option {
- if users::delete_user(conn, uid).is_err() {
- return None;
- }
- Some(true)
-}
-
-pub fn add_row(conn: &mut MysqlConnection, tblid: i32, values: Vec, uid: i32) -> Option {
- let owner = jrtables::get_owner_id(conn, tblid);
- let nrows = jrtables::get_nrows(conn, tblid);
- if nrows.is_err() || owner.is_err() || owner.unwrap() != uid {
- return None;
- }
- let nrows = nrows.unwrap() as i32;
- if jrentries::create_jrentry(conn, tblid).is_err() {
- return None;
- }
- let entryid = jrentries::get_jrentry_id(conn, tblid, nrows+1);
- if entryid.is_err() {
- return None;
- }
- let entryid = entryid.unwrap();
- let cols = jrcolumns::get_clmns_of(conn, tblid);
- if cols.is_err() {
- return None;
- }
- let cols = cols.unwrap();
- for (i,col) in cols.iter().enumerate() {
- if jrcells::create_jrcell(conn, entryid, col.id, &values[i]).is_err() {
- return None;
- }
- }
- Some(entryid)
-}
-
-pub fn delete_row(conn: &mut MysqlConnection, tblid: i32, row_pos: i32, uid: i32) -> Option {
- let owner = jrtables::get_owner_id(conn, tblid);
- if owner.is_err() || owner.unwrap() != uid || jrentries::delete_jrentry_relative(conn, tblid, row_pos).is_err() {
- return None;
- }
- Some(true)
-}
-
-pub fn move_row(conn: &mut MysqlConnection, tblid: i32, rowpos: i32, newpos: i32, uid: i32) -> Option {
- let owner = jrtables::get_owner_id(conn, tblid);
- if owner.is_err() || owner.unwrap() != uid || jrentries::move_jrentry(conn, tblid, rowpos, newpos).is_err() {
- return None;
- }
- Some(true)
-}
-
-
-pub fn edit_cell(conn: &mut MysqlConnection, tblid: i32, row_pos: i32, column_pos: i32, new_value: String, uid: i32) -> Option {
- let owner = jrtables::get_owner_id(conn, tblid);
- if owner.is_err() ||
- owner.unwrap() != uid ||
- jrcells::change_jrcell_value_relative(conn, tblid, row_pos, column_pos, new_value).is_err()
- {
- return None;
- }
- Some(true)
-}
-
-pub fn move_column(conn: &mut MysqlConnection, tblid:i32, column_pos: i32, new_column_pos: i32, uid: i32) -> Option {
- let owner = jrtables::get_owner_id(conn, tblid);
- if owner.is_err() ||
- owner.unwrap() != uid ||
- jrcolumns::move_column_relative(conn, tblid, column_pos, new_column_pos).is_err()
- {
- return None;
- }
- Some(true)
-}
-
-pub fn add_column(conn: &mut MysqlConnection, tblid: i32, name: String, uid: i32) -> Option {
- let owner = jrtables::get_owner_id(conn, tblid);
- if owner.is_err() ||
- owner.unwrap() != uid ||
- jrcolumns::create_jrcolumn(conn, tblid, name).is_err()
- {
- return None;
- }
- let clmid = jrcolumns::get_last_column_id_of(conn, tblid);
- if clmid.is_err() {
- return None;
- }
- Some(clmid.unwrap())
-}
-
-pub fn delete_column(conn: &mut MysqlConnection, tblid: i32, column_pos: i32, uid: i32) -> Option {
- let owner = jrtables::get_owner_id(conn, tblid);
- if owner.is_err() ||
- owner.unwrap() != uid ||
- jrcolumns::delete_column_relative(conn, tblid, column_pos).is_err()
- {
- return None;
- }
- Some(true)
-}
-
-pub fn rename_column(conn: &mut MysqlConnection, tblid: i32, column_pos: i32, new_name: String, uid: i32) -> Option {
- let owner = jrtables::get_owner_id(conn, tblid);
- if owner.is_err() ||
- owner.unwrap() != uid ||
- jrcolumns::rename_column_relative(conn, tblid, column_pos, new_name).is_err()
- {
- return None;
- }
- Some(true)
-}
diff --git a/inventur_db/src/models.rs b/inventur_db/src/models.rs
index e64ead6..8928326 100644
--- a/inventur_db/src/models.rs
+++ b/inventur_db/src/models.rs
@@ -1,3 +1,20 @@
+/* Simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use diesel::prelude::*;
use crate::schema::{jrtables, jrcolumns, jrentries, jrcells, users};
diff --git a/inventur_db/src/models.rs~ b/inventur_db/src/models.rs~
deleted file mode 100644
index c90e59b..0000000
--- a/inventur_db/src/models.rs~
+++ /dev/null
@@ -1,97 +0,0 @@
-use diesel::prelude::*;
-use crate::schema::{jrtables, jrcolumns, jrentries, jrcells, users};
-
-#[derive(Queryable, Selectable, Identifiable, Associations)]
-#[diesel(table_name = crate::schema::jrtables)]
-#[diesel(belongs_to(User, foreign_key = owner_id))]
-#[diesel(check_for_backend(diesel::mysql::Mysql))]
-pub struct Jrtable {
- pub id: i32,
- pub name: String,
- pub owner_id: i32,
-}
-
-#[derive(Insertable)]
-#[diesel(table_name = jrtables)]
-#[diesel(check_for_backend(diesel::mysql::Mysql))]
-pub struct NewJrtable {
- pub name: String,
- pub owner_id: i32,
-}
-
-#[derive(Queryable, Selectable, Identifiable, Associations)]
-#[diesel(table_name = jrcolumns)]
-#[diesel(belongs_to(Jrtable))]
-#[diesel(check_for_backend(diesel::mysql::Mysql))]
-pub struct Jrcolumn {
- pub id: i32,
- pub name: String,
- pub jrtable_id: i32,
- pub id_in_table: i32,
-}
-
-#[derive(Insertable)]
-#[diesel(table_name = jrcolumns)]
-#[diesel(check_for_backend(diesel::mysql::Mysql))]
-pub struct NewJrcolumn {
- pub name: String,
- pub jrtable_id: i32,
- pub id_in_table: i32,
-}
-
-#[derive(Queryable, Selectable, Identifiable, Associations)]
-#[diesel(table_name = jrentries)]
-#[diesel(belongs_to(Jrtable))]
-#[diesel(check_for_backend(diesel::mysql::Mysql))]
-pub struct Jrentry {
- pub id: i32,
- pub row_pos: i32,
- pub jrtable_id: i32,
-}
-
-#[derive(Insertable)]
-#[diesel(table_name = jrentries)]
-#[diesel(check_for_backend(diesel::mysql::Mysql))]
-pub struct NewJrentry {
- pub row_pos: i32,
- pub jrtable_id: i32,
-}
-
-#[derive(Queryable, Selectable, Identifiable, Associations)]
-#[diesel(table_name = jrcells)]
-#[diesel(belongs_to(Jrentry))]
-#[diesel(belongs_to(Jrcolumn))]
-#[diesel(check_for_backend(diesel::mysql::Mysql))]
-pub struct Jrcell {
- pub id: i32,
- pub cell_value: String,
- pub jrentry_id: i32,
- pub jrcolumn_id: i32,
-}
-
-#[derive(Insertable)]
-#[diesel(table_name = jrcells)]
-#[diesel(check_for_backend(diesel::mysql::Mysql))]
-pub struct NewJrcell {
- pub cell_value: String,
- pub jrentry_id: i32,
- pub jrcolumn_id: i32,
-}
-
-#[derive(Queryable, Selectable, Identifiable)]
-#[diesel(table_name = users)]
-#[diesel(check_for_backend(diesel::mysql::Mysql))]
-pub struct User {
- pub id: i32,
- pub username: String,
- pub email: String,
-}
-
-#[derive(Insertable)]
-#[diesel(table_name = users)]
-#[diesel(check_for_backend(diesel::mysql::Mysql))]
-pub struct NewUser {
- pub username: String,
- pub email: String,
-}
-
diff --git a/inventur_db/src/schema.rs b/inventur_db/src/schema.rs
index 4596166..ce9d7f3 100644
--- a/inventur_db/src/schema.rs
+++ b/inventur_db/src/schema.rs
@@ -1,3 +1,20 @@
+/* Simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
// @generated automatically by Diesel CLI.
diesel::table! {
diff --git a/inventur_db/src/users.rs b/inventur_db/src/users.rs
index a6b9514..373c211 100644
--- a/inventur_db/src/users.rs
+++ b/inventur_db/src/users.rs
@@ -1,3 +1,21 @@
+/* This file is part of inventur.
+ * inventur is a simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use crate::models;
use crate::schema;
diff --git a/inventur_db/src/users.rs~ b/inventur_db/src/users.rs~
deleted file mode 100644
index 4d25808..0000000
--- a/inventur_db/src/users.rs~
+++ /dev/null
@@ -1,56 +0,0 @@
-use crate::models;
-use crate::schema;
-
-use schema::users::dsl::{users, id, username, email};
-use models::NewUser;
-
-use diesel::prelude::*;
-use diesel::mysql::MysqlConnection;
-
-pub fn create_user(conn: &mut MysqlConnection, uname: String, mail: String) -> Result {
- let user = NewUser { username: uname, email: mail};
- diesel::insert_into(crate::schema::users::table)
- .values(&user)
- .execute(conn)
-}
-
-pub fn delete_user(conn: &mut MysqlConnection, uid: i32) -> Result {
- diesel::delete(users.find(uid))
- .execute(conn)
-}
-
-pub fn get_uid_email(conn: &mut MysqlConnection, mail: String) -> Result {
- users
- .filter(email.eq(mail))
- .select(id)
- .first::(conn)
-}
-
-pub fn get_uid_uname(conn: &mut MysqlConnection, uname: String) -> Result {
- users
- .filter(username.eq(uname))
- .select(id)
- .first::(conn)
-}
-
-pub fn get_uname(conn: &mut MysqlConnection, uid: i32) -> Result {
- users
- .find(uid)
- .select(username)
- .first::(conn)
-}
-
-pub fn get_email(conn: &mut MysqlConnection, uid: i32) -> Result {
- users
- .find(uid)
- .select(email)
- .first::(conn)
-}
-
-pub fn get_user_tables(conn: &mut MysqlConnection, uid: i32) -> Result, diesel::result::Error> {
- use schema::jrtables::dsl::{jrtables, id as tblid, owner_id};
- jrtables
- .filter(owner_id.eq(uid))
- .select(tblid)
- .load::(conn)
-}
diff --git a/src/auth.rs b/src/auth.rs
index 30d26fe..ab5a5d9 100644
--- a/src/auth.rs
+++ b/src/auth.rs
@@ -1,3 +1,20 @@
+/* Simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use crate::Db;
use rocket::response::Redirect;
diff --git a/src/auth.rs~ b/src/auth.rs~
deleted file mode 100644
index e69de29..0000000
diff --git a/src/main.rs b/src/main.rs
index d5bdda3..a293de2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,10 +1,26 @@
+/* Simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
#[macro_use] extern crate rocket;
mod auth;
mod table;
use auth::AuthUser;
-// TODO: filter (ajax, spinning circle), show options as in excel
use rocket::fs::{FileServer, relative};
use rocket_dyn_templates::{Template, context};
use rocket::request;
diff --git a/src/schema.rs b/src/schema.rs
deleted file mode 100644
index 88b70c6..0000000
--- a/src/schema.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-// @generated automatically by Diesel CLI.
-
-diesel::table! {
- jrtables (id) {
- id -> Integer,
- #[max_length = 255]
- name -> Varchar,
- num_fields -> Integer,
- }
-}
diff --git a/src/table.rs b/src/table.rs
index 5356040..87bd913 100644
--- a/src/table.rs
+++ b/src/table.rs
@@ -1,3 +1,20 @@
+/* Simple web app using rocket to help maintain inventory data.
+ * Copyright (C) 2024 Johannes Randerath
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
use crate::auth;
use auth::AuthUser;
diff --git a/src/table.rs~ b/src/table.rs~
deleted file mode 100644
index 72156c0..0000000
--- a/src/table.rs~
+++ /dev/null
@@ -1,120 +0,0 @@
-
-#[get("/")]
-async fn table(conn: Db, tid: i32, user: AuthUser) -> Option {
- let uid = user.uid;
- let table = conn.run(move |c| inventur_db::get_table(c, tid, uid)).await;
- if table.is_none() {
- return None;
- }
- let table = table.unwrap();
- let tname = table.name;
- let columns = table.column_names;
- let trows = table.rows;
- let mut rows = Vec::new();
- for trow in trows {
- rows.push(trow.cells);
- let index = rows.len()-1;
- rows[index].insert(0, trow.row_pos.to_string());
- }
- let rows = rows;
- let mut tids = conn.run(move |c| inventur_db::get_user_tblids(c, uid)).await;
- let tnames;
- if tids.is_none() {
- tids = Some(Vec::new());
- tnames = Some(Vec::new());
- }else {
- let tids = tids.clone().unwrap();
- tnames = conn.run(move |c| inventur_db::get_tblnames(c, tids)).await;
- }
- let tids = tids.unwrap();
- if tnames.is_none() {
- return None;
- }
- Some(
- Template::render("table",
- context!{
- sort_field: 0,
- sort_dir: 0,
- tblid: tid,
- tblname: tname,
- tids: tids,
- tnames: tnames,
- columns: columns,
- rows: rows,
- }
- )
- )
-}
-
-#[derive(FromForm)]
-struct NewEntry {
- tblid: i32,
- cells: Vec,
-}
-
-#[post("/new", data="")]
-async fn new_entry(conn: Db, data: Form, user: AuthUser) -> Result {
- let uid = user.uid;
- let cells = data.cells.clone();
- let tblid = data.tblid;
- if conn.run(move |c| inventur_db::add_row(c, data.tblid, cells, uid)).await.is_none() {
- return Err(Status::Forbidden);
- }
- Ok(Redirect::to(uri!("/table", table(tblid))))
-}
-
-#[derive(FromForm)]
-struct EditTname {
- tblid: i32,
- new_name: String,
-}
-
-#[post("/name/edit", data="")]
-async fn edit_tname(conn: Db, data: Form, user: AuthUser) -> Result {
- let uid = user.uid;
- let tblid = data.tblid;
- if conn.run(move |c| inventur_db::rename_table(c, data.tblid, data.new_name.clone(), uid)).await.is_none() {
- return Err(Status::Forbidden);
- }
- Ok(Redirect::to(uri!("/table", table(tblid))))
-}
-
-#[derive(FromForm)]
-struct NewTable {
- name: String,
- fields: Vec,
-}
-
-#[post("/create", data="")]
-async fn create(conn: Db, data: Form, user: AuthUser) -> Result {
- let uid = user.uid;
- let tblid = conn.run(move |c| inventur_db::create_table(c, data.name.clone(), data.fields.clone(), uid)).await;
- if tblid.is_none() {
- return Err(Status::Forbidden);
- }
- Ok(Redirect::to(uri!("/table", table(tblid.unwrap()))))
-}
-
-#[derive(Deserialize)]
-#[serde(crate = "rocket::serde")]
-struct ImportTable {
- name: String,
- columns: Vec,
- rows: Vec>,
-}
-
-#[post("/import", data="")]
-pub async fn import_table(conn: Db, data: Json, user: AuthUser) -> Result {
- let uid = user.uid;
- let columns = data.columns.clone();
- let rows = data.rows.clone();
- let tblid = conn.run(move |c| inventur_db::create_table(c, data.name.clone(), columns, uid)).await;
- if tblid.is_none() {
- return Err(Status::UnprocessableEntity);
- }
- let tblid = tblid.unwrap();
- for row in rows {
- conn.run(move |c| inventur_db::add_row(c, tblid, row, uid)).await;
- }
- Ok(Redirect::to(uri!("/table", table(tblid))))
-}
diff --git a/templates/base.html.tera b/templates/base.html.tera
index 0b79471..83c801b 100644
--- a/templates/base.html.tera
+++ b/templates/base.html.tera
@@ -1,14 +1,23 @@
{# vim: set filetype=html :#}
-
+
diff --git a/templates/home.html.tera b/templates/home.html.tera
index d3223ae..a0d8d9e 100644
--- a/templates/home.html.tera
+++ b/templates/home.html.tera
@@ -1,4 +1,22 @@
{# vim: set filetype=html: #}
+
+
{% extends "base" %}
{% block body %}