From 33bb64f44bda1e8d978def004ff313ea77f819ed Mon Sep 17 00:00:00 2001 From: "theis.gaedigk" Date: Wed, 20 Aug 2025 18:14:15 +0200 Subject: [PATCH 1/8] added ToDo.tsx to .gitignore --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5fd7033..4913a08 100644 --- a/.gitignore +++ b/.gitignore @@ -111,4 +111,6 @@ backend/public/uploads/ # API keys and secrets (additional protection) config/ secrets/ -keys/ \ No newline at end of file +keys/ + +ToDo.txt \ No newline at end of file From fd9496645a27038c7cc2e0462b5a6a20d809f724 Mon Sep 17 00:00:00 2001 From: "theis.gaedigk" Date: Thu, 21 Aug 2025 00:36:19 +0200 Subject: [PATCH 2/8] added detailed API documentation for retrieving loan details by loan code --- Docs/backend_API_docs/README.md | 67 +++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 7 deletions(-) diff --git a/Docs/backend_API_docs/README.md b/Docs/backend_API_docs/README.md index d7b8c5b..49eda77 100644 --- a/Docs/backend_API_docs/README.md +++ b/Docs/backend_API_docs/README.md @@ -8,7 +8,7 @@ On this page you will learn how my API works. When you look at my backend folder and file structure, you can see that I have two files called `API`. The first file called `api.js` is for my web frontend, because this file works together with my JWT token service. -But I have built a second API. You can see the second API file in the same directory, the file is called `apiV2.js`. +**\*But I have built a second API. You can see the second API file in the same directory, the file is called `apiV2.js`.** This is the file that you can use to build an API. @@ -45,7 +45,7 @@ Returns a list of all items and their details. #### Example Request ``` -GET /apiV2/items/your_admin_key +GET https://backend.insta.the1s.de/apiV2/items/your_admin_key ``` #### Example Response @@ -69,6 +69,8 @@ Each item has the following properties: - `can_borrow_role`: The role ID that is allowed to borrow the item. - `inSafe`: Indicates whether the item is currently in the locker (1) or not (0). This variable/state can change over time. +_You also get an http 200 status code._ + --- ### 2. Change Item Safe State @@ -82,7 +84,7 @@ Updates the `inSafe` state of an item (whether it is in the locker). #### Example Request ``` -POST /apiV2/controlInSafe/your_admin_key/5/0 +POST https://backend.insta.the1s.de/apiV2/controlInSafe/your_admin_key/item_id/new_item_state ``` #### Example Response @@ -93,7 +95,7 @@ POST /apiV2/controlInSafe/your_admin_key/5/0 _An empty object means, that the operation was successful and no further information is returned._ -_You also get an http 2xx status code._ +_You also get an http 200 status code._ --- @@ -108,7 +110,7 @@ Sets the `returned_date` of a loan to the current server time. #### Example Request ``` -POST /apiV2/setReturnDate/your_admin_key/123456 +POST https://backend.insta.the1s.de/apiV2/setReturnDate/your_admin_key/your_loan_code ``` #### Example Response @@ -119,7 +121,7 @@ POST /apiV2/setReturnDate/your_admin_key/123456 _An empty object means, that the operation was successful and no further information is returned._ -_You also get an http 2xx status code._ +_You also get an http 200 status code._ --- @@ -134,7 +136,7 @@ Sets the `take_date` of a loan to the current server time. #### Example Request ``` -POST /apiV2/setTakeDate/your_admin_key/123456 +POST https://backend.insta.the1s.de/apiV2/setTakeDate/your_admin_key/your_loan_code ``` #### Example Response @@ -149,6 +151,57 @@ _You also get an http 2xx status code._ --- +### 5. Get whole loan by loan code + +**POST** `/getLoanByCode/:key/:loan_code` + +Retrieves the details of a specific loan by its unique code. + +- `loan_code`: The unique code of the loan. + +#### Example Request + +``` +GET https://backend.insta.the1s.de/getLoanByCode/your_admin_key/your_loan_code +``` + +#### Example Response + +``` +{ + "data": { + "id": 6, + "username": "theis", + "loan_code": 646473, + "start_date": "2025-08-25T13:23:00.000Z", + "end_date": "2025-08-26T13:23:00.000Z", + "take_date": null, + "returned_date": null, + "created_at": "2025-08-20T11:23:40.000Z", + "loaned_items_id": [ + 8, + 9 + ], + "loaned_items_name": [ + "SD Karten", + "Kameragimbal" + ] + } +} +``` + +_You also get an http 200 status code._ + +If the loan id does not exist, you will receive a 404 status code and an error message. + +``` +{ + "message": "Loan not found" +} +``` + +--- + ## Error Handling - `403 Forbidden`: Invalid or missing API key. From 226a267ccb11edd80fbc20f8ce88f56808afc4e8 Mon Sep 17 00:00:00 2001 From: "theis.gaedigk" Date: Thu, 21 Aug 2025 00:38:28 +0200 Subject: [PATCH 3/8] updated example response in API documentation to include detailed item properties and entry creation timestamps --- Docs/backend_API_docs/README.md | 111 +++++++++++++++++++++++++++++--- 1 file changed, 102 insertions(+), 9 deletions(-) diff --git a/Docs/backend_API_docs/README.md b/Docs/backend_API_docs/README.md index 49eda77..2f005ae 100644 --- a/Docs/backend_API_docs/README.md +++ b/Docs/backend_API_docs/README.md @@ -51,15 +51,108 @@ GET https://backend.insta.the1s.de/apiV2/items/your_admin_key #### Example Response ``` -[ - { - "id": 1, - "item_name": "DJI 1er Mikro", - "can_borrow_role": "4", - "inSafe": 1 - }, - ... -] +{ + "data": [ + { + "id": 1, + "item_name": "DJI 1er Mikro", + "can_borrow_role": 4, + "inSafe": 1, + "entry_created_at": "2025-08-19T22:02:16.000Z" + }, + { + "id": 2, + "item_name": "DJI 2er Mikro 1", + "can_borrow_role": 4, + "inSafe": 1, + "entry_created_at": "2025-08-19T22:02:16.000Z" + }, + { + "id": 3, + "item_name": "DJI 2er Mikro 2", + "can_borrow_role": 4, + "inSafe": 1, + "entry_created_at": "2025-08-19T22:02:16.000Z" + }, + { + "id": 4, + "item_name": "Rode Richt Mikrofon", + "can_borrow_role": 2, + "inSafe": 1, + "entry_created_at": "2025-08-19T22:02:16.000Z" + }, + { + "id": 5, + "item_name": "Kamera Stativ", + "can_borrow_role": 1, + "inSafe": 1, + "entry_created_at": "2025-08-19T22:02:16.000Z" + }, + { + "id": 6, + "item_name": "SONY Kamera - inkl. Akkus und Objektiv", + "can_borrow_role": 1, + "inSafe": 1, + "entry_created_at": "2025-08-19T22:02:16.000Z" + }, + { + "id": 7, + "item_name": "MacBook inkl. Adapter", + "can_borrow_role": 2, + "inSafe": 1, + "entry_created_at": "2025-08-19T22:02:16.000Z" + }, + { + "id": 8, + "item_name": "SD Karten", + "can_borrow_role": 3, + "inSafe": 1, + "entry_created_at": "2025-08-19T22:02:16.000Z" + }, + { + "id": 9, + "item_name": "Kameragimbal", + "can_borrow_role": 1, + "inSafe": 1, + "entry_created_at": "2025-08-19T22:02:16.000Z" + }, + { + "id": 10, + "item_name": "ATEM MINI PRO", + "can_borrow_role": 1, + "inSafe": 1, + "entry_created_at": "2025-08-19T22:02:16.000Z" + }, + { + "id": 11, + "item_name": "Handygimbal", + "can_borrow_role": 4, + "inSafe": 1, + "entry_created_at": "2025-08-19T22:02:16.000Z" + }, + { + "id": 12, + "item_name": "Kameralfter", + "can_borrow_role": 1, + "inSafe": 1, + "entry_created_at": "2025-08-19T22:02:16.000Z" + }, + { + "id": 13, + "item_name": "Kleine Kamera 1 - inkl. Objektiv", + "can_borrow_role": 2, + "inSafe": 1, + "entry_created_at": "2025-08-19T22:02:16.000Z" + }, + { + "id": 14, + "item_name": "Kleine Kamera 2 - inkl. Objektiv", + "can_borrow_role": 2, + "inSafe": 1, + "entry_created_at": "2025-08-19T22:02:16.000Z" + } + ] +} ``` Each item has the following properties: From 8f1d401aa1fcd968e8343a5135ddd60d378255f0 Mon Sep 17 00:00:00 2001 From: "theis.gaedigk" Date: Thu, 21 Aug 2025 12:44:15 +0200 Subject: [PATCH 4/8] enhance sidebar item descriptions for clarity --- frontend/src/components/Sidebar.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx index 3750fd0..abecefc 100644 --- a/frontend/src/components/Sidebar.tsx +++ b/frontend/src/components/Sidebar.tsx @@ -70,7 +70,9 @@ const Sidebar: React.FC = () => { @@ -81,7 +83,7 @@ const Sidebar: React.FC = () => {
- Verfügbar + Im Schließfach From a8377e5ec3ff5f813a9deee76cceaf462798526d Mon Sep 17 00:00:00 2001 From: "theis.gaedigk" Date: Thu, 21 Aug 2025 12:48:03 +0200 Subject: [PATCH 5/8] added help section --- Docs/HELP.md | 0 frontend/src/components/Header.tsx | 5 +++++ 2 files changed, 5 insertions(+) create mode 100644 Docs/HELP.md diff --git a/Docs/HELP.md b/Docs/HELP.md new file mode 100644 index 0000000..e69de29 diff --git a/frontend/src/components/Header.tsx b/frontend/src/components/Header.tsx index a7e8454..3e4fd94 100644 --- a/frontend/src/components/Header.tsx +++ b/frontend/src/components/Header.tsx @@ -23,6 +23,11 @@ const Header: React.FC = ({ onLogout }) => { > Logout + + +
); From d1625d7e47679c8e49bd03c04dd547d16c3a1cd2 Mon Sep 17 00:00:00 2001 From: "theis.gaedigk" Date: Thu, 21 Aug 2025 13:00:01 +0200 Subject: [PATCH 6/8] refactor help site --- Docs/HELP.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Docs/HELP.md b/Docs/HELP.md index e69de29..97d5fe1 100644 --- a/Docs/HELP.md +++ b/Docs/HELP.md @@ -0,0 +1,11 @@ +# Hilfe Seite + +Hier finden Sie Informationen zur Verwendung des Systems. + +## Unerwartete Probleme + +Falls unerwartetet Probleme im Web oder im Safe auftreten sollten, können Sie den Support via Teams kontaktieren. + +**Kontaktpersonen:** +- Theis Gaedigk (Web & Safe) +- Niklas Brunke (Safe) \ No newline at end of file From 79df00a17e57a7e5d8bf433b3c3ef8cb80936162 Mon Sep 17 00:00:00 2001 From: "theis.gaedigk" Date: Thu, 21 Aug 2025 18:53:18 +0200 Subject: [PATCH 7/8] added footer component --- frontend/src/components/Footer.tsx | 12 ++++++++++++ frontend/src/components/LoginForm.tsx | 2 ++ frontend/src/layout/Layout.tsx | 8 ++++---- 3 files changed, 18 insertions(+), 4 deletions(-) create mode 100644 frontend/src/components/Footer.tsx diff --git a/frontend/src/components/Footer.tsx b/frontend/src/components/Footer.tsx new file mode 100644 index 0000000..55d4654 --- /dev/null +++ b/frontend/src/components/Footer.tsx @@ -0,0 +1,12 @@ +import React from "react"; + +const Footer: React.FC = () => { + return ( +
+

Made with ❤️ by Theis Gaedigk - Jahrgang 2019

+

v1.1

+
+ ); +}; + +export default Footer; diff --git a/frontend/src/components/LoginForm.tsx b/frontend/src/components/LoginForm.tsx index ea74839..2769b06 100644 --- a/frontend/src/components/LoginForm.tsx +++ b/frontend/src/components/LoginForm.tsx @@ -1,4 +1,5 @@ import React from "react"; +import Footer from "./Footer"; import { useState } from "react"; import { loginUser } from "../utils/fetchData"; import { myToast } from "../utils/toastify"; @@ -66,6 +67,7 @@ const LoginForm: React.FC = ({ onLogin }) => { +