From 8aa8be7e9fe3b33b128dd8553c87036ae91da0a0 Mon Sep 17 00:00:00 2001 From: Pascal Syma Date: Mon, 4 Aug 2025 19:34:50 +0200 Subject: [PATCH] Remember uploaded images --- TODO.md | 14 +- app/components/ClickableImage.vue | 49 +++ app/layouts/default.vue | 2 + app/middleware/auth.ts | 4 +- .../hunt/[huntSlug]/[questSlug]/index.vue | 31 +- app/pages/hunt/[huntSlug]/index.vue | 27 +- app/pages/index.vue | 19 +- app/pages/profile.vue | 11 + docker-compose.yml | 2 - .../migration.sql | 15 + .../migration.sql | 40 ++ .../migration.sql | 18 + .../migration.sql | 12 + .../migration.sql | 9 + prisma/schema.prisma | 66 +++- prisma/seed/hunt.ts | 355 ++++++++++-------- server/api/home.get.ts | 10 + server/api/hunt/[huntId]/index.get.ts | 23 +- server/api/quest/[questId]/index.get.ts | 18 +- server/api/quest/[questId]/submit.post.ts | 87 +++-- shared/utils/error.ts | 2 +- 21 files changed, 573 insertions(+), 241 deletions(-) create mode 100644 app/components/ClickableImage.vue create mode 100644 app/pages/profile.vue create mode 100644 prisma/migrations/20250804155319_change_auth_to_password/migration.sql create mode 100644 prisma/migrations/20250804160026_remember_uploaded_images/migration.sql create mode 100644 prisma/migrations/20250804160243_allow_uploading_images_to_hunt_and_quest/migration.sql create mode 100644 prisma/migrations/20250804160732_add_link_to_file/migration.sql create mode 100644 prisma/migrations/20250804170804_rename_reveal_on_hunt/migration.sql diff --git a/TODO.md b/TODO.md index 5f73eb2..95b50e3 100644 --- a/TODO.md +++ b/TODO.md @@ -9,13 +9,13 @@ - [ ] View best Answers and Pictures - [ ] All/Best Images gallery - **Hunt User** - - [ ] Create Team - - [ ] Invite Members - - [ ] Join Hunt - - [ ] Answer with text and image - - [ ] Change/Update Answer and image - - [ ] View Answers of other members, check for collisions! - - [ ] View own reviews and score + - [x] Create Team + - [x] Invite Members + - [x] Join Hunt + - [x] Answer with text and image + - [x] Change/Update Answer and image + - [x] View Answers of other members, check for collisions! + - [x] View own reviews and score - **Nice to have** - **Auth** - [ ] Login with LDAP diff --git a/app/components/ClickableImage.vue b/app/components/ClickableImage.vue new file mode 100644 index 0000000..f42288f --- /dev/null +++ b/app/components/ClickableImage.vue @@ -0,0 +1,49 @@ + + + + + diff --git a/app/layouts/default.vue b/app/layouts/default.vue index 597164a..54a2017 100644 --- a/app/layouts/default.vue +++ b/app/layouts/default.vue @@ -90,6 +90,8 @@ const slugs = computed(() => checkSlug(route.params)); diff --git a/app/middleware/auth.ts b/app/middleware/auth.ts index cc6a550..2f4faae 100644 --- a/app/middleware/auth.ts +++ b/app/middleware/auth.ts @@ -1,8 +1,8 @@ -export default defineNuxtRouteMiddleware(() => { +export default defineNuxtRouteMiddleware((to) => { const { loggedIn } = useUserSession(); if (!loggedIn.value) { const localePath = useLocalePath(); - return navigateTo(localePath('/login')); + return navigateTo(localePath(`/login?to=${to.path}`)); } }); diff --git a/app/pages/hunt/[huntSlug]/[questSlug]/index.vue b/app/pages/hunt/[huntSlug]/[questSlug]/index.vue index fe61cc8..d8b0df7 100644 --- a/app/pages/hunt/[huntSlug]/[questSlug]/index.vue +++ b/app/pages/hunt/[huntSlug]/[questSlug]/index.vue @@ -1,6 +1,11 @@ diff --git a/app/pages/hunt/[huntSlug]/index.vue b/app/pages/hunt/[huntSlug]/index.vue index 3f1402a..0b1787b 100644 --- a/app/pages/hunt/[huntSlug]/index.vue +++ b/app/pages/hunt/[huntSlug]/index.vue @@ -11,7 +11,7 @@ const { name, id } = app.$slugData.huntSlug!; const titleStore = useTitleStore(); -const { data, pending, refresh } = await useFetch(`/api/hunt/${id}`); +const { data, pending, refresh, error } = await useFetch(`/api/hunt/${id}`); const hideAnswers = ref(true); @@ -50,6 +50,12 @@ async function invite() {

{{ data.description }}

+

Start: {{ @@ -110,7 +116,10 @@ async function invite() { Hide answers

-
+
+ Quests not revealed yet! + Soon all {{ data._count.quests }} quests will be + revealed! + +
+ +
+

{{ $t(parseError(error)) }}

+ Back home
diff --git a/app/pages/index.vue b/app/pages/index.vue index fa8b504..40efea4 100644 --- a/app/pages/index.vue +++ b/app/pages/index.vue @@ -7,12 +7,14 @@ watch(loggedIn, () => refresh());