mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
Update lucia, super form, and flash message. Fix get game by id when no user is signed in.
This commit is contained in:
parent
e086274735
commit
af475071eb
5 changed files with 79 additions and 75 deletions
|
|
@ -49,8 +49,8 @@
|
|||
"svelte-check": "^3.5.0",
|
||||
"svelte-preprocess": "^5.0.4",
|
||||
"svelte-sequential-preprocessor": "^2.0.1",
|
||||
"sveltekit-flash-message": "^2.1.3",
|
||||
"sveltekit-superforms": "^1.5.1",
|
||||
"sveltekit-flash-message": "^2.2.0",
|
||||
"sveltekit-superforms": "^1.6.0",
|
||||
"tailwindcss": "^3.3.3",
|
||||
"ts-node": "^10.9.1",
|
||||
"tslib": "^2.6.1",
|
||||
|
|
@ -78,11 +78,11 @@
|
|||
"class-variance-authority": "^0.6.1",
|
||||
"clsx": "^1.2.1",
|
||||
"cookie": "^0.5.0",
|
||||
"feather-icons": "^4.29.0",
|
||||
"feather-icons": "^4.29.1",
|
||||
"iconify-icon": "^1.0.8",
|
||||
"just-kebab-case": "^4.2.0",
|
||||
"loader": "^2.1.1",
|
||||
"lucia": "^2.3.0",
|
||||
"lucia": "^2.4.0",
|
||||
"lucide-svelte": "^0.256.1",
|
||||
"open-props": "^1.5.11",
|
||||
"radix-svelte": "^0.8.0",
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ dependencies:
|
|||
version: 1.2.47
|
||||
'@lucia-auth/adapter-mysql':
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0(lucia@2.3.0)
|
||||
version: 2.0.0(lucia@2.4.0)
|
||||
'@lucia-auth/adapter-prisma':
|
||||
specifier: ^3.0.1
|
||||
version: 3.0.1(@prisma/client@5.1.1)(lucia@2.3.0)
|
||||
version: 3.0.1(@prisma/client@5.1.1)(lucia@2.4.0)
|
||||
'@lukeed/uuid':
|
||||
specifier: ^2.0.1
|
||||
version: 2.0.1
|
||||
|
|
@ -45,8 +45,8 @@ dependencies:
|
|||
specifier: ^0.5.0
|
||||
version: 0.5.0
|
||||
feather-icons:
|
||||
specifier: ^4.29.0
|
||||
version: 4.29.0
|
||||
specifier: ^4.29.1
|
||||
version: 4.29.1
|
||||
iconify-icon:
|
||||
specifier: ^1.0.8
|
||||
version: 1.0.8
|
||||
|
|
@ -57,8 +57,8 @@ dependencies:
|
|||
specifier: ^2.1.1
|
||||
version: 2.1.1
|
||||
lucia:
|
||||
specifier: ^2.3.0
|
||||
version: 2.3.0
|
||||
specifier: ^2.4.0
|
||||
version: 2.4.0
|
||||
lucide-svelte:
|
||||
specifier: ^0.256.1
|
||||
version: 0.256.1(svelte@4.2.0)
|
||||
|
|
@ -173,11 +173,11 @@ devDependencies:
|
|||
specifier: ^2.0.1
|
||||
version: 2.0.1
|
||||
sveltekit-flash-message:
|
||||
specifier: ^2.1.3
|
||||
version: 2.1.3(@sveltejs/kit@1.22.6)(svelte@4.2.0)
|
||||
specifier: ^2.2.0
|
||||
version: 2.2.0(@sveltejs/kit@1.22.6)(svelte@4.2.0)
|
||||
sveltekit-superforms:
|
||||
specifier: ^1.5.1
|
||||
version: 1.5.1(@sveltejs/kit@1.22.6)(svelte@4.2.0)(zod@3.21.4)
|
||||
specifier: ^1.6.0
|
||||
version: 1.6.0(@sveltejs/kit@1.22.6)(svelte@4.2.0)(zod@3.21.4)
|
||||
tailwindcss:
|
||||
specifier: ^3.3.3
|
||||
version: 3.3.3(ts-node@10.9.1)
|
||||
|
|
@ -1168,7 +1168,7 @@ packages:
|
|||
'@jridgewell/resolve-uri': 3.1.0
|
||||
'@jridgewell/sourcemap-codec': 1.4.15
|
||||
|
||||
/@lucia-auth/adapter-mysql@2.0.0(lucia@2.3.0):
|
||||
/@lucia-auth/adapter-mysql@2.0.0(lucia@2.4.0):
|
||||
resolution: {integrity: sha512-8a4JZ3VjDyRu/mAop2hEt/jOJO2HXwWIAid6a4wGiR8wgnlyOws9brRc+/wxQHSOlWUlrWemrfDvXLs5mMtkeQ==}
|
||||
peerDependencies:
|
||||
'@planetscale/database': ^1.0.0
|
||||
|
|
@ -1180,17 +1180,17 @@ packages:
|
|||
mysql2:
|
||||
optional: true
|
||||
dependencies:
|
||||
lucia: 2.3.0
|
||||
lucia: 2.4.0
|
||||
dev: false
|
||||
|
||||
/@lucia-auth/adapter-prisma@3.0.1(@prisma/client@5.1.1)(lucia@2.3.0):
|
||||
/@lucia-auth/adapter-prisma@3.0.1(@prisma/client@5.1.1)(lucia@2.4.0):
|
||||
resolution: {integrity: sha512-JZNl+721M5ApjtNiH+WUYstiC8cffcI/Y9IzKsa0uUhQMIHl2ObCrgO0R3fgHnjWHBjhQoK36g/r/iSJIDppBA==}
|
||||
peerDependencies:
|
||||
'@prisma/client': ^4.2.0 || ^5.0.0
|
||||
lucia: ^2.0.0
|
||||
dependencies:
|
||||
'@prisma/client': 5.1.1(prisma@5.1.1)
|
||||
lucia: 2.3.0
|
||||
lucia: 2.4.0
|
||||
dev: false
|
||||
|
||||
/@lukeed/csprng@1.1.0:
|
||||
|
|
@ -2359,8 +2359,8 @@ packages:
|
|||
dependencies:
|
||||
reusify: 1.0.4
|
||||
|
||||
/feather-icons@4.29.0:
|
||||
resolution: {integrity: sha512-Y7VqN9FYb8KdaSF0qD1081HCkm0v4Eq/fpfQYQnubpqi0hXx14k+gF9iqtRys1SIcTEi97xDi/fmsPFZ8xo0GQ==}
|
||||
/feather-icons@4.29.1:
|
||||
resolution: {integrity: sha512-P1we61haGTds6lKWe6CCVPsNULb8tHr1y6S9gXEpU+lNR1Ja7GdV0A1l2hTNmzXv+0Stix/3YMWMAn7n1Qtd6A==}
|
||||
dependencies:
|
||||
classnames: 2.3.2
|
||||
core-js: 3.26.1
|
||||
|
|
@ -2760,8 +2760,8 @@ packages:
|
|||
yallist: 4.0.0
|
||||
dev: true
|
||||
|
||||
/lucia@2.3.0:
|
||||
resolution: {integrity: sha512-FS+WjvTh8xK/N2I5PBQ9xhF5+OJZo1g2w931ZlaJoXSRxsM1WTkMRAyxFAE3Azoe9vHqlKxRsw11ZiSv+yc3rA==}
|
||||
/lucia@2.4.0:
|
||||
resolution: {integrity: sha512-v2pyFQVF734+EU3m9GeeJQorFR7zLt7JoOJ1UD5ttR5Z+w4IkOyExiXyFe+zssKpony66u94wcxyws3lZSpzzg==}
|
||||
dev: false
|
||||
|
||||
/lucide-svelte@0.256.1(svelte@4.2.0):
|
||||
|
|
@ -3992,8 +3992,8 @@ packages:
|
|||
magic-string: 0.30.0
|
||||
periscopic: 3.1.0
|
||||
|
||||
/sveltekit-flash-message@2.1.3(@sveltejs/kit@1.22.6)(svelte@4.2.0):
|
||||
resolution: {integrity: sha512-NFhQ3t2101AM9JO5Mgj38r69ykF4BOs1Ap3567DaM1RoAaNtXRXpAuEc/DQV78HZN/Fxzw8dxyTMdIC1HztUvA==}
|
||||
/sveltekit-flash-message@2.2.0(@sveltejs/kit@1.22.6)(svelte@4.2.0):
|
||||
resolution: {integrity: sha512-22hYvD4kQUWJevbiJQkRNIWtEexKyKYhN4zyn8YhfU6J2hRY1uFdTTfH0JIWwPkJ/QarBgLwzP79GO5t/LLZUw==}
|
||||
peerDependencies:
|
||||
'@sveltejs/kit': 1.x
|
||||
svelte: 3.x || 4.x
|
||||
|
|
@ -4002,8 +4002,8 @@ packages:
|
|||
svelte: 4.2.0
|
||||
dev: true
|
||||
|
||||
/sveltekit-superforms@1.5.1(@sveltejs/kit@1.22.6)(svelte@4.2.0)(zod@3.21.4):
|
||||
resolution: {integrity: sha512-OqKzxuL1P29CFiK1CD00JRsvEsRPedvrR0qXmB4uqzXAIjOS+DpLjoEaa6Cnkd4H00fRa2161GcZNeEBue/D3A==}
|
||||
/sveltekit-superforms@1.6.0(@sveltejs/kit@1.22.6)(svelte@4.2.0)(zod@3.21.4):
|
||||
resolution: {integrity: sha512-Ob3vbgPuVMFuebD8R7qWHDyMVmHvbU6HYqa/ozuV9HbETkkkX7XhyDz/yMxW4q8T2kRiO50CASskiB3l6yKiqA==}
|
||||
peerDependencies:
|
||||
'@sveltejs/kit': 1.x
|
||||
svelte: 3.x || 4.x
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@
|
|||
<SuperDebug data={$form} />
|
||||
{/if}
|
||||
|
||||
<form id="search-form" action="/search" method="GET" use:enhance>
|
||||
<form id="search-form" action="/search" method="GET">
|
||||
<div class="search">
|
||||
<fieldset class="text-search" aria-busy={submitting} disabled={submitting}>
|
||||
<Label for="label">Search</Label>
|
||||
|
|
|
|||
|
|
@ -14,6 +14,34 @@ export const GET = async ({ url, locals, params, request }) => {
|
|||
// return error(500, { message: 'Something went wrong' });
|
||||
// }
|
||||
|
||||
// let games = await prisma.game.findMany({
|
||||
// where: {
|
||||
// name: {
|
||||
// search: urlQueryParams?.name
|
||||
// },
|
||||
// min_players: {
|
||||
// gte: urlQueryParams?.min_players || 0
|
||||
// },
|
||||
// max_players: {
|
||||
// lte: urlQueryParams?.max_players || 100
|
||||
// },
|
||||
// min_playtime: {
|
||||
// gte: urlQueryParams?.min_playtime || 0
|
||||
// },
|
||||
// max_playtime: {
|
||||
// lte: urlQueryParams?.max_playtime || 5000
|
||||
// },
|
||||
// min_age: {
|
||||
// gte: urlQueryParams?.min_age || 0
|
||||
// }
|
||||
// },
|
||||
// skip: urlQueryParams?.skip,
|
||||
// take: urlQueryParams?.limit,
|
||||
// orderBy: {
|
||||
// name: 'asc'
|
||||
// }
|
||||
// });
|
||||
|
||||
const searchParams = Object.fromEntries(url.searchParams);
|
||||
const q = searchParams?.q || '';
|
||||
const limit = parseInt(searchParams?.limit) || 10;
|
||||
|
|
@ -56,31 +84,3 @@ export const GET = async ({ url, locals, params, request }) => {
|
|||
throw error(500, { message: 'Something went wrong' });
|
||||
}
|
||||
};
|
||||
|
||||
// let games = await prisma.game.findMany({
|
||||
// where: {
|
||||
// name: {
|
||||
// search: urlQueryParams?.name
|
||||
// },
|
||||
// min_players: {
|
||||
// gte: urlQueryParams?.min_players || 0
|
||||
// },
|
||||
// max_players: {
|
||||
// lte: urlQueryParams?.max_players || 100
|
||||
// },
|
||||
// min_playtime: {
|
||||
// gte: urlQueryParams?.min_playtime || 0
|
||||
// },
|
||||
// max_playtime: {
|
||||
// lte: urlQueryParams?.max_playtime || 5000
|
||||
// },
|
||||
// min_age: {
|
||||
// gte: urlQueryParams?.min_age || 0
|
||||
// }
|
||||
// },
|
||||
// skip: urlQueryParams?.skip,
|
||||
// take: urlQueryParams?.limit,
|
||||
// orderBy: {
|
||||
// name: 'asc'
|
||||
// }
|
||||
// });
|
||||
|
|
|
|||
|
|
@ -17,31 +17,35 @@ export const load = async ({ params, setHeaders, locals }) => {
|
|||
throw error(404, 'not found');
|
||||
}
|
||||
|
||||
const wishlist = await prisma.wishlist.findUnique({
|
||||
where: {
|
||||
user_id: user.userId
|
||||
},
|
||||
include: {
|
||||
items: {
|
||||
where: {
|
||||
game_id: game.id
|
||||
let wishlist;
|
||||
let collection;
|
||||
if (user) {
|
||||
wishlist = await prisma.wishlist.findUnique({
|
||||
where: {
|
||||
user_id: user.userId
|
||||
},
|
||||
include: {
|
||||
items: {
|
||||
where: {
|
||||
game_id: game.id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
const collection = await prisma.collection.findUnique({
|
||||
where: {
|
||||
user_id: user.userId
|
||||
},
|
||||
include: {
|
||||
items: {
|
||||
where: {
|
||||
game_id: game.id
|
||||
collection = await prisma.collection.findUnique({
|
||||
where: {
|
||||
user_id: user.userId
|
||||
},
|
||||
include: {
|
||||
items: {
|
||||
where: {
|
||||
game_id: game.id
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
game,
|
||||
|
|
|
|||
Loading…
Reference in a new issue