Compare commits
324
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
302419802b | ||
|
|
3f5856c86b | ||
|
|
8c347d124a | ||
|
|
0b69384fb7 | ||
|
|
2d19d9a06f | ||
|
|
70338266f2 | ||
|
|
00ac28aebf | ||
|
|
c9c38f07ad | ||
|
|
7af099f022 | ||
|
|
b4eb339657 | ||
|
|
79443930e2 | ||
|
|
08315359c7 | ||
|
|
b3ec0257d5 | ||
|
|
1dd335e166 | ||
|
|
f33b979bcb | ||
|
|
69389afdb7 | ||
|
|
593c540d81 | ||
|
|
dfff051b55 | ||
|
|
97de073621 | ||
|
|
6c227dcaad | ||
|
|
df90bf21d1 | ||
|
|
5f9ce78476 | ||
|
|
e008e2583e | ||
|
|
f2a5419064 | ||
|
|
a89225fce6 | ||
|
|
9e58b18e43 | ||
|
|
b2badea855 | ||
|
|
d222604fcf | ||
|
|
c99d5f4347 | ||
|
|
9b552b88f8 | ||
|
|
5886777854 | ||
|
|
730248f3e8 | ||
|
|
01dd5c9089 | ||
|
|
9c0d704748 | ||
|
|
e736170735 | ||
|
|
1290df93f6 | ||
|
|
ed05aa3a53 | ||
|
|
e715e66929 | ||
|
|
6233d27d7b | ||
|
|
76a4b201b8 | ||
|
|
4622e91f26 | ||
|
|
c6bc6cf8f9 | ||
|
|
a39eee06e9 | ||
|
|
4137b511bb | ||
|
|
2e11917ea1 | ||
|
|
148c33cf6e | ||
|
|
d9fd91ad8d | ||
|
|
b5293e246c | ||
|
|
b1aa5bec07 | ||
|
|
fd984529e7 | ||
|
|
7136a7b16c | ||
|
|
f005069ee2 | ||
|
|
9ed72aa23e | ||
|
|
377d888221 | ||
|
|
b6ad218fdb | ||
|
|
02e523cb62 | ||
|
|
11ee9dcf6e | ||
|
|
facf5a63d0 | ||
|
|
2d967fd5ad | ||
|
|
2ee3895a28 | ||
|
|
e84b02f8d5 | ||
|
|
97f2d91323 | ||
|
|
1c74a56586 | ||
|
|
5ce49d672b | ||
|
|
7b02a51867 | ||
|
|
d77a4918fe | ||
|
|
5957fa442a | ||
|
|
83cf78d00d | ||
|
|
ad9fc0e02a | ||
|
|
5e0b6d7477 | ||
|
|
3152c92ac0 | ||
|
|
9b10ce153d | ||
|
|
80220c903c | ||
|
|
297f338a17 | ||
|
|
714d523020 | ||
|
|
d572a55ce6 | ||
|
|
75ae18a6ca | ||
|
|
98a4483771 | ||
|
|
2298ac3895 | ||
|
|
d94dec9062 | ||
|
|
fe1f9fdfd9 | ||
|
|
fd68ce2f34 | ||
|
|
88be63384f | ||
|
|
ad942e38ff | ||
|
|
1aeeecb32b | ||
|
|
68daed2bcc | ||
|
|
35ef1a2bc8 | ||
|
|
da996b5922 | ||
|
|
f1fa9ffcb4 | ||
|
|
b4def65ec0 | ||
|
|
4ba8b4d823 | ||
|
|
f108692809 | ||
|
|
292c1922dd | ||
|
|
aa6b5c7444 | ||
|
|
d6b32f4991 | ||
|
|
80fdd6ccae | ||
|
|
2e062f60b9 | ||
|
|
96a0876035 | ||
|
|
a7d467f187 | ||
|
|
a49506fece | ||
|
|
75721a7465 | ||
|
|
71fd6ee420 | ||
|
|
1e1b8d0ec5 | ||
|
|
5a34db09f6 | ||
|
|
a467d3f4a7 | ||
|
|
7c81870665 | ||
|
|
6f503f311e | ||
|
|
9fa60a8d6d | ||
|
|
16dfd340ec | ||
|
|
8a6bef92f7 | ||
|
|
17b7f485f6 | ||
|
|
7bec1e7b5c | ||
|
|
b601083e7a | ||
|
|
3d8e7f308b | ||
|
|
c8808a9f23 | ||
|
|
a6063ad842 | ||
|
|
109a7a9610 | ||
|
|
9b442e7828 | ||
|
|
340e524945 | ||
|
|
37062e6c37 | ||
|
|
5135bcad5a | ||
|
|
bbc3cfe0f7 | ||
|
|
6d2c39c69b | ||
|
|
696d14bd39 | ||
|
|
ca6ebc9e35 | ||
|
|
d3bdc3d65e | ||
|
|
13e2af55a8 | ||
|
|
390b3b266c | ||
|
|
ddec4d8335 | ||
|
|
f83f3bf4b1 | ||
|
|
5ee6f07089 | ||
|
|
67c0a5e9b2 | ||
|
|
e8319d304a | ||
|
|
de56ba242c | ||
|
|
f84660f0be | ||
|
|
113e9cdb82 | ||
|
|
bb6d4abe9e | ||
|
|
844decd963 | ||
|
|
de72438a0b | ||
|
|
e8fcb5ed9c | ||
|
|
9f436720e9 | ||
|
|
18daded2c2 | ||
|
|
e579044ed5 | ||
|
|
f7d11a77d1 | ||
|
|
080f61a0c8 | ||
|
|
18ac0273bd | ||
|
|
c104754ff3 | ||
|
|
4a0c70fb98 | ||
|
|
05874500b8 | ||
|
|
b14b0ac08b | ||
|
|
c72b14e594 | ||
|
|
5a48acba2f | ||
|
|
b5d61ff772 | ||
|
|
66e8ac13ea | ||
|
|
6aa624a507 | ||
|
|
71d7d373eb | ||
|
|
0564d81b25 | ||
|
|
c724bafb06 | ||
|
|
d39acbd54a | ||
|
|
7202eea4cc | ||
|
|
ab7734915b | ||
|
|
9361de6cb0 | ||
|
|
4d69c8167a | ||
|
|
42cf4064a5 | ||
|
|
88dc53c761 | ||
|
|
7de26ba846 | ||
|
|
67829592ed | ||
|
|
19f9c1db7a | ||
|
|
db87bbe34e | ||
|
|
4ec5f88495 | ||
|
|
61e44916b2 | ||
|
|
f9188b09b1 | ||
|
|
3d18618d87 | ||
|
|
824c66a28d | ||
|
|
ed2cfe8be9 | ||
|
|
6a32200ce5 | ||
|
|
a7d94868f7 | ||
|
|
5064564886 | ||
|
|
ee6cee4d54 | ||
|
|
006e8b63db | ||
|
|
90bbbffae7 | ||
|
|
2cb98af4f1 | ||
|
|
46024bd589 | ||
|
|
50852cf3a0 | ||
|
|
61c9348c60 | ||
|
|
086e16fc82 | ||
|
|
a01f3c917a | ||
|
|
8f5452c09f | ||
|
|
fd9a328478 | ||
|
|
45cc85b7b4 | ||
|
|
33cd0b0fad | ||
|
|
1acd4af71f | ||
|
|
ed0df61e16 | ||
|
|
abb1af276c | ||
|
|
2ade9c9744 | ||
|
|
6bd55f6e86 | ||
|
|
226e7f68ce | ||
|
|
e4df4f492d | ||
|
|
4bbbdf7d10 | ||
|
|
1b321420a5 | ||
|
|
344ae5c584 | ||
|
|
81227cc56d | ||
|
|
b95c238492 | ||
|
|
146ef1f3e1 | ||
|
|
cd12da1099 | ||
|
|
bce0b982ee | ||
|
|
9b8887793e | ||
|
|
bfca2878b9 | ||
|
|
4c67f191a2 | ||
|
|
4f62c7f93e | ||
|
|
7698efd446 | ||
|
|
a99342cc98 | ||
|
|
47a3849220 | ||
|
|
51d4e1b451 | ||
|
|
ab8a85e1f1 | ||
|
|
65cdc95b72 | ||
|
|
600c39352a | ||
|
|
ffb4a7e2c6 | ||
|
|
2963dd40a6 | ||
|
|
fbd20f9089 | ||
|
|
9e8202d382 | ||
|
|
ccb37a666a | ||
|
|
fd0a3959a5 | ||
|
|
6cfe4d3510 | ||
|
|
18cf37f7c9 | ||
|
|
62953ffa61 | ||
|
|
d731c46c9c | ||
|
|
dd5308b495 | ||
|
|
002d09955a | ||
|
|
f4822ceb4d | ||
|
|
d5df05f87a | ||
|
|
ea34010c8d | ||
|
|
7428c7db25 | ||
|
|
2b2889cb63 | ||
|
|
6bedcb1836 | ||
|
|
a635d7c374 | ||
|
|
02eac10d9a | ||
|
|
a49ceea355 | ||
|
|
4f453c0263 | ||
|
|
409469e098 | ||
|
|
821f5c7216 | ||
|
|
77b5ed5991 | ||
|
|
6175817db2 | ||
|
|
ea3b07ed0f | ||
|
|
33964f2a30 | ||
|
|
49377a98a8 | ||
|
|
5b313a4364 | ||
|
|
afda716a66 | ||
|
|
f5add6b590 | ||
|
|
ca6c4bdf9e | ||
|
|
8307e50d24 | ||
|
|
09fa991077 | ||
|
|
be7b752ce7 | ||
|
|
19c2647cf6 | ||
|
|
2bed4c24a4 | ||
|
|
de864daf3d | ||
|
|
c371cf00df | ||
|
|
22e8606a0f | ||
|
|
782344494c | ||
|
|
ae5c28dc8f | ||
|
|
47815e073d | ||
|
|
c0ad79188b | ||
|
|
1db3b6a397 | ||
|
|
cc132a1341 | ||
|
|
b65b58aa39 | ||
|
|
02a5139e29 | ||
|
|
c2762d8011 | ||
|
|
fae479ae57 | ||
|
|
e36f4cc0b7 | ||
|
|
b71cf3ee42 | ||
|
|
4b6348a8f5 | ||
|
|
e7c7ec8deb | ||
|
|
f873174eb2 | ||
|
|
c535e7d22d | ||
|
|
c2f413329d | ||
|
|
bc558be02d | ||
|
|
b9a3d82078 | ||
|
|
b053685160 | ||
|
|
54a2815648 | ||
|
|
6710ea144d | ||
|
|
9aec8146dc | ||
|
|
a609dde372 | ||
|
|
faf1933147 | ||
|
|
5a56892f32 | ||
|
|
be92e93c3c | ||
|
|
3eae718204 | ||
|
|
063b55e793 | ||
|
|
38ab94a024 | ||
|
|
a3f2ab37c3 | ||
|
|
070e84c6d6 | ||
|
|
2f1da222b8 | ||
|
|
78abc6fa6b | ||
|
|
8d4027e044 | ||
|
|
d65a0da5ed | ||
|
|
5607412605 | ||
|
|
6879528bb1 | ||
|
|
433c1bac3a | ||
|
|
9684f8f64b | ||
|
|
08cb764eb8 | ||
|
|
0fb44f0fd3 | ||
|
|
3f89d22f02 | ||
|
|
c54799a5c6 | ||
|
|
80d981be74 | ||
|
|
371a8a508e | ||
|
|
071e4f4de2 | ||
|
|
7c4edd2c9a | ||
|
|
ea16dcb4d2 | ||
|
|
bb0853aa9c | ||
|
|
1e542236d0 | ||
|
|
a0c17a9541 | ||
|
|
4a032000ae | ||
|
|
1750f8059b | ||
|
|
49df5b01f5 | ||
|
|
f870421f66 | ||
|
|
be2a38fedc | ||
|
|
882bc0e577 | ||
|
|
5f3a6c56f9 | ||
|
|
4af57ba1de | ||
|
|
ce93c7a56e | ||
|
|
07b58ccad7 | ||
|
|
b3702c0029 | ||
|
|
3be624df0d | ||
|
|
5bb9a38796 | ||
|
|
04a4eb876a |
No files matched your search
@@ -0,0 +1,57 @@
|
||||
name: User Story template
|
||||
about: Vorlage für eine User Story mit Backend- und Frontend-Aufgaben
|
||||
title: "[User Story]: "
|
||||
body:
|
||||
- type: textarea
|
||||
id: user-story
|
||||
attributes:
|
||||
label: User Story
|
||||
description: Die User Story erscheint im Issue als Zitat (Zeilen mit `>` beginnen).
|
||||
placeholder: Als <Rolle> möchte ich <Ziel>, damit <Nutzen>.
|
||||
value: "> "
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "# Technisch"
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "## Backend"
|
||||
|
||||
- type: textarea
|
||||
id: backend-beschreibung
|
||||
attributes:
|
||||
label: Was muss gemacht werden
|
||||
description: Fließtext
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: backend-todos
|
||||
attributes:
|
||||
label: To-Do Liste
|
||||
description: Pro Zeile ein To-Do, beliebig viele.
|
||||
value: "- [ ] "
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "## Frontend"
|
||||
|
||||
- type: textarea
|
||||
id: frontend-beschreibung
|
||||
attributes:
|
||||
label: Was muss gemacht werden
|
||||
description: Fließtext
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: frontend-todos
|
||||
attributes:
|
||||
label: To-Do Liste
|
||||
description: Pro Zeile ein To-Do, beliebig viele.
|
||||
value: "- [ ] "
|
||||
@@ -0,0 +1,57 @@
|
||||
name: User Story template
|
||||
about: Vorlage für eine User Story mit Backend- und Frontend-Aufgaben
|
||||
title: "[User Story]: "
|
||||
body:
|
||||
- type: textarea
|
||||
id: user-story
|
||||
attributes:
|
||||
label: User Story
|
||||
description: Die User Story erscheint im Issue als Zitat (Zeilen mit `>` beginnen).
|
||||
placeholder: Als <Rolle> möchte ich <Ziel>, damit <Nutzen>.
|
||||
value: "> "
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "# Technisch"
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "## Backend"
|
||||
|
||||
- type: textarea
|
||||
id: backend-beschreibung
|
||||
attributes:
|
||||
label: Was muss gemacht werden
|
||||
description: Fließtext
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: backend-todos
|
||||
attributes:
|
||||
label: To-Do Liste
|
||||
description: Pro Zeile ein To-Do, beliebig viele.
|
||||
value: "- [ ] "
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "## Frontend"
|
||||
|
||||
- type: textarea
|
||||
id: frontend-beschreibung
|
||||
attributes:
|
||||
label: Was muss gemacht werden
|
||||
description: Fließtext
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
id: frontend-todos
|
||||
attributes:
|
||||
label: To-Do Liste
|
||||
description: Pro Zeile ein To-Do, beliebig viele.
|
||||
value: "- [ ] "
|
||||
@@ -11,6 +11,7 @@ node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
target
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
@@ -22,3 +23,6 @@ dist-ssr
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
# H2
|
||||
data
|
||||
@@ -1,31 +0,0 @@
|
||||
# Einkaufsliste
|
||||
|
||||
Dies ist die Dokumentation des Projektes Einkaufsliste der WInfo Klasse
|
||||
DBWINFO B/C 05.
|
||||
|
||||
## Installation
|
||||
|
||||
Laufen lassen über `vite`:
|
||||
|
||||
```bash
|
||||
# Repository klonen
|
||||
git clone https://gitea.von.timaldinger.de/winterknabe/einkaufsliste-web.git
|
||||
|
||||
# ins Verzeichnis wechseln
|
||||
cd einkaufsliste
|
||||
|
||||
# Abhängigkeiten Installieren
|
||||
npm install
|
||||
|
||||
# Server starten
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Falls nur statische Seite gewünscht:
|
||||
|
||||
```bash
|
||||
# Repository klonen
|
||||
git clone https://gitea.von.timaldinger.de/winterknabe/einkaufsliste-web.git
|
||||
```
|
||||
|
||||
`einkaufsliste/dist/index.html` im Browser öffnen.
|
||||
@@ -1,12 +0,0 @@
|
||||
# User stories
|
||||
|
||||
Liste der User Stories und ihr Status:
|
||||
|
||||
## Als ein Nutzer möchte ich
|
||||
|
||||
- ~... Gegenstände mit Namen und Menge hinzufügen.~ (Abgeschlossen 28.09.2026)
|
||||
- ~... möchte ich Gegenstände bearbeiten können.~ (Abgeschlossen 29.09.2026)
|
||||
- ... möchte ich Gegenstände in der Reihenfolge verschieben können.
|
||||
- ... Kategorien erstellen können und darunter Gegenstände hinzufügen.
|
||||
- ... Kategorien samt Inhalt speichern und wiederaufrufen können.
|
||||
- ... verschiedene Einkaufslisten erstellen können.
|
||||
-27
@@ -1,27 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Einkaufsliste</title>
|
||||
<link href="/src/style.css" rel="stylesheet">
|
||||
<script src="/src/main.js" type="module"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="title">
|
||||
<h1>Einkaufsliste</h1>
|
||||
</div>
|
||||
|
||||
<div class="list">
|
||||
<form class="list__inputForm">
|
||||
<input type="text" class="list__inputForm__itemName" name="itemName" placeholder="Gegenstand eingeben...">
|
||||
<input type="text" class="list__inputForm__itemAmount" name="itemAmount" placeholder="Menge eingeben...">
|
||||
<button class="list__inputForm__submitButton" type="submit">Hinzufügen</button>
|
||||
</form>
|
||||
|
||||
<ul class="list__displayedList">
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Generated
-828
@@ -1,828 +0,0 @@
|
||||
{
|
||||
"name": "einkaufsliste",
|
||||
"version": "0.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "einkaufsliste",
|
||||
"version": "0.0.0",
|
||||
"devDependencies": {
|
||||
"vite": "^8.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@oxc-project/types": {
|
||||
"version": "0.151.0",
|
||||
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.151.0.tgz",
|
||||
"integrity": "sha512-J1yXrIlNDZVzE3ada310xeAw7nH8yCAyLPuUIsjKatFPmfn5bS1oW+cM+QsGOtVWd5nhSpbwZWx/rue+r5Z+PA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/oxc-project"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-android-arm-eabi": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.11.tgz",
|
||||
"integrity": "sha512-A5kXfGKvKWWZE0TtPrfsvT+q4Y5d1QG8gGUzpYjGydM+fARM9MuX90PrXYXe0XbsDVgyxxNzHo6giCj90bsFNw==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-android-arm64": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.11.tgz",
|
||||
"integrity": "sha512-z6cTycz+iJ4PVkuL4HHW4DfTfoeU/2nqYYuSOrTmH7yHK5Y0LCOnA03V4ZNxavyVaU1oOqUgIg2klN/s+USGOA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-darwin-arm64": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.11.tgz",
|
||||
"integrity": "sha512-jShvqNtP6vDC6/A5JOAzbVV+DkgHqhl/ScVCJEbt+TUY6QYz7YnXcrg3sLtFBniro0f/Ld50ZwCWA6f7KYD1nQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-darwin-x64": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.11.tgz",
|
||||
"integrity": "sha512-f2i2xiNWq1Z1l2++q2fuhZRdLAT3aqxD6vRNm1RAxpUoBcdqNB3C0s1Bt+K+PbEx2F5F4gQp6hqKkphCY/xF9w==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-freebsd-x64": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.11.tgz",
|
||||
"integrity": "sha512-4Ir5FSOKIAMr4r0kExpt1s3bMgzJU3rA45AYOHtQpls0oNeqcYBKrWMlckrYH4KCfGLfkfn1tN1dmZPMVsdXow==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-arm-gnueabihf": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.11.tgz",
|
||||
"integrity": "sha512-/gnRDM+39BROzAN/k1OZjDPnDMcZxB/0EUxKjONO5yVkNEvlsoMDrxGNKgZi/ttFriS2gwlDNzB65pvNbFOXIQ==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-arm64-gnu": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.11.tgz",
|
||||
"integrity": "sha512-PFaK8HwvAHbaKbBcDNQihjMKYvFnA5hiENx/l5tphTDz1E0WFp32l0A7aq7lyUwGsRw/xSrNIy/gIK4thrSCrw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-arm64-musl": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.11.tgz",
|
||||
"integrity": "sha512-AskzJUIKRLPxkruR1wLKewGbOw+EYfU/9lOrBFj4AFrEA8hPpKFnODWNu2WLaNs0QNkEb9QIJufmVZZIL/bJlg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-ppc64-gnu": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.11.tgz",
|
||||
"integrity": "sha512-qlUGAheh2yh8afH7QBgx0PrRHN85hKnNd78x8MeMhXivuevgd8vgf6/CstOzmNKY/lLTHvNTrPy98cLnAugzJw==",
|
||||
"cpu": [
|
||||
"ppc64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-s390x-gnu": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.11.tgz",
|
||||
"integrity": "sha512-secpEad+0vCbSfn8upFySkDskv+bGPk3THSDS9Y89yc4rb4kzqHp8Dmyd9BkQW4SnhNXBZCl/6CrO//hZahNJQ==",
|
||||
"cpu": [
|
||||
"s390x"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-x64-gnu": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.11.tgz",
|
||||
"integrity": "sha512-mOVBT3dPpkWm8XBWPmU4bf+U6dYDLeMo/9ojUmis4N0L5uu10qra5vOyngZ7/PSdoE4G9KvRt4bloRxNjLas7A==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-linux-x64-musl": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.11.tgz",
|
||||
"integrity": "sha512-Is78i9A8Ui4SqcxUwFJ9uMmjDn58IbVTjFWYdQestFEgeuEmHMLGNriXnVJKkwG2YiZjw8cP0zCTyDMdDGtOOg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-openharmony-arm64": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.11.tgz",
|
||||
"integrity": "sha512-dUCXneZ87INUMyQ0D+C0HrEBNUPNXHaPmU5GTjyKTJEiussw9Kaj5Ln8UztPe4epV/ffvgNBEadksdYhmW6xJA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"openharmony"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-win32-arm64-msvc": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.11.tgz",
|
||||
"integrity": "sha512-jByxb6qfd+bH1xUd0qnfFnb17i9sWBPY2tOavJ0l3tdr3OTu+Kvtm8cd/JV5nFt657b1VqGltxg9olOEfofXWw==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/binding-win32-x64-msvc": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.11.tgz",
|
||||
"integrity": "sha512-/PzKqzAJ03i19oy2ItPvyvaVjOjBCNnfaJs8yvUdGBKmiESgnrJSQ2awd81QzFbbnAmu7YO9ZnJrDCb9VSJPRA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@rolldown/pluginutils": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz",
|
||||
"integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/detect-libc": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
|
||||
"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/fdir": {
|
||||
"version": "6.5.0",
|
||||
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
|
||||
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"picomatch": "^3 || ^4"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"picomatch": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||
"dev": true,
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss": {
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz",
|
||||
"integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==",
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"dependencies": {
|
||||
"detect-libc": "^2.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"lightningcss-android-arm64": "1.33.0",
|
||||
"lightningcss-darwin-arm64": "1.33.0",
|
||||
"lightningcss-darwin-x64": "1.33.0",
|
||||
"lightningcss-freebsd-x64": "1.33.0",
|
||||
"lightningcss-linux-arm-gnueabihf": "1.33.0",
|
||||
"lightningcss-linux-arm64-gnu": "1.33.0",
|
||||
"lightningcss-linux-arm64-musl": "1.33.0",
|
||||
"lightningcss-linux-x64-gnu": "1.33.0",
|
||||
"lightningcss-linux-x64-musl": "1.33.0",
|
||||
"lightningcss-win32-arm64-msvc": "1.33.0",
|
||||
"lightningcss-win32-x64-msvc": "1.33.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-android-arm64": {
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz",
|
||||
"integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"android"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-darwin-arm64": {
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz",
|
||||
"integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-darwin-x64": {
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz",
|
||||
"integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-freebsd-x64": {
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz",
|
||||
"integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"freebsd"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-arm-gnueabihf": {
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz",
|
||||
"integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==",
|
||||
"cpu": [
|
||||
"arm"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-arm64-gnu": {
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz",
|
||||
"integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-arm64-musl": {
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz",
|
||||
"integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-x64-gnu": {
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz",
|
||||
"integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"glibc"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-linux-x64-musl": {
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz",
|
||||
"integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"libc": [
|
||||
"musl"
|
||||
],
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-win32-arm64-msvc": {
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz",
|
||||
"integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==",
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/lightningcss-win32-x64-msvc": {
|
||||
"version": "1.33.0",
|
||||
"resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz",
|
||||
"integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==",
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"dev": true,
|
||||
"license": "MPL-2.0",
|
||||
"optional": true,
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"engines": {
|
||||
"node": ">= 12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/parcel"
|
||||
}
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.19",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.19.tgz",
|
||||
"integrity": "sha512-Y2tUNy4ouw6tq5oDSKeQYGOyhkUBhNOcGV/02KC+6kd9eDGqdZd++mjMiIDilrBYvjEnCYvVtsuHCuP+okSfug==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"nanoid": "bin/nanoid.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/picocolors": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
||||
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/picomatch": {
|
||||
"version": "4.0.7",
|
||||
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz",
|
||||
"integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/jonschlinkert"
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.5.28",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.28.tgz",
|
||||
"integrity": "sha512-RRuzqDtt5Y9h3quz5hWhK+TPnsmVs6WwSU6LkJMeY4HstUEDuYTG8UJSdawMRzmzAtV+KEoG8N3Qg2qLy5vM/A==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/postcss/"
|
||||
},
|
||||
{
|
||||
"type": "tidelift",
|
||||
"url": "https://tidelift.com/funding/github/npm/postcss"
|
||||
},
|
||||
{
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/ai"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.18",
|
||||
"picocolors": "^1.1.1",
|
||||
"source-map-js": "^1.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/rolldown": {
|
||||
"version": "1.2.11",
|
||||
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.11.tgz",
|
||||
"integrity": "sha512-qpSwIyz0jHQq5qXBTNxFmE6664rJ7O+4TvPFOiOaBSrz8IOHc1koKKSqTM2H6u1UG1+TveuC6vaDHKXFOvb1Kw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@oxc-project/types": "=0.151.0",
|
||||
"@rolldown/pluginutils": "^1.0.0"
|
||||
},
|
||||
"bin": {
|
||||
"rolldown": "bin/cli.mjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rolldown/binding-android-arm-eabi": "1.2.11",
|
||||
"@rolldown/binding-android-arm64": "1.2.11",
|
||||
"@rolldown/binding-darwin-arm64": "1.2.11",
|
||||
"@rolldown/binding-darwin-x64": "1.2.11",
|
||||
"@rolldown/binding-freebsd-x64": "1.2.11",
|
||||
"@rolldown/binding-linux-arm-gnueabihf": "1.2.11",
|
||||
"@rolldown/binding-linux-arm64-gnu": "1.2.11",
|
||||
"@rolldown/binding-linux-arm64-musl": "1.2.11",
|
||||
"@rolldown/binding-linux-ppc64-gnu": "1.2.11",
|
||||
"@rolldown/binding-linux-s390x-gnu": "1.2.11",
|
||||
"@rolldown/binding-linux-x64-gnu": "1.2.11",
|
||||
"@rolldown/binding-linux-x64-musl": "1.2.11",
|
||||
"@rolldown/binding-openharmony-arm64": "1.2.11",
|
||||
"@rolldown/binding-win32-arm64-msvc": "1.2.11",
|
||||
"@rolldown/binding-win32-x64-msvc": "1.2.11"
|
||||
}
|
||||
},
|
||||
"node_modules/source-map-js": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
||||
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
||||
"dev": true,
|
||||
"license": "BSD-3-Clause",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/tinyglobby": {
|
||||
"version": "0.2.17",
|
||||
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
|
||||
"integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"fdir": "^6.5.0",
|
||||
"picomatch": "^4.0.4"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/SuperchupuDev"
|
||||
}
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "8.3.1",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-8.3.1.tgz",
|
||||
"integrity": "sha512-/bvH9E9tmCXRGp2uXY3WbOldqpTwFkbha/8ANaEQ6VkxhH60KyqLwgZq6lG2y+4uT55x9+9eUHMpQ7uGnOCKjA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"lightningcss": "^1.33.0",
|
||||
"picomatch": "^4.0.7",
|
||||
"postcss": "^8.5.28",
|
||||
"rolldown": "~1.2.9",
|
||||
"tinyglobby": "^0.2.17"
|
||||
},
|
||||
"bin": {
|
||||
"vite": "bin/vite.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || >=22.12.0"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/vitejs/vite?sponsor=1"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/node": "^20.19.0 || >=22.12.0",
|
||||
"@vitejs/devtools": "^0.7.1",
|
||||
"esbuild": "^0.27.0 || ^0.28.0",
|
||||
"jiti": ">=1.21.0",
|
||||
"less": "^4.0.0",
|
||||
"sass": "^1.70.0",
|
||||
"sass-embedded": "^1.70.0",
|
||||
"stylus": ">=0.54.8",
|
||||
"sugarss": "^5.0.0",
|
||||
"terser": "^5.16.0",
|
||||
"tsx": "^4.8.1",
|
||||
"yaml": "^2.4.2"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/node": {
|
||||
"optional": true
|
||||
},
|
||||
"@vitejs/devtools": {
|
||||
"optional": true
|
||||
},
|
||||
"esbuild": {
|
||||
"optional": true
|
||||
},
|
||||
"jiti": {
|
||||
"optional": true
|
||||
},
|
||||
"less": {
|
||||
"optional": true
|
||||
},
|
||||
"sass": {
|
||||
"optional": true
|
||||
},
|
||||
"sass-embedded": {
|
||||
"optional": true
|
||||
},
|
||||
"stylus": {
|
||||
"optional": true
|
||||
},
|
||||
"sugarss": {
|
||||
"optional": true
|
||||
},
|
||||
"terser": {
|
||||
"optional": true
|
||||
},
|
||||
"tsx": {
|
||||
"optional": true
|
||||
},
|
||||
"yaml": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"name": "einkaufsliste",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"vite": "^8.3.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>4.1.1</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>de.timaldinger</groupId>
|
||||
<artifactId>einkaufsliste</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name/>
|
||||
<description/>
|
||||
<url/>
|
||||
<licenses>
|
||||
<license/>
|
||||
</licenses>
|
||||
<developers>
|
||||
<developer/>
|
||||
</developers>
|
||||
<scm>
|
||||
<connection/>
|
||||
<developerConnection/>
|
||||
<tag/>
|
||||
<url/>
|
||||
</scm>
|
||||
<properties>
|
||||
<java.version>25</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-rest</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webmvc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-rest-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-webmvc-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-compile</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>default-testCompile</id>
|
||||
<phase>test-compile</phase>
|
||||
<goals>
|
||||
<goal>testCompile</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -1,102 +0,0 @@
|
||||
export class ShoppingListItem {
|
||||
|
||||
constructor(name, amount, onChange) {
|
||||
this.name = name;
|
||||
this.amount = amount;
|
||||
this.isDone = false;
|
||||
this.isEditing = false;
|
||||
this.remove = false;
|
||||
this.onChange = onChange;
|
||||
}
|
||||
|
||||
//gibt ein <li> Element zurück
|
||||
render() {
|
||||
let li;
|
||||
if (this.isEditing) {
|
||||
li = this.#renderEditing();
|
||||
} else {
|
||||
li = this.#renderNormal()
|
||||
}
|
||||
return li;
|
||||
|
||||
}
|
||||
|
||||
#renderEditing() {
|
||||
const li = document.createElement("li");
|
||||
const editForm = document.createElement("form");
|
||||
const editNameField = document.createElement("input");
|
||||
const editAmountField = document.createElement("input");
|
||||
const saveButton = document.createElement("button");
|
||||
const abortButton = document.createElement("button");
|
||||
|
||||
|
||||
editNameField.setAttribute("name", "newItemName");
|
||||
editAmountField.setAttribute("name", "newItemAmount");
|
||||
|
||||
abortButton.textContent = "Abbrechen";
|
||||
abortButton.addEventListener("click", (event) => {
|
||||
event.preventDefault();
|
||||
this.isEditing = false;
|
||||
this.onChange();
|
||||
});
|
||||
|
||||
saveButton.textContent = "Speichern";
|
||||
editForm.addEventListener("submit", (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const editFormData = Object.fromEntries(new FormData(editForm));
|
||||
|
||||
if (!editFormData.newItemName && !editFormData.newItemAmount) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.name = editFormData.newItemName;
|
||||
this.amount = editFormData.newItemAmount;
|
||||
this.isEditing = false;
|
||||
this.onChange();
|
||||
});
|
||||
|
||||
editForm.appendChild(editNameField);
|
||||
editForm.appendChild(editAmountField);
|
||||
editForm.appendChild(saveButton);
|
||||
editForm.appendChild(abortButton);
|
||||
li.appendChild(editForm);
|
||||
|
||||
return li;
|
||||
}
|
||||
|
||||
#renderNormal() {
|
||||
const li = document.createElement("li");
|
||||
const listContent = document.createElement("span");
|
||||
const removeButton = document.createElement("button");
|
||||
const editButton = document.createElement("button");
|
||||
const doneButton = document.createElement("input");
|
||||
|
||||
doneButton.setAttribute("type", "checkbox");
|
||||
doneButton.addEventListener("change", () => {
|
||||
this.isDone = doneButton.checked;
|
||||
});
|
||||
|
||||
editButton.textContent = "Bearbeiten"
|
||||
editButton.addEventListener("click", () => {
|
||||
this.isEditing = true;
|
||||
this.onChange();
|
||||
});
|
||||
|
||||
removeButton.textContent = "Löschen";
|
||||
removeButton.addEventListener("click", () => {
|
||||
this.remove = true;
|
||||
this.onChange();
|
||||
});
|
||||
|
||||
listContent.textContent = this.name + " " + this.amount;
|
||||
|
||||
li.appendChild(doneButton);
|
||||
li.appendChild(listContent);
|
||||
li.appendChild(editButton);
|
||||
li.appendChild(removeButton);
|
||||
|
||||
return li;
|
||||
|
||||
}
|
||||
}
|
||||
-39
@@ -1,39 +0,0 @@
|
||||
import { ShoppingListItem } from "./ShoppingListItem";
|
||||
|
||||
const form = document.querySelector(".list__inputForm");
|
||||
const itemListElement = document.querySelector(".list__displayedList");
|
||||
|
||||
let listItems = []; //list of items that the user has
|
||||
|
||||
|
||||
function handleListElement(itemName, itemAmount,) {
|
||||
listItems.push(new ShoppingListItem(itemName, itemAmount, renderList));
|
||||
renderList();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function renderList() {
|
||||
listItems = listItems.filter(item => !item.remove)
|
||||
itemListElement.innerHTML = ""; //reset innerItemList
|
||||
|
||||
listItems.forEach((element, index) => {
|
||||
itemListElement.appendChild(element.render(index));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function init() {
|
||||
|
||||
document.querySelector(".list__inputForm").addEventListener("submit", (event) => {
|
||||
if (!form.checkValidity()) return;
|
||||
event.preventDefault();
|
||||
const formData = Object.fromEntries(new FormData(form));
|
||||
handleListElement(formData.itemName, formData.itemAmount);
|
||||
});
|
||||
}
|
||||
|
||||
init();
|
||||
@@ -0,0 +1,52 @@
|
||||
package de.timaldinger.einkaufsliste.Controller;
|
||||
|
||||
import de.timaldinger.einkaufsliste.Exceptions.ResourceNotFoundException;
|
||||
import de.timaldinger.einkaufsliste.Models.ShoppingList;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingCategoryRepository;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingItemRepository;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingListRepository;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/")
|
||||
public class PageController {
|
||||
|
||||
@Autowired
|
||||
private ShoppingListRepository shoppingListRepository;
|
||||
|
||||
@Autowired
|
||||
private ShoppingCategoryRepository shoppingCategoryRepository;
|
||||
|
||||
@Autowired
|
||||
private ShoppingItemRepository shoppingItemRepository;
|
||||
|
||||
@GetMapping("/")
|
||||
public String index(Model model){
|
||||
model.addAttribute("lists", shoppingListRepository.findAll());
|
||||
return "index";
|
||||
}
|
||||
|
||||
/**
|
||||
* Gibt die list.html Seite einer Liste zurück mit den Attributen list, categories und items
|
||||
* @param model
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list/{id}")
|
||||
public String list(Model model, @PathVariable UUID id){
|
||||
ShoppingList list = shoppingListRepository.findById(id).orElseThrow(() -> new ResourceNotFoundException("Seite",id));
|
||||
List<ShoppingList> lists = shoppingListRepository.findAll();
|
||||
model.addAttribute("lists", lists);
|
||||
model.addAttribute("list", list);
|
||||
model.addAttribute("categories", shoppingCategoryRepository.findByList(list));
|
||||
model.addAttribute("items", shoppingItemRepository.findByList_IdAndCategoryIsNull(id));
|
||||
return "list";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package de.timaldinger.einkaufsliste.Controller;
|
||||
|
||||
import de.timaldinger.einkaufsliste.Dto.Post.ShoppingCategoryPostDTO;
|
||||
import de.timaldinger.einkaufsliste.Dto.Patch.ShoppingCategoryPatchDTO;
|
||||
import de.timaldinger.einkaufsliste.Dto.Response.ShoppingCategoryResponseDTO;
|
||||
import de.timaldinger.einkaufsliste.Exceptions.BadRequestException;
|
||||
import de.timaldinger.einkaufsliste.Exceptions.ResourceNotFoundException;
|
||||
import de.timaldinger.einkaufsliste.Models.ShoppingCategory;
|
||||
import de.timaldinger.einkaufsliste.Models.ShoppingItem;
|
||||
import de.timaldinger.einkaufsliste.Models.ShoppingList;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingCategoryRepository;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingItemRepository;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingListRepository;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
public class ShoppingCategoryController {
|
||||
@Autowired
|
||||
private ShoppingCategoryRepository shoppingCategoryRepository;
|
||||
@Autowired
|
||||
private ShoppingListRepository shoppingListRepository;
|
||||
@Autowired
|
||||
private ShoppingItemRepository shoppingItemRepository;
|
||||
|
||||
@PostMapping("/api/categories")
|
||||
public ResponseEntity<ShoppingCategoryResponseDTO> addCategory(@Valid @RequestBody ShoppingCategoryPostDTO newCategory){
|
||||
|
||||
String name = newCategory.categoryName();
|
||||
ShoppingList list = shoppingListRepository.findById(newCategory.listID()).orElseThrow(() -> new ResourceNotFoundException("listID",newCategory.listID()));
|
||||
|
||||
ShoppingCategory category = new ShoppingCategory(name, List.of(),list);
|
||||
|
||||
shoppingCategoryRepository.save(category);
|
||||
|
||||
URI location = ServletUriComponentsBuilder
|
||||
.fromCurrentRequest()
|
||||
.path("/{id}")
|
||||
.buildAndExpand(category.getId())
|
||||
.toUri();
|
||||
|
||||
return ResponseEntity.created(location).body(new ShoppingCategoryResponseDTO(name, category.getId()));
|
||||
}
|
||||
|
||||
@PatchMapping("/api/categories/{categoryID}")
|
||||
public ResponseEntity<Void> editCategory(@PathVariable UUID categoryID,@Valid @RequestBody ShoppingCategoryPatchDTO toChange){
|
||||
ShoppingCategory category = shoppingCategoryRepository.findById(categoryID).orElseThrow(() -> new ResourceNotFoundException("categoryID",categoryID));
|
||||
|
||||
if(toChange.categoryName() != null) category.setCategoryName(toChange.categoryName());
|
||||
|
||||
shoppingCategoryRepository.save(category);
|
||||
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/api/categories/{categoryID}")
|
||||
public ResponseEntity<Void> deleteCategory(@PathVariable UUID categoryID, @RequestParam(required = false) Boolean deleteAllItems){
|
||||
|
||||
if(deleteAllItems == null){
|
||||
throw new BadRequestException("Missing required parameter deleteAllItems (can be either true or false)");
|
||||
}
|
||||
|
||||
shoppingCategoryRepository.findById(categoryID).orElseThrow(() -> new ResourceNotFoundException("categoryID", categoryID));
|
||||
|
||||
List<ShoppingItem> itemList = shoppingItemRepository.findAllByCategory_Id(categoryID);
|
||||
if(deleteAllItems){
|
||||
itemList.forEach((item) -> shoppingItemRepository.deleteById(item.getId()));
|
||||
}else{
|
||||
itemList.forEach((item) -> item.setCategory(null));
|
||||
shoppingItemRepository.saveAll(itemList);
|
||||
}
|
||||
|
||||
shoppingCategoryRepository.deleteById(categoryID);
|
||||
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package de.timaldinger.einkaufsliste.Controller;
|
||||
|
||||
import de.timaldinger.einkaufsliste.Dto.Post.ShoppingItemPostDTO;
|
||||
import de.timaldinger.einkaufsliste.Dto.Patch.ShoppingItemPatchDTO;
|
||||
import de.timaldinger.einkaufsliste.Dto.Response.ShoppingItemResponseDTO;
|
||||
import de.timaldinger.einkaufsliste.Exceptions.BadRequestException;
|
||||
import de.timaldinger.einkaufsliste.Exceptions.ResourceNotFoundException;
|
||||
import de.timaldinger.einkaufsliste.Models.ShoppingCategory;
|
||||
import de.timaldinger.einkaufsliste.Models.ShoppingItem;
|
||||
import de.timaldinger.einkaufsliste.Models.ShoppingList;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingCategoryRepository;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingItemRepository;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingListRepository;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
public class ShoppingItemController {
|
||||
@Autowired
|
||||
private ShoppingCategoryRepository shoppingCategoryRepository;
|
||||
@Autowired
|
||||
private ShoppingListRepository shoppingListRepository;
|
||||
@Autowired
|
||||
private ShoppingItemRepository shoppingItemRepository;
|
||||
|
||||
@PostMapping("/api/items")
|
||||
public ResponseEntity<ShoppingItemResponseDTO> addItem(@Valid @RequestBody ShoppingItemPostDTO newItem){
|
||||
String name = newItem.itemName();
|
||||
String amount = newItem.itemAmount();
|
||||
ShoppingCategory c;
|
||||
if(newItem.categoryID() != null){
|
||||
c = shoppingCategoryRepository.findById(newItem.categoryID()).orElseThrow(() -> new ResourceNotFoundException("categoryID", newItem.categoryID()));
|
||||
}else{
|
||||
c = null;
|
||||
}
|
||||
ShoppingList list = shoppingListRepository.findById(newItem.listID()).orElseThrow(() -> new ResourceNotFoundException("listID", newItem.listID()));
|
||||
|
||||
ShoppingItem item = new ShoppingItem(name, amount, false, c, list);
|
||||
shoppingItemRepository.save(item);
|
||||
|
||||
URI location = ServletUriComponentsBuilder
|
||||
.fromCurrentRequest()
|
||||
.path("/{id}")
|
||||
.buildAndExpand(item.getId())
|
||||
.toUri();
|
||||
|
||||
return ResponseEntity.created(location).body(new ShoppingItemResponseDTO(name,amount,item.getId(),c != null ? c.getId() : null));
|
||||
}
|
||||
|
||||
@PatchMapping("/api/items/{itemID}")
|
||||
public ResponseEntity<Void> editItem(@PathVariable UUID itemID , @Valid @RequestBody ShoppingItemPatchDTO toChange){
|
||||
ShoppingItem item = shoppingItemRepository.findById(itemID).orElseThrow(() -> new ResourceNotFoundException("itemID",itemID));
|
||||
|
||||
if(toChange.itemName() != null) item.setItemName(toChange.itemName());
|
||||
if(toChange.itemAmount() != null) item.setItemAmount(toChange.itemAmount());
|
||||
if(toChange.isDone() != null) item.setDone(toChange.isDone());
|
||||
if(toChange.categoryID() != null) item.setCategory(shoppingCategoryRepository.findById(toChange.categoryID()).orElseThrow(() -> new ResourceNotFoundException("categoryID",toChange.categoryID())));
|
||||
|
||||
shoppingItemRepository.save(item);
|
||||
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@DeleteMapping("/api/items/{itemID}")
|
||||
public ResponseEntity<Void> deleteItem(@PathVariable UUID itemID){
|
||||
shoppingItemRepository.findById(itemID).orElseThrow(() ->new ResourceNotFoundException("itemID",itemID));
|
||||
shoppingItemRepository.deleteById(itemID);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/api/lists/{listID}/items")
|
||||
public ResponseEntity<Void> deleteAllDoneItems(@PathVariable UUID listID, @RequestParam boolean done){
|
||||
if(!done) throw new BadRequestException("Parameter \"done\" must be true!");
|
||||
shoppingListRepository.findById(listID).orElseThrow(() -> new ResourceNotFoundException("listID", listID));
|
||||
|
||||
List<ShoppingItem> items = shoppingItemRepository.findByList_IdAndIsDoneIsTrue(listID);
|
||||
shoppingItemRepository.deleteAll(items);
|
||||
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package de.timaldinger.einkaufsliste.Controller;
|
||||
|
||||
import de.timaldinger.einkaufsliste.Dto.Patch.ShoppingListPatchDTO;
|
||||
import de.timaldinger.einkaufsliste.Dto.Post.ShoppingListPostDTO;
|
||||
import de.timaldinger.einkaufsliste.Dto.Response.ShoppingListResponseDTO;
|
||||
import de.timaldinger.einkaufsliste.Exceptions.ResourceNotFoundException;
|
||||
import de.timaldinger.einkaufsliste.Models.ShoppingItem;
|
||||
import de.timaldinger.einkaufsliste.Models.ShoppingList;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingCategoryRepository;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingItemRepository;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingListRepository;
|
||||
import de.timaldinger.einkaufsliste.Service.ShoppingListService;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@RestController
|
||||
public class ShoppingListController {
|
||||
|
||||
@Autowired
|
||||
private ShoppingCategoryRepository shoppingCategoryRepository;
|
||||
@Autowired
|
||||
private ShoppingListRepository shoppingListRepository;
|
||||
@Autowired
|
||||
private ShoppingItemRepository shoppingItemRepository;
|
||||
@Autowired
|
||||
private ShoppingListService shoppingListService;
|
||||
|
||||
@PostMapping("/api/lists")
|
||||
public ResponseEntity<ShoppingListResponseDTO> addList(@Valid @RequestBody ShoppingListPostDTO newList){
|
||||
ShoppingList list = new ShoppingList(newList.listName(), null, null, 0, 0);
|
||||
|
||||
shoppingListRepository.save(list);
|
||||
|
||||
URI location = ServletUriComponentsBuilder
|
||||
.fromCurrentRequest()
|
||||
.path("/{id}")
|
||||
.buildAndExpand(list.getId())
|
||||
.toUri();
|
||||
|
||||
return ResponseEntity.created(location).body(new ShoppingListResponseDTO(list.getListName(), list.getId()));
|
||||
}
|
||||
|
||||
@DeleteMapping("/api/lists/{listID}")
|
||||
public ResponseEntity<Void> deleteList(@PathVariable UUID listID){
|
||||
shoppingListRepository.findById(listID).orElseThrow(() -> new ResourceNotFoundException("listID",listID));
|
||||
|
||||
shoppingListService.deleteList(listID);
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
|
||||
@PatchMapping("/api/lists/{listID}")
|
||||
public ResponseEntity<Void> editList(@PathVariable UUID listID,@Valid @RequestBody ShoppingListPatchDTO toChange){
|
||||
ShoppingList list = shoppingListRepository.findById(listID).orElseThrow(() -> new ResourceNotFoundException("listID", listID));
|
||||
|
||||
if(toChange.newListName() != null) list.setListName(toChange.newListName());
|
||||
|
||||
shoppingListRepository.save(list);
|
||||
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package de.timaldinger.einkaufsliste.Dto.Patch;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
public record ShoppingCategoryPatchDTO(@NotBlank(message = "categoryName can't be blank") String categoryName) {
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package de.timaldinger.einkaufsliste.Dto.Patch;
|
||||
|
||||
import jakarta.validation.constraints.AssertTrue;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public record ShoppingItemPatchDTO(String itemName, String itemAmount, Boolean isDone, UUID categoryID) {
|
||||
|
||||
@AssertTrue(message = "itemName and itemAmount both cant be blank!")
|
||||
private boolean isAtleastOneNotBlank(){
|
||||
boolean n = itemName != null && !itemName.isBlank();
|
||||
boolean a = itemAmount != null && !itemAmount.isBlank();
|
||||
return n || a || isDone != null || categoryID != null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package de.timaldinger.einkaufsliste.Dto.Patch;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
public record ShoppingListPatchDTO(@NotBlank(message = "listName must not be blank!") String newListName) {
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package de.timaldinger.einkaufsliste.Dto.Post;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public record ShoppingCategoryPostDTO(@NotBlank String categoryName, UUID listID) {
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package de.timaldinger.einkaufsliste.Dto.Post;
|
||||
|
||||
import jakarta.validation.constraints.AssertTrue;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public record ShoppingItemPostDTO(String itemName,
|
||||
String itemAmount,
|
||||
UUID categoryID,
|
||||
@NotNull(message = "listID must not be empty!")
|
||||
UUID listID){
|
||||
|
||||
@AssertTrue(message = "itemName and itemAmount cant both be blank!")
|
||||
private boolean isAtleastOneNotBlank(){
|
||||
boolean n = itemName != null && !itemName.isBlank();
|
||||
boolean a = itemAmount != null && !itemAmount.isBlank();
|
||||
return n || a;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package de.timaldinger.einkaufsliste.Dto.Post;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
public record ShoppingListPostDTO(@NotBlank(message = "listName must not be blank!") String listName) {
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package de.timaldinger.einkaufsliste.Dto.Response;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public record ShoppingCategoryResponseDTO (String categoryName, UUID categoryID){
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package de.timaldinger.einkaufsliste.Dto.Response;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public record ShoppingItemResponseDTO(String itemName, String itemAmount, UUID itemID, UUID categoryID) {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package de.timaldinger.einkaufsliste.Dto.Response;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public record ShoppingListResponseDTO (String listName, UUID listID){
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package de.timaldinger.einkaufsliste;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class EinkaufslisteApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(EinkaufslisteApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package de.timaldinger.einkaufsliste.Exceptions;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
@ResponseStatus(HttpStatus.BAD_REQUEST)
|
||||
public class BadRequestException extends RuntimeException {
|
||||
public BadRequestException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package de.timaldinger.einkaufsliste.Exceptions;
|
||||
|
||||
public record ErrorResponse(int status, String msg, String path) {
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package de.timaldinger.einkaufsliste.Exceptions;
|
||||
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.support.DefaultMessageSourceResolvable;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.HttpStatusCode;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.context.request.ServletWebRequest;
|
||||
import org.springframework.web.context.request.WebRequest;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestControllerAdvice
|
||||
public class GlobalExceptionHandler extends ResponseEntityExceptionHandler {
|
||||
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
||||
|
||||
@ExceptionHandler(BadRequestException.class)
|
||||
public ResponseEntity<ErrorResponse> handleBadRequest(BadRequestException e, HttpServletRequest req) {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST)
|
||||
.body(new ErrorResponse(400, e.getMessage(), req.getRequestURI()));
|
||||
}
|
||||
@ExceptionHandler(ResourceNotFoundException.class)
|
||||
public ResponseEntity<ErrorResponse> handleResourceNotFound(ResourceNotFoundException e, HttpServletRequest req) {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND)
|
||||
.body(new ErrorResponse(404, e.getMessage(), req.getRequestURI()));
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public ResponseEntity<ErrorResponse> handleAll(Exception e, HttpServletRequest req){
|
||||
log.error("{}",req.getRequestURI(), e);
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(new ErrorResponse(500,"Internal error", req.getRequestURI()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable ResponseEntity<Object> handleExceptionInternal(Exception ex, @Nullable Object body, HttpHeaders headers, HttpStatusCode statusCode, WebRequest request) {
|
||||
var error = new ErrorResponse(statusCode.value(), ex.getMessage(),((ServletWebRequest) request).getRequest().getRequestURI());
|
||||
return new ResponseEntity<>(error,headers,statusCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected @Nullable ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotValidException ex, HttpHeaders headers, HttpStatusCode status, WebRequest request) {
|
||||
String msg = ex.getBindingResult().getFieldErrors().stream()
|
||||
.map(DefaultMessageSourceResolvable::getDefaultMessage)
|
||||
.collect(Collectors.joining(", "));
|
||||
var error = new ErrorResponse(status.value(), msg ,((ServletWebRequest) request).getRequest().getRequestURI());
|
||||
return new ResponseEntity<>(error,headers,status);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package de.timaldinger.einkaufsliste.Exceptions;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
|
||||
@ResponseStatus(HttpStatus.NOT_FOUND)
|
||||
public class ResourceNotFoundException extends RuntimeException {
|
||||
public ResourceNotFoundException(String resource, Object value){ super("Resource " + resource + ":"+value.toString()+" not found");}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package de.timaldinger.einkaufsliste.Models;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ShoppingCategory extends ShoppingElement{
|
||||
|
||||
private String categoryName;
|
||||
@OneToMany(mappedBy = "category") //eine Liste hat mehrere Kategorien, diese sind mappedBy category (Feld in ShoppingItem) damit keine extra Tabelle erzeugt wird
|
||||
private List<ShoppingItem> itemsInCategory;
|
||||
@ManyToOne //mehrere Kategorien (Many) gehören (to) einer Liste an (one)
|
||||
@JoinColumn(name="list_id", nullable = false)
|
||||
private ShoppingList list;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package de.timaldinger.einkaufsliste.Models;
|
||||
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.MappedSuperclass;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@MappedSuperclass
|
||||
public abstract class ShoppingElement{
|
||||
@Id @GeneratedValue(strategy = GenerationType.UUID)
|
||||
private UUID id;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package de.timaldinger.einkaufsliste.Models;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.JoinColumn;
|
||||
import jakarta.persistence.ManyToOne;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.*;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class ShoppingItem extends ShoppingElement {
|
||||
|
||||
private String itemName;
|
||||
private String itemAmount;
|
||||
private boolean isDone;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "category_id", nullable = true)
|
||||
private ShoppingCategory category;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "list_id", nullable = false)
|
||||
private ShoppingList list;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package de.timaldinger.einkaufsliste.Models;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.sql.Date;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Entity
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ShoppingList extends ShoppingElement {
|
||||
private String listName;
|
||||
private Date dateCreated;
|
||||
private Date lastChanged;
|
||||
private int numberItems;
|
||||
private int numberCategory;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package de.timaldinger.einkaufsliste.Repository;
|
||||
|
||||
import de.timaldinger.einkaufsliste.Models.ShoppingList;
|
||||
import de.timaldinger.einkaufsliste.Models.ShoppingCategory;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface ShoppingCategoryRepository extends JpaRepository<ShoppingCategory, UUID>{
|
||||
List<ShoppingCategory> findByList(ShoppingList list);
|
||||
@Modifying
|
||||
@Query("DELETE FROM ShoppingCategory c WHERE c.list.id = :listID")
|
||||
void deleteByListId(@Param("listID") UUID listID);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package de.timaldinger.einkaufsliste.Repository;
|
||||
|
||||
import de.timaldinger.einkaufsliste.Models.ShoppingItem;
|
||||
import de.timaldinger.einkaufsliste.Models.ShoppingList;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface ShoppingItemRepository extends JpaRepository<ShoppingItem, UUID> {
|
||||
|
||||
List<ShoppingItem> findByList_IdAndCategoryIsNull(UUID list);
|
||||
List<ShoppingItem> findAllByCategory_Id(UUID categoryID);
|
||||
List<ShoppingItem> findByList_IdAndIsDoneIsTrue(UUID listID);
|
||||
@Modifying
|
||||
@Query("DELETE FROM ShoppingItem i WHERE i.list.id = :listID")
|
||||
void deleteByListId(@Param("listID") UUID listID);
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package de.timaldinger.einkaufsliste.Repository;
|
||||
|
||||
import de.timaldinger.einkaufsliste.Models.ShoppingList;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public interface ShoppingListRepository extends JpaRepository<ShoppingList, UUID>{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package de.timaldinger.einkaufsliste.Service;
|
||||
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingCategoryRepository;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingItemRepository;
|
||||
import de.timaldinger.einkaufsliste.Repository.ShoppingListRepository;
|
||||
import jakarta.transaction.Transactional;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Service
|
||||
public class ShoppingListService {
|
||||
@Autowired
|
||||
private ShoppingItemRepository shoppingItemRepository;
|
||||
@Autowired
|
||||
private ShoppingListRepository shoppingListRepository;
|
||||
@Autowired
|
||||
private ShoppingCategoryRepository shoppingCategoryRepository;
|
||||
|
||||
@Transactional
|
||||
public void deleteList(UUID listID){
|
||||
shoppingItemRepository.deleteByListId(listID);
|
||||
shoppingCategoryRepository.deleteByListId(listID);
|
||||
shoppingListRepository.deleteById(listID);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
spring.application.name=einkaufsliste
|
||||
|
||||
spring.datasource.url=jdbc:h2:file:./data/einkaufsliste
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.h2.console.enabled=true
|
||||
|
||||
server.error.include-stacktrace=never
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
.nav__dropdown {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.nav__dropdownMenu {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.nav__dropdown:hover .nav__dropdownMenu,
|
||||
.nav__dropdown.is-open .nav__dropdownMenu{
|
||||
display: block;
|
||||
}
|
||||
|
||||
.nav > ul {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
list-style: none;
|
||||
margin: 1;
|
||||
padding: 1;
|
||||
}
|
||||
|
||||
.nav__dropdownMenu {
|
||||
background-color: grey;
|
||||
}
|
||||
Whitespace-only changes.
@@ -0,0 +1,22 @@
|
||||
.category__name--bold {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.category__name--big {
|
||||
font-size : 1.5rem;
|
||||
}
|
||||
|
||||
shopping-item[is-checked="true"] .item__text{
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: .5em;
|
||||
}
|
||||
|
||||
.item__text{
|
||||
display: inline-flex;
|
||||
gap: .25em;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
export class ShoppingCategory extends HTMLElement {
|
||||
|
||||
static get observedAttributes() { return ["category-name"] }
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this._rendered = false;
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
if (this._rendered) return;
|
||||
const categoryHeaderDiv = document.createElement("div");
|
||||
const span = document.createElement("span");
|
||||
const deleteCategoryButton = document.createElement("button");
|
||||
const labelDeleteAllItems = document.createElement("label");
|
||||
const deleteAllItemsCheckbox = document.createElement("input");
|
||||
const ul = document.createElement("ul");
|
||||
|
||||
|
||||
|
||||
categoryHeaderDiv.classList.add("category__header");
|
||||
|
||||
span.textContent = this.getAttribute("category-name");
|
||||
span.classList.add("category__name", "category__name--bold", "category__name--big");
|
||||
|
||||
labelDeleteAllItems.classList.add("category__labelDeleteAll");
|
||||
labelDeleteAllItems.textContent = "Gegenstände mit Kategorie löschen?";
|
||||
|
||||
deleteCategoryButton.classList.add("category__deleteButton");
|
||||
deleteCategoryButton.textContent = "Kategorie löschen";
|
||||
|
||||
deleteAllItemsCheckbox.setAttribute("type", "checkbox");
|
||||
|
||||
labelDeleteAllItems.append(deleteAllItemsCheckbox);
|
||||
|
||||
categoryHeaderDiv.append(span, deleteCategoryButton, labelDeleteAllItems);
|
||||
|
||||
this.prepend(categoryHeaderDiv);
|
||||
|
||||
if (!this.querySelector("ul")) this.append(ul);
|
||||
|
||||
this._rendered = true;
|
||||
|
||||
}
|
||||
|
||||
attributeChangedCallback(name, oldVal, newVal) {
|
||||
if (!this._rendered) return;
|
||||
if (newVal == oldVal) return;
|
||||
switch (name) {
|
||||
case "category-name":
|
||||
this.querySelector(".category__name").textContent = newVal;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
export class ShoppingItem extends HTMLElement {
|
||||
|
||||
static get observedAttributes() { return ["item-name", "item-amount"] }
|
||||
constructor() {
|
||||
super();
|
||||
this._rendered = false;
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
if (this._rendered) return;
|
||||
|
||||
console.log(`rendering element shopping-item`);
|
||||
const checkboxDone = document.createElement("input");
|
||||
const spanText = document.createElement("span");
|
||||
const spanName = document.createElement("span");
|
||||
const spanAmount = document.createElement("span");
|
||||
const buttonDelete = document.createElement("button");
|
||||
|
||||
|
||||
checkboxDone.classList.add("item__checkboxDone");
|
||||
checkboxDone.setAttribute("type", "checkbox");
|
||||
checkboxDone.setAttribute("autocomplete", "off");
|
||||
checkboxDone.checked = this.getAttribute("is-checked") === "true";
|
||||
|
||||
spanText.classList.add("item__text");
|
||||
|
||||
spanName.classList.add("item__itemName");
|
||||
spanAmount.classList.add("item__itemAmount");
|
||||
|
||||
spanName.textContent = this.getAttribute("item-name");
|
||||
spanAmount.textContent = this.getAttribute("item-amount");
|
||||
|
||||
buttonDelete.classList.add("item__buttonDeleteItem");
|
||||
buttonDelete.setAttribute("type", "button ");
|
||||
buttonDelete.textContent = "Löschen";
|
||||
|
||||
spanText.append(spanName, spanAmount);
|
||||
|
||||
this.append(checkboxDone, spanText, buttonDelete);
|
||||
this._rendered = true;
|
||||
|
||||
}
|
||||
|
||||
attributeChangedCallback(name, oldVal, newVal) {
|
||||
if (!this._rendered) return;
|
||||
if (newVal == oldVal) return;
|
||||
switch (name) {
|
||||
case "item-name":
|
||||
this.querySelector(".item__itemName").textContent = newVal;
|
||||
break;
|
||||
case "item-amount":
|
||||
this.querySelector(".item__itemAmount").textContent = newVal;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
|
||||
|
||||
export class ShoppingList {
|
||||
constructor(name) {
|
||||
this.listName = name;
|
||||
this.lastModified = "";
|
||||
this.created = "";
|
||||
this.listID = 0;
|
||||
}
|
||||
|
||||
static fromJSON(listAsJSON) {
|
||||
const list = new ShoppingList(listAsJSON.listName);
|
||||
list.listID = listAsJSON.listID;
|
||||
return list;
|
||||
}
|
||||
|
||||
render() {
|
||||
const li = document.createElement("li");
|
||||
const a = document.createElement("a");
|
||||
const editButton = document.createElement("button");
|
||||
const deleteButton = document.createElement("button");
|
||||
|
||||
li.classList.add("list");
|
||||
li.dataset.id = this.listID;
|
||||
|
||||
a.setAttribute("href", `/list/${this.listID}`);
|
||||
a.classList.add("list__name");
|
||||
a.textContent = this.listName;
|
||||
|
||||
editButton.classList.add("list__editButton");
|
||||
editButton.textContent = "Liste bearbeiten";
|
||||
|
||||
deleteButton.classList.add("list__deleteButton");
|
||||
deleteButton.textContent = "Liste löschen";
|
||||
|
||||
li.append(a, editButton, deleteButton);
|
||||
|
||||
return li;
|
||||
}
|
||||
|
||||
renderNavElement() {
|
||||
const li = document.createElement("li");
|
||||
const a = document.createElement("a");
|
||||
|
||||
li.classList.add("navbar__list");
|
||||
li.dataset.id = this.listID;
|
||||
|
||||
a.setAttribute("href", `/list/${this.listID}`);
|
||||
a.textContent = this.listName;
|
||||
|
||||
li.append(a);
|
||||
|
||||
return li;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
|
||||
|
||||
|
||||
export function addList(listName) {
|
||||
return fetch(`/api/lists`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({ listName: listName }),
|
||||
headers: { "Content-Type": "application/json" }
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
export function deleteList(id) {
|
||||
return fetch(`/api/lists/${id}`, { method: "DELETE" });
|
||||
}
|
||||
|
||||
|
||||
|
||||
export function editList(listID, toChange) {
|
||||
return fetch(`/api/lists/${listID}`,
|
||||
{
|
||||
method: "PATCH",
|
||||
body: JSON.stringify(toChange),
|
||||
headers: { "Content-Type": "application/json" }
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import { ShoppingList } from "../../../models/ShoppingList.js";
|
||||
|
||||
|
||||
export function addList(listAsJSON) {
|
||||
const list = document.querySelector(".displayedList");
|
||||
const navList = document.querySelector(".nav__dropdownMenu");
|
||||
const listElement = ShoppingList.fromJSON(listAsJSON);
|
||||
|
||||
list.append(listElement.render());
|
||||
navList.append(listElement.renderNavElement());
|
||||
}
|
||||
|
||||
export function deleteList(listElement) {
|
||||
|
||||
document.querySelector(`li.navbar__list[data-id='${listElement.dataset.id}']`).remove();
|
||||
listElement.remove();
|
||||
}
|
||||
|
||||
export function createEditListForm(textElement) {
|
||||
const editForm = document.createElement("form");
|
||||
const inputName = document.createElement("input");
|
||||
const abortButton = document.createElement("button");
|
||||
const saveButton = document.createElement("button");
|
||||
|
||||
inputName.setAttribute("name", "newListName");
|
||||
inputName.setAttribute("value", textElement.querySelector(".list__name").textContent);
|
||||
inputName.classList.add("editForm__name");
|
||||
|
||||
abortButton.textContent = "Abbrechen";
|
||||
saveButton.textContent = "Speichern";
|
||||
|
||||
saveButton.classList.add("editForm__saveButton");
|
||||
abortButton.classList.add("editForm__abortButton");
|
||||
|
||||
editForm.append(inputName, saveButton, abortButton);
|
||||
|
||||
return editForm;
|
||||
}
|
||||
|
||||
export function editList(id, formElement, formData, listLi) {
|
||||
|
||||
let newName = formData.newListName;
|
||||
|
||||
|
||||
document.querySelector(`.navbar__list[data-id='${listLi.dataset.id}'] > a`).textContent = newName;
|
||||
|
||||
listLi.querySelector(".list__name").textContent = newName;
|
||||
listLi.setAttribute("href", `/list/${id}`);
|
||||
formElement.replaceWith(listLi);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import { initErrors } from "../../shared/error.js";
|
||||
import { handleResponse } from "../../shared/helper.js";
|
||||
import { abortEditing } from "../../shared/sharedUI.js";
|
||||
import * as api from "./api/indexAPI.js";
|
||||
import * as ui from "./frontend/indexUI.js"
|
||||
|
||||
const addListForm = document.querySelector(".addListForm");
|
||||
|
||||
async function addList(listName) {
|
||||
const json = await handleResponse(api.addList(listName), `error creating list`);
|
||||
if (json) ui.addList(json);
|
||||
}
|
||||
|
||||
function editList(listLi) {
|
||||
//erstellen das Forms
|
||||
const formElement = ui.createEditListForm(listLi);
|
||||
let id = listLi.dataset.id;
|
||||
|
||||
listLi.replaceWith(formElement);
|
||||
|
||||
formElement.querySelector(".editForm__name").focus();
|
||||
|
||||
formElement.addEventListener("submit", async (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
let formData = Object.fromEntries(new FormData(formElement));
|
||||
const result = await handleResponse(api.editList(id, { newListName: formData.newListName }), `error editing list`);
|
||||
if (result) ui.editList(id, formElement, formData, listLi);
|
||||
});
|
||||
|
||||
formElement.querySelector(".editForm__abortButton").addEventListener("click", () => {
|
||||
abortEditing(formElement, listLi);
|
||||
})
|
||||
formElement.addEventListener("keydown", (e) => {
|
||||
if (e.key == "Escape") abortEditing(formElement, listLi);
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
async function deleteList(listElement) {
|
||||
const json = await handleResponse(api.deleteList(listElement.dataset.id), `error deleting list`);
|
||||
if (json) ui.deleteList(listElement);
|
||||
}
|
||||
|
||||
|
||||
function init() {
|
||||
|
||||
initErrors(document.querySelector(".nav"));
|
||||
addListForm.addEventListener("submit", (e) => {
|
||||
e.preventDefault();
|
||||
const formData = Object.fromEntries(new FormData(addListForm));
|
||||
addList(formData.listName);
|
||||
});
|
||||
|
||||
document.querySelector(".index").addEventListener("click", (event) => {
|
||||
if (event.target.matches(".list__editButton")) {
|
||||
editList(event.target.closest("li"));
|
||||
|
||||
} else if (event.target.matches(".list__deleteButton")) {
|
||||
deleteList(event.target.closest("li"));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
@@ -0,0 +1,21 @@
|
||||
export function addCategory(listID, categoryName) {
|
||||
return fetch(`/api/categories`,
|
||||
{
|
||||
method: "POST"
|
||||
, body: JSON.stringify({ "categoryName": categoryName, "listID": listID })
|
||||
, headers: { "Content-Type": "application/json" }
|
||||
});
|
||||
}
|
||||
|
||||
export function editCategory(categoryID, toChange) {
|
||||
return fetch(`/api/categories/${categoryID}`,
|
||||
{
|
||||
method: "PATCH",
|
||||
body: JSON.stringify(toChange),
|
||||
headers: { "Content-Type": "application/json" }
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteCategory(deleteAllItems, categoryID) {
|
||||
return fetch(`/api/categories/${categoryID}?deleteAllItems=${deleteAllItems}`, { method: "DELETE" });
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
export function addItem(listID, itemName, itemAmount, categoryID) {
|
||||
return fetch(`/api/items`,
|
||||
{
|
||||
method: "POST",
|
||||
body: JSON.stringify({
|
||||
"itemName": itemName,
|
||||
"itemAmount": itemAmount,
|
||||
"categoryID": categoryID,
|
||||
"listID": listID
|
||||
}),
|
||||
headers: { "Content-Type": "application/json" }
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteItem(itemID) {
|
||||
|
||||
return fetch(`/api/items/${itemID}`, { method: "DELETE" });
|
||||
|
||||
}
|
||||
|
||||
export function editItem(itemID, toChange) {
|
||||
return fetch(`/api/items/${itemID}`,
|
||||
{
|
||||
method: "PATCH",
|
||||
body: JSON.stringify(toChange),
|
||||
headers: { "Content-Type": "application/json" }
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
export function deleteAllDoneItems(listID) {
|
||||
return fetch(`/api/lists/${listID}/items?done=true`, { method: "DELETE" });
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
export * from "./itemAPI.js";
|
||||
export * from "./categoryAPI.js"
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
export function addCategory(categoryAsJSON) {
|
||||
const list = document.querySelector(".displayedList");
|
||||
const category = document.createElement("shopping-category");
|
||||
const li = document.createElement("li");
|
||||
|
||||
li.classList.add("category");
|
||||
li.dataset.id = categoryAsJSON.categoryID;
|
||||
category.setAttribute("category-name", categoryAsJSON.categoryName);
|
||||
|
||||
li.append(category); //fügt Kategorie der Liste hinzu
|
||||
|
||||
list.append(li);
|
||||
|
||||
const categorySelect = document.querySelector(".addItemForm__categorySelect");
|
||||
const newCategoryOption = document.createElement("option");
|
||||
newCategoryOption.setAttribute("value", categoryAsJSON.categoryID);
|
||||
newCategoryOption.textContent = categoryAsJSON.categoryName;
|
||||
|
||||
categorySelect.append(newCategoryOption);
|
||||
}
|
||||
|
||||
export function deleteCategory(deleteAllItems, categoryID) {
|
||||
const category = document.querySelector(`li[data-id='${categoryID}']`);
|
||||
if (!deleteAllItems) {
|
||||
const ul = category.querySelector("ul");
|
||||
if (ul) document.querySelector(".displayedList").append(...ul.children);
|
||||
}
|
||||
category.remove()
|
||||
document.querySelector(`option[value='${categoryID}']`).remove();
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
export function addItem(itemAsJSON) {
|
||||
let list;
|
||||
if (!itemAsJSON.categoryID) {
|
||||
list = document.querySelector(".displayedList");
|
||||
} else {
|
||||
list = document.querySelector(`li[data-id='${itemAsJSON.categoryID}']`).querySelector("ul");
|
||||
}
|
||||
const li = document.createElement("li");
|
||||
const item = document.createElement("shopping-item");
|
||||
|
||||
li.dataset.id = itemAsJSON.itemID;
|
||||
li.classList.add("item");
|
||||
|
||||
item.setAttribute("item-name", itemAsJSON.itemName);
|
||||
item.setAttribute("item-amount", itemAsJSON.itemAmount);
|
||||
|
||||
li.append(item);
|
||||
list.append(li);
|
||||
}
|
||||
|
||||
export function deleteItem(li) {
|
||||
li.remove();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
|
||||
export * from "./itemUI.js";
|
||||
export * from "./categoryUI.js";
|
||||
|
||||
export function deleteAllDoneItems() {
|
||||
const doneItems = document.querySelectorAll("li.item:has(shopping-item[is-checked=true])");
|
||||
doneItems.forEach((li) => {
|
||||
li.remove();
|
||||
})
|
||||
}
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
import { ShoppingCategory } from "../../models/ShoppingCategory.js";
|
||||
import { ShoppingItem } from "../../models/ShoppingItem.js";
|
||||
import { initErrors } from "../../shared/error.js";
|
||||
import * as api from "./api/listAPI.js"
|
||||
import * as ui from "./frontend/listUI.js"
|
||||
import { handleResponse } from "../../shared/helper.js";
|
||||
import { editElement } from "../../shared/editing.js";
|
||||
import * as sharedUI from "../../shared/sharedUI.js";
|
||||
|
||||
const addCategoryForm = document.querySelector(".addCategoryForm");
|
||||
const addItemForm = document.querySelector(".addItemForm");
|
||||
const currentList = document.querySelector(".list");
|
||||
const deleteAllDoneItemsButton = document.querySelector(".deleteAllDoneItemsButton");
|
||||
|
||||
async function addItem(itemName, itemAmount, categoryID) {
|
||||
console.log(` adding item with id:${currentList.dataset.id}, name: ${itemName}, amount: ${itemAmount}, category: ${categoryID}`)
|
||||
|
||||
const json = await handleResponse(api.addItem(currentList.dataset.id, itemName, itemAmount, categoryID), `item couldnt be created!`);
|
||||
if (json) ui.addItem(json);
|
||||
}
|
||||
|
||||
async function addCategory(categoryName) {
|
||||
console.log(`adding category ${categoryName}`)
|
||||
|
||||
const json = await handleResponse(api.addCategory(currentList.dataset.id, categoryName), `category couldnt be added!`);
|
||||
if (json) ui.addCategory(json);
|
||||
|
||||
}
|
||||
|
||||
async function deleteItem(li) {
|
||||
console.log(`deleting item ${li.dataset.id}`)
|
||||
|
||||
const json = await handleResponse(api.deleteItem(li.dataset.id), `error deleting item`);
|
||||
if (json) ui.deleteItem(li);
|
||||
}
|
||||
|
||||
async function deleteCategory(deleteAllItems, categoryID) {
|
||||
console.log(`deleting category with allItems: ${deleteAllItems} id: ${categoryID}`);
|
||||
const json = await handleResponse(api.deleteCategory(deleteAllItems, categoryID), `error deleting category`);
|
||||
|
||||
if (json) ui.deleteCategory(deleteAllItems, categoryID);
|
||||
}
|
||||
|
||||
async function deleteAllDoneItems() {
|
||||
console.log(`deleting all done items...`)
|
||||
const json = await handleResponse(api.deleteAllDoneItems(currentList.dataset.id), `error deleting all done items`);
|
||||
if (json) ui.deleteAllDoneItems();
|
||||
}
|
||||
|
||||
function init() {
|
||||
|
||||
initErrors(document.querySelector(".nav"));
|
||||
|
||||
customElements.define("shopping-item", ShoppingItem);
|
||||
customElements.define("shopping-category", ShoppingCategory);
|
||||
|
||||
addCategoryForm.addEventListener("submit", (event) => {
|
||||
event.preventDefault();
|
||||
let formData = Object.fromEntries(new FormData(addCategoryForm));
|
||||
addCategory(formData.categoryName);
|
||||
});
|
||||
|
||||
addItemForm.addEventListener("submit", event => {
|
||||
event.preventDefault();
|
||||
let formData = Object.fromEntries(new FormData(addItemForm));
|
||||
addItem(formData.itemName, formData.itemAmount, formData.itemCategoryID);
|
||||
});
|
||||
|
||||
deleteAllDoneItemsButton.addEventListener("click", event => {
|
||||
deleteAllDoneItems();
|
||||
});
|
||||
|
||||
//event delegation ist schon geil
|
||||
document.querySelector(".displayedList").addEventListener("click", (event) => {
|
||||
if (event.target.matches(".item__buttonDeleteItem")) {
|
||||
deleteItem(event.target.closest("li"));
|
||||
|
||||
} else if (event.target.matches(".category__deleteButton")) {
|
||||
|
||||
const li = event.target.closest("li");
|
||||
const checkbox = li.querySelector("input[type=checkbox]");
|
||||
deleteCategory(checkbox.checked, li.dataset.id);
|
||||
|
||||
} else if (event.target.closest(".item__text")) {
|
||||
|
||||
const shoppingItemElement = event.target.closest("shopping-item");
|
||||
const id = event.target.closest("li").dataset.id;
|
||||
|
||||
let itemName = shoppingItemElement.querySelector(".item__itemName").textContent;
|
||||
let itemAmount = shoppingItemElement.querySelector(".item__itemAmount").textContent;
|
||||
/*
|
||||
* { name: "", value: "", class: "", attr: ""}
|
||||
*/
|
||||
|
||||
editElement({
|
||||
element: shoppingItemElement, apiCall: api.editItem, id: id,
|
||||
fields: [
|
||||
{ name: "itemName", value: itemName, class: "editForm__name", attr: "item-name" },
|
||||
{ name: "itemAmount", value: itemAmount, class: "editForm__amount", attr: "item-amount" }
|
||||
]
|
||||
, onSuccess: (f) => { sharedUI.setElementAttributes(shoppingItemElement, { "item-name": f.itemName, "item-amount": f.itemAmount }) }
|
||||
, errmsg: `konnte Item nicht bearbeiten`
|
||||
});
|
||||
|
||||
} else if (event.target.closest(".category__name")) {
|
||||
|
||||
const categoryElement = event.target.closest("shopping-category");
|
||||
const categoryHeader = event.target.closest(".category__header");
|
||||
const id = event.target.closest("li").dataset.id;
|
||||
|
||||
let categoryName = categoryElement.querySelector(".category__name").textContent;
|
||||
|
||||
editElement({
|
||||
element: categoryHeader, apiCall: api.editCategory, id: id,
|
||||
fields: [
|
||||
{ name: "categoryName", value: categoryName, class: "editForm__name", attr: "category-name" },
|
||||
]
|
||||
, onSuccess: (f) => {
|
||||
sharedUI.setElementAttributes(categoryElement, { "category-name": f.categoryName })
|
||||
document.querySelector(`option[value='${id}']`).textContent = f.categoryName;
|
||||
}
|
||||
, errmsg: `konnte Kategorie nicht bearbeiten`
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
document.querySelector(".displayedList").addEventListener("change", (e) => {
|
||||
if (e.target.matches(".item__checkboxDone")) {
|
||||
const item = e.target.closest("li");
|
||||
e.target.closest("shopping-item").setAttribute("is-checked", e.target.checked);
|
||||
api.editItem(item.dataset.id, { isDone: e.target.checked });
|
||||
}
|
||||
});
|
||||
|
||||
console.log("javascript initialized!");
|
||||
}
|
||||
|
||||
|
||||
|
||||
document.addEventListener('DOMContentLoaded', init);
|
||||
@@ -0,0 +1,29 @@
|
||||
import { abortEditing, createEditForm } from "./sharedUI.js";
|
||||
import { handleResponse } from "./helper.js";
|
||||
|
||||
export async function editElement({ element, fields, apiCall, id, onSuccess, errmsg }) {
|
||||
const formElement = createEditForm(fields);
|
||||
|
||||
element.replaceWith(formElement);
|
||||
|
||||
formElement.querySelector("input").focus();
|
||||
|
||||
formElement.addEventListener("submit", async (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
let formData = Object.fromEntries(new FormData(formElement));
|
||||
let result = await handleResponse(apiCall(id, formData), errmsg);
|
||||
|
||||
abortEditing(formElement, element);
|
||||
|
||||
if (result) onSuccess(formData);
|
||||
});
|
||||
|
||||
formElement.addEventListener("click", (e) => {
|
||||
if (e.target.matches(".editForm__buttonAbort")) abortEditing(formElement, element);
|
||||
})
|
||||
|
||||
formElement.addEventListener("keydown", (e) => {
|
||||
if (e.key == "Escape") abortEditing(formElement, element);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
const errorDiv = document.createElement("div");
|
||||
const errorSpan = document.createElement("span");
|
||||
let errorTimer;
|
||||
|
||||
export function showError(msg) {
|
||||
errorSpan.textContent = msg;
|
||||
errorDiv.hidden = false
|
||||
|
||||
clearTimeout(errorTimer);
|
||||
errorTimer = (setTimeout(() => {
|
||||
errorDiv.hidden = true;
|
||||
errorSpan.textContent = "";
|
||||
}, 3000));
|
||||
}
|
||||
|
||||
|
||||
export function initErrors(element) {
|
||||
errorDiv.hidden = true;
|
||||
errorDiv.append(errorSpan);
|
||||
|
||||
element.append(errorDiv);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { showError } from "./error.js";
|
||||
|
||||
export async function handleResponse(promise, errorMsg) {
|
||||
const response = await promise;
|
||||
|
||||
//weil 204 kein body ist un damit unparsbar, geben wir vorab true zurück
|
||||
if (response.status == 204) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const json = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
showError(json.msg);
|
||||
console.error(errorMsg);
|
||||
return false;
|
||||
}
|
||||
|
||||
return json;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
export function abortEditing(formElement, old) {
|
||||
formElement.replaceWith(old);
|
||||
}
|
||||
|
||||
export function createEditForm(fields) {
|
||||
const editForm = document.createElement("form");
|
||||
const abortButton = document.createElement("button");
|
||||
const saveButton = document.createElement("button");
|
||||
|
||||
const inputs = fields.map(f => {
|
||||
const input = document.createElement("input");
|
||||
input.setAttribute("name", f.name);
|
||||
input.setAttribute("value", f.value);
|
||||
input.classList.add(f.class);
|
||||
return input;
|
||||
});
|
||||
|
||||
abortButton.setAttribute("type", "button");
|
||||
abortButton.classList.add("editForm__buttonAbort");
|
||||
abortButton.textContent = "Abbrechen";
|
||||
|
||||
saveButton.textContent = "Speichern";
|
||||
saveButton.classList.add("editForm__buttonSave");
|
||||
saveButton.setAttribute("type", "submit");
|
||||
|
||||
|
||||
editForm.append(...inputs, saveButton, abortButton);
|
||||
|
||||
return editForm;
|
||||
}
|
||||
|
||||
export function setElementAttributes(element, attributes) {
|
||||
|
||||
for (const [attr, val] of Object.entries(attributes)) element.setAttribute(attr, val);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:th="http://www.thymeleaf.org">
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||
<meta name="description" content="" />
|
||||
<meta name="author" content="" />
|
||||
<link href="/css/base.css" rel="stylesheet">
|
||||
<link href="/css/index.css" rel="stylesheet" >
|
||||
<script src="/js/pages/index/index.js" type="module"></script>
|
||||
|
||||
<body>
|
||||
|
||||
<nav class="nav">
|
||||
<ul class="nav__links">
|
||||
<li class="nav__link"><a href="/">Alle Einkaufslisten</a></li>
|
||||
<li class="nav__dropdown">Listen >
|
||||
<ul class="nav__dropdownMenu">
|
||||
<li th:each="list : ${lists}" th:data-id="${list.id}" class="navbar__list">
|
||||
<a th:text="${list.listName}" th:href="@{/list/{id}(id=${list.id})}"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="index">
|
||||
<form class="addListForm">
|
||||
<input type="text" name="listName" required />
|
||||
<button type="submit">Neue Liste erstellen</button>
|
||||
</form>
|
||||
|
||||
<ul class="displayedList">
|
||||
<li th:each="list : ${lists}" class="list" th:data-id="${list.id}">
|
||||
<a class="list__name" th:text="${list.listName}" th:href="@{/list/{id}(id=${list.id})}"></a>
|
||||
<button type="button" class="list__editButton">Liste bearbeiten</button>
|
||||
<button type="button" class="list__deleteButton">Liste löschen</button>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Einkaufsliste</title>
|
||||
<link href="/css/base.css" rel="stylesheet">
|
||||
<link href="/css/list.css" rel="stylesheet">
|
||||
<script src="/js/pages/list/list.js" type="module"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="nav">
|
||||
<ul class="nav__links">
|
||||
<li class="nav__link"><a href="/">Alle Einkaufslisten</a></li>
|
||||
<li class="nav__dropdown">Listen >
|
||||
<ul class="nav__dropdownMenu">
|
||||
<li th:each="list : ${lists}" th:data-id="${list.id}" class="navbar__list">
|
||||
<a th:text="${list.listName}" th:href="@{/list/{id}(id=${list.id})}"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<div class="title">
|
||||
<h1 th:text="${list.listName}"></h1>
|
||||
</div>
|
||||
|
||||
<div class="list" th:data-id="${list.id}">
|
||||
<form class="addCategoryForm">
|
||||
<span>Neue Kategorie hinzufügen:</span>
|
||||
<input type="text" class="addCategoryForm__nameInput" name="categoryName" placeholder="Neue Kategorie hinzufügen...">
|
||||
<button class="addCategoryForm__submitButton" type="submit">Hinzufügen</button>
|
||||
</form>
|
||||
|
||||
<br>
|
||||
|
||||
<form class="addItemForm">
|
||||
<span>Neuen Gegenstand hinzufügen:</span>
|
||||
<input type="text" class="addItemForm__nameInput" name="itemName" placeholder="Gegenstand eingeben...">
|
||||
<input type="text" class="addItemForm__amountInput" name="itemAmount" placeholder="Menge eingeben...">
|
||||
<select class="addItemForm__categorySelect" name="itemCategoryID">
|
||||
<option value="">Keine</option>
|
||||
<option th:each="category : ${categories}" th:text="${category.categoryName}" th:value="${category.id}"></option>
|
||||
</select>
|
||||
<button class="addItemForm__submitButton" type="submit">Hinzufügen</button>
|
||||
</form>
|
||||
|
||||
<button class="deleteAllDoneItemsButton">Alle fertigen Items löschen</button>
|
||||
|
||||
|
||||
<ul class="displayedList">
|
||||
<!-- Es werden erste alle Kategorien erstellt, jede Kategorie muss ein ul in einem li sein um Verschachtelung zu ermöglichen -->
|
||||
<li th:each="category: ${categories}" th:data-id="${category.id}" class="category">
|
||||
<shopping-category th:attr="category-name=${category.categoryName}">
|
||||
<ul>
|
||||
<li th:each="item: ${category.itemsInCategory}" th:data-id="${item.id}" class="item">
|
||||
<shopping-item th:attr="item-name=${item.itemName}, item-amount=${item.itemAmount}, is-checked=${item.isDone}"></shopping-item>
|
||||
</li>
|
||||
</ul>
|
||||
</shopping-category>
|
||||
</li>
|
||||
|
||||
<li th:each="item: ${items}" th:data-id="${item.id}" class="item"> <!-- erstellung items ohne Kategorie -->
|
||||
<shopping-item th:attr="item-name=${item.itemName}, item-amount=${item.itemAmount}, is-checked=${item.isDone}"></shopping-item>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
li:has(input:checked){
|
||||
text-decoration: line-through;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package de.timaldinger.einkaufsliste;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class EinkaufslisteApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user