diff --git a/package.json b/package.json
index b4ce23a..77f843b 100644
--- a/package.json
+++ b/package.json
@@ -2,13 +2,13 @@
"name": "uni-backend",
"version": "1.0.0",
"description": "Our backend",
- "main": "index.js",
+ "main": "src/index.js",
"watch": {
- "run": ["{routes}/*.js", "*.js"]
+ "run": ["src/{routes}/*.js", "src/*.js"]
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
- "run": "node index.js",
+ "run": "node src/index.js",
"watch": "npm-watch"
},
"author": "",
diff --git a/dependencies.js b/src/dependencies.js
similarity index 100%
rename from dependencies.js
rename to src/dependencies.js
diff --git a/index.js b/src/index.js
similarity index 89%
rename from index.js
rename to src/index.js
index 9cecac2..f73828a 100644
--- a/index.js
+++ b/src/index.js
@@ -3,13 +3,14 @@ const OpenApiValidator = require("express-openapi-validator");
const app = express();
const port = 3000;
const cors = require("cors")
+const path = require("path")
//// Swagger
const swaggerUi = require("swagger-ui-express");
const YAML = require("yaml");
const fs = require("fs");
-const file = fs.readFileSync("./open_api.yaml", "utf8");
+const file = fs.readFileSync(path.join(__dirname, "../open_api.yaml"), "utf8");
const swaggerDocument = YAML.parse(file);
// Serve the swagger ui
@@ -41,7 +42,7 @@ app.use((err, req, res, next) => {
app.use(express.json());
app.use(express.urlencoded({ extended: true }))
-app.use( express.static( __dirname + '/frontend'))
+app.use( express.static( path.join(__dirname, '../frontend')))
const accountsRoute = require("./routes/accounts");
diff --git a/routes/accounts.js b/src/routes/accounts.js
similarity index 100%
rename from routes/accounts.js
rename to src/routes/accounts.js
diff --git a/routes/reset.js b/src/routes/reset.js
similarity index 100%
rename from routes/reset.js
rename to src/routes/reset.js
diff --git a/routes/transactions.js b/src/routes/transactions.js
similarity index 100%
rename from routes/transactions.js
rename to src/routes/transactions.js
diff --git a/sse.js b/src/sse.js
similarity index 100%
rename from sse.js
rename to src/sse.js
diff --git a/test/Swagger UI.html b/test/Swagger UI.html
deleted file mode 100644
index 876b33f..0000000
--- a/test/Swagger UI.html
+++ /dev/null
@@ -1,286 +0,0 @@
-
-
-
-
-
-
- Swagger UI
-
-
-
-
-
-
-
-
-
-ServersComputed URL:../api/v1
Server variables
-
-normal
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/test/accounts.json b/test/accounts.json
deleted file mode 100644
index fdd8d7a..0000000
--- a/test/accounts.json
+++ /dev/null
@@ -1,301 +0,0 @@
-[
- {
- "number": 1000,
- "name": "Aktiva",
- "qualifiedName": "Aktiva",
- "type": "meta",
- "balance": 7986.16,
- "localBalance": 0,
- "description": "Meta-Konto für das Vermögen",
- "subaccounts": [
- {
- "number": 1100,
- "name": "Barvermögen",
- "qualifiedName": "Aktiva:Barvermögen",
- "type": "meta",
- "balance": 7986.16,
- "localBalance": 0,
- "subaccounts": [
- {
- "number": 1110,
- "name": "Bargeld",
- "qualifiedName": "Aktiva:Barvermögen:Bargeld",
- "type": "default",
- "balance": -11581,
- "localBalance": -11581,
- "subaccounts": []
- },
- {
- "number": 1120,
- "name": "Girokonto",
- "qualifiedName": "Aktiva:Barvermögen:Girokonto",
- "type": "default",
- "balance": 14712.16,
- "localBalance": 14712.16,
- "subaccounts": [
- {
- "number": 123,
- "name": "123",
- "qualifiedName": "Aktiva:Barvermögen:Girokonto:123",
- "type": "default",
- "balance": 0,
- "localBalance": 0,
- "description": "test",
- "subaccounts": [
- {
- "number": 1111,
- "name": "Test",
- "qualifiedName": "Aktiva:Barvermögen:Girokonto:123:Test",
- "type": "default",
- "balance": 0,
- "localBalance": 0,
- "description": "Test",
- "subaccounts": []
- }
- ]
- }
- ]
- },
- {
- "number": 1130,
- "name": "Sparkonto",
- "qualifiedName": "Aktiva:Barvermögen:Sparkonto",
- "type": "default",
- "balance": 3733,
- "localBalance": 3733,
- "subaccounts": [
- {
- "number": 12345,
- "name": "Test SSE",
- "qualifiedName": "Aktiva:Barvermögen:Sparkonto:Test SSE",
- "type": "default",
- "balance": 0,
- "localBalance": 0,
- "description": "TEST SSE",
- "subaccounts": []
- }
- ]
- },
- {
- "number": 187420,
- "name": "Uiiih",
- "qualifiedName": "Aktiva:Barvermögen:Uiiih",
- "type": "default",
- "balance": 1122,
- "localBalance": 1122,
- "description": "Memooooo",
- "subaccounts": []
- }
- ]
- }
- ]
- },
- {
- "number": 4000,
- "name": "Erträge",
- "qualifiedName": "Erträge",
- "type": "meta",
- "balance": -7090.64,
- "localBalance": 0,
- "description": "Meta-Konto für alle Einnahmen",
- "subaccounts": [
- {
- "number": 4100,
- "name": "Gehalt",
- "qualifiedName": "Erträge:Gehalt",
- "type": "default",
- "balance": -5458.64,
- "localBalance": -5458.64,
- "subaccounts": []
- },
- {
- "number": 4200,
- "name": "Kindergeld",
- "qualifiedName": "Erträge:Kindergeld",
- "type": "default",
- "balance": -1000,
- "localBalance": -1000,
- "subaccounts": []
- },
- {
- "number": 4300,
- "name": "BAföG",
- "qualifiedName": "Erträge:BAföG",
- "type": "default",
- "balance": 0,
- "localBalance": 0,
- "subaccounts": [
- {
- "number": 1236,
- "name": "Test Konto 3",
- "qualifiedName": "Erträge:BAföG:Test Konto 3",
- "type": "meta",
- "balance": 0,
- "localBalance": 0,
- "description": "Test Konto 2 Beschreibung",
- "subaccounts": []
- }
- ]
- },
- {
- "number": 4400,
- "name": "Stipendium",
- "qualifiedName": "Erträge:Stipendium",
- "type": "default",
- "balance": 0,
- "localBalance": 0,
- "subaccounts": []
- },
- {
- "number": 4500,
- "name": "Unterhalt",
- "qualifiedName": "Erträge:Unterhalt",
- "type": "default",
- "balance": -600,
- "localBalance": -600,
- "subaccounts": []
- },
- {
- "number": 4800,
- "name": "Zinsen",
- "qualifiedName": "Erträge:Zinsen",
- "type": "default",
- "balance": -32,
- "localBalance": -32,
- "subaccounts": []
- },
- {
- "number": 4900,
- "name": "Sonstiges",
- "qualifiedName": "Erträge:Sonstiges",
- "type": "default",
- "balance": 0,
- "localBalance": 0,
- "subaccounts": []
- }
- ]
- },
- {
- "number": 6000,
- "name": "Aufwendungen",
- "qualifiedName": "Aufwendungen",
- "type": "meta",
- "balance": 3598.6,
- "localBalance": 0,
- "description": "Meta-Konto für alle Ausgaben",
- "subaccounts": [
- {
- "number": 6100,
- "name": "Miete",
- "qualifiedName": "Aufwendungen:Miete",
- "type": "meta",
- "balance": 2240,
- "localBalance": 0,
- "subaccounts": [
- {
- "number": 6110,
- "name": "Kaltmiete",
- "qualifiedName": "Aufwendungen:Miete:Kaltmiete",
- "type": "default",
- "balance": 1920,
- "localBalance": 1920,
- "subaccounts": []
- },
- {
- "number": 6120,
- "name": "Nebenkosten",
- "qualifiedName": "Aufwendungen:Miete:Nebenkosten",
- "type": "default",
- "balance": 320,
- "localBalance": 320,
- "subaccounts": []
- }
- ]
- },
- {
- "number": 6200,
- "name": "Telekommunikation",
- "qualifiedName": "Aufwendungen:Telekommunikation",
- "type": "meta",
- "balance": 219.6,
- "localBalance": 0,
- "subaccounts": [
- {
- "number": 6210,
- "name": "Festnetz",
- "qualifiedName": "Aufwendungen:Telekommunikation:Festnetz",
- "type": "default",
- "balance": 139.8,
- "localBalance": 139.8,
- "subaccounts": []
- },
- {
- "number": 6220,
- "name": "Mobilfunk",
- "qualifiedName": "Aufwendungen:Telekommunikation:Mobilfunk",
- "type": "default",
- "balance": 79.8,
- "localBalance": 79.8,
- "subaccounts": []
- }
- ]
- },
- {
- "number": 6300,
- "name": "Semesterbeitrag",
- "qualifiedName": "Aufwendungen:Semesterbeitrag",
- "type": "default",
- "balance": 246,
- "localBalance": 246,
- "subaccounts": []
- },
- {
- "number": 6400,
- "name": "Lebensmittel",
- "qualifiedName": "Aufwendungen:Lebensmittel",
- "type": "default",
- "balance": 624,
- "localBalance": 624,
- "subaccounts": []
- },
- {
- "number": 6500,
- "name": "Mitgliedschaften",
- "qualifiedName": "Aufwendungen:Mitgliedschaften",
- "type": "default",
- "balance": 79,
- "localBalance": 79,
- "subaccounts": []
- },
- {
- "number": 6900,
- "name": "Sonstiges",
- "qualifiedName": "Aufwendungen:Sonstiges",
- "type": "default",
- "balance": 190,
- "localBalance": 190,
- "subaccounts": []
- },
- {
- "number": 9999,
- "name": "Testkonto",
- "qualifiedName": "Aufwendungen:Testkonto",
- "type": "default",
- "balance": 0,
- "localBalance": 0,
- "description": "Moin",
- "subaccounts": []
- }
- ]
- },
- {
- "number": 9000,
- "name": "Anfangsbestand",
- "qualifiedName": "Anfangsbestand",
- "type": "default",
- "balance": -4494.12,
- "localBalance": -4494.12,
- "description": "Konto für Anfangsbestand zum 01.11.2023",
- "subaccounts": []
- }
-]
diff --git a/test/create_account.hurl b/test/create_account.hurl
deleted file mode 100644
index 2629b1b..0000000
--- a/test/create_account.hurl
+++ /dev/null
@@ -1,2 +0,0 @@
-POST http://localhost:3000/api/v1/accounts/
-{"number":2000,"name":"Meintest","description":"Hallo","type":"default","parentAccount":"Aktiva"}
diff --git a/test/transaction_6.json b/test/transaction_6.json
deleted file mode 100644
index 09cbf67..0000000
--- a/test/transaction_6.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "postingDate": "2024-01-29",
- "valueDate": "2024-01-30",
- "title": "Gehalt 01/24",
- "entries": [
- {
- "account": "Aktiva:Barvermögen:Girokonto",
- "amount": 1214.66
- },
- {
- "account": "Erträge:Gehalt",
- "amount": -1214.66
- }
- ]
-}
diff --git a/test/transactions.json b/test/transactions.json
deleted file mode 100644
index 843d850..0000000
--- a/test/transactions.json
+++ /dev/null
@@ -1,332 +0,0 @@
-[
- {
- "id": 1,
- "postingDate": "2023-10-31",
- "valueDate": "2023-10-31",
- "title": "Anfangsbestand zum 01.11.2023"
- },
- {
- "id": 2,
- "postingDate": "2023-12-06",
- "valueDate": "2023-12-07",
- "title": "Semesterbeitrag SoSe 2024"
- },
- {
- "id": 3,
- "postingDate": "2023-11-20",
- "valueDate": "2023-11-20",
- "title": "Weihnachtsgeld"
- },
- {
- "id": 4,
- "postingDate": "2023-11-30",
- "valueDate": "2023-11-30",
- "title": "Gehalt 11/23"
- },
- {
- "id": 5,
- "postingDate": "2023-12-29",
- "valueDate": "2023-12-29",
- "title": "Gehalt 12/23"
- },
- {
- "id": 6,
- "postingDate": "2024-01-29",
- "valueDate": "2024-01-30",
- "title": "Gehalt 01/24"
- },
- {
- "id": 7,
- "postingDate": "2024-02-26",
- "valueDate": "2024-02-27",
- "title": "Gehalt 02/24"
- },
- {
- "id": 8,
- "postingDate": "2023-11-15",
- "valueDate": "2023-11-15",
- "title": "Kindergeld 11/23"
- },
- {
- "id": 9,
- "postingDate": "2023-12-15",
- "valueDate": "2023-12-15",
- "title": "Kindergeld 12/23"
- },
- {
- "id": 10,
- "postingDate": "2024-01-15",
- "valueDate": "2024-01-15",
- "title": "Kindergeld 01/24"
- },
- {
- "id": 11,
- "postingDate": "2024-02-15",
- "valueDate": "2024-02-15",
- "title": "Kindergeld 02/24"
- },
- {
- "id": 12,
- "postingDate": "2023-11-15",
- "valueDate": "2023-11-15",
- "title": "Unterhalt 11/23"
- },
- {
- "id": 13,
- "postingDate": "2023-12-15",
- "valueDate": "2023-12-15",
- "title": "Unterhalt 12/23"
- },
- {
- "id": 14,
- "postingDate": "2024-01-15",
- "valueDate": "2024-01-15",
- "title": "Unterhalt 01/24"
- },
- {
- "id": 15,
- "postingDate": "2024-02-15",
- "valueDate": "2024-02-15",
- "title": "Unterhalt 02/24"
- },
- {
- "id": 16,
- "postingDate": "2023-11-03",
- "valueDate": "2023-11-03",
- "title": "Miete 11/23"
- },
- {
- "id": 17,
- "postingDate": "2023-12-03",
- "valueDate": "2023-12-03",
- "title": "Miete 12/23"
- },
- {
- "id": 18,
- "postingDate": "2024-01-01",
- "valueDate": "2024-01-01",
- "title": "Miete 01/24"
- },
- {
- "id": 19,
- "postingDate": "2024-02-02",
- "valueDate": "2024-02-02",
- "title": "Miete 02/24"
- },
- {
- "id": 20,
- "postingDate": "2023-11-15",
- "valueDate": "2023-11-15",
- "title": "Festnetz-Rechnung 11/23"
- },
- {
- "id": 21,
- "postingDate": "2023-12-15",
- "valueDate": "2023-12-15",
- "title": "Festnetz-Rechnung 12/23"
- },
- {
- "id": 22,
- "postingDate": "2024-01-15",
- "valueDate": "2024-01-15",
- "title": "Festnetz-Rechnung 01/24"
- },
- {
- "id": 23,
- "postingDate": "2024-02-15",
- "valueDate": "2024-02-15",
- "title": "Festnetz-Rechnung 02/24"
- },
- {
- "id": 24,
- "postingDate": "2023-11-07",
- "valueDate": "2023-11-08",
- "title": "Mobilfunk-Rechnung 11/23"
- },
- {
- "id": 25,
- "postingDate": "2023-12-07",
- "valueDate": "2023-12-08",
- "title": "Mobilfunk-Rechnung 12/23"
- },
- {
- "id": 26,
- "postingDate": "2024-01-07",
- "valueDate": "2024-01-08",
- "title": "Mobilfunk-Rechnung 01/24"
- },
- {
- "id": 27,
- "postingDate": "2024-02-07",
- "valueDate": "2024-02-08",
- "title": "Mobilfunk-Rechnung 02/24"
- },
- {
- "id": 29,
- "postingDate": "2023-12-11",
- "valueDate": "2023-12-13",
- "title": "GA: Abhebung"
- },
- {
- "id": 30,
- "postingDate": "2023-11-30",
- "valueDate": "2023-12-01",
- "title": "GA: Abhebung"
- },
- {
- "id": 31,
- "postingDate": "2024-01-23",
- "valueDate": "2024-02-12",
- "title": "GA: Kreditkartenabhebung"
- },
- {
- "id": 32,
- "postingDate": "2023-12-01",
- "valueDate": "2023-12-04",
- "title": "Mitgliedsbeitrag DJH e.V."
- },
- {
- "id": 33,
- "postingDate": "2023-12-28",
- "valueDate": "2023-12-28",
- "title": "Mitgliedsbeitrag CCC e.V."
- },
- {
- "id": 34,
- "postingDate": "2023-11-03",
- "valueDate": "2023-11-03",
- "title": "Lebensmittel"
- },
- {
- "id": 35,
- "postingDate": "2023-11-09",
- "valueDate": "2023-11-09",
- "title": "Lebensmittel"
- },
- {
- "id": 36,
- "postingDate": "2023-11-14",
- "valueDate": "2023-11-14",
- "title": "Lebensmittel"
- },
- {
- "id": 37,
- "postingDate": "2023-11-18",
- "valueDate": "2023-11-18",
- "title": "Lebensmittel"
- },
- {
- "id": 38,
- "postingDate": "2023-11-24",
- "valueDate": "2023-11-24",
- "title": "Lebensmittel"
- },
- {
- "id": 39,
- "postingDate": "2023-12-02",
- "valueDate": "2023-12-02",
- "title": "Lebensmittel"
- },
- {
- "id": 40,
- "postingDate": "2023-12-08",
- "valueDate": "2023-12-08",
- "title": "Lebensmittel"
- },
- {
- "id": 41,
- "postingDate": "2023-12-18",
- "valueDate": "2023-12-18",
- "title": "Lebensmittel"
- },
- {
- "id": 42,
- "postingDate": "2024-01-03",
- "valueDate": "2024-01-03",
- "title": "Lebensmittel"
- },
- {
- "id": 43,
- "postingDate": "2024-01-09",
- "valueDate": "2024-01-09",
- "title": "Lebensmittel"
- },
- {
- "id": 44,
- "postingDate": "2024-01-13",
- "valueDate": "2024-01-13",
- "title": "Lebensmittel"
- },
- {
- "id": 45,
- "postingDate": "2024-01-19",
- "valueDate": "2024-01-19",
- "title": "Lebensmittel"
- },
- {
- "id": 46,
- "postingDate": "2024-01-26",
- "valueDate": "2024-01-26",
- "title": "Lebensmittel"
- },
- {
- "id": 47,
- "postingDate": "2024-02-03",
- "valueDate": "2024-02-03",
- "title": "Lebensmittel"
- },
- {
- "id": 48,
- "postingDate": "2024-02-10",
- "valueDate": "2024-02-10",
- "title": "Lebensmittel"
- },
- {
- "id": 52,
- "postingDate": "2023-12-01",
- "valueDate": "2023-12-04",
- "title": "Ticket 37. Chaos Communication Congress"
- },
- {
- "id": 53,
- "postingDate": "2023-12-31",
- "valueDate": "2024-01-01",
- "title": "Zinsen 4/2024"
- },
- {
- "id": 54,
- "postingDate": "2024-02-12",
- "valueDate": "2024-02-12",
- "title": "Umbuchung Sparkonto 12.02."
- },
- {
- "id": 56,
- "postingDate": "2024-05-22",
- "valueDate": "2024-05-23",
- "title": "Test SSE"
- },
- {
- "id": 57,
- "postingDate": "2024-05-23",
- "valueDate": "2024-05-24",
- "title": "test sse"
- },
- {
- "id": 58,
- "postingDate": "2024-05-23",
- "valueDate": "2024-05-24",
- "title": "moin"
- },
- {
- "id": 59,
- "postingDate": "2024-05-24",
- "valueDate": "2024-05-26",
- "title": "Moin"
- },
- {
- "id": 60,
- "postingDate": "2024-05-25",
- "valueDate": "2024-05-26",
- "title": "Tach"
- }
-]