diff --git a/src/routes/(app)/(protected)/collections/[id]/+page.server.ts b/src/routes/(app)/(protected)/collections/[id]/+page.server.ts
index 18b376d..579c1e2 100644
--- a/src/routes/(app)/(protected)/collections/[id]/+page.server.ts
+++ b/src/routes/(app)/(protected)/collections/[id]/+page.server.ts
@@ -6,7 +6,7 @@ import { redirect } from 'sveltekit-flash-message/server';
import { modifyListGameSchema } from '$lib/validations/zod-schemas';
import db from '$lib/drizzle.js';
import { notSignedInMessage } from '$lib/flashMessages.js';
-import { games, wishlist_items, wishlists } from '../../../../schema.js';
+import { games, wishlist_items, wishlists } from '../../../../../schema.js';
export async function load(event) {
const { params, locals } = event;
@@ -18,7 +18,7 @@ export async function load(event) {
try {
const wishlist = await db.query.wishlists.findFirst({
- where: eq(wishlists.user_id, locals.user.id)
+ where: eq(wishlists.user_id, locals.user.id),
});
if (!wishlist) {
@@ -32,16 +32,16 @@ export async function load(event) {
columns: {
id: true,
name: true,
- thumb_url: true
- }
- }
- }
+ thumb_url: true,
+ },
+ },
+ },
});
console.log('wishlist', wishlist);
return {
- items
+ items,
};
} catch (e) {
console.error(e);
@@ -61,7 +61,7 @@ export const actions: Actions = {
}
const game = await db.query.games.findFirst({
- where: eq(games.id, form.data.id)
+ where: eq(games.id, form.data.id),
});
if (!game) {
@@ -76,7 +76,7 @@ export const actions: Actions = {
if (game) {
const wishlist = await db.query.wishlists.findFirst({
- where: eq(wishlists.user_id, locals.user.id)
+ where: eq(wishlists.user_id, locals.user.id),
});
if (!wishlist) {
@@ -85,13 +85,13 @@ export const actions: Actions = {
}
await db.insert(wishlist_items).values({
- game_id: game.id,
- wishlist_id: wishlist.id
+ game_id: game.id,
+ wishlist_id: wishlist.id,
});
}
return {
- form
+ form,
};
} catch (e) {
console.error(e);
@@ -124,7 +124,7 @@ export const actions: Actions = {
}
const game = await db.query.games.findFirst({
- where: eq(games.id, form.data.id)
+ where: eq(games.id, form.data.id),
});
if (!game) {
@@ -139,7 +139,7 @@ export const actions: Actions = {
if (game) {
const wishlist = await db.query.wishlists.findFirst({
- where: eq(wishlists.user_id, locals.user.id)
+ where: eq(wishlists.user_id, locals.user.id),
});
if (!wishlist) {
@@ -147,18 +147,19 @@ export const actions: Actions = {
return error(404, 'Wishlist not found');
}
- await db.delete(wishlist_items).where(and(
- eq(wishlist_items.wishlist_id, wishlist.id),
- eq(wishlist_items.game_id, game.id)
- ));
+ await db
+ .delete(wishlist_items)
+ .where(
+ and(eq(wishlist_items.wishlist_id, wishlist.id), eq(wishlist_items.game_id, game.id)),
+ );
}
return {
- form
+ form,
};
} catch (e) {
console.error(e);
return error(500, 'Something went wrong');
}
- }
+ },
};
diff --git a/src/routes/(app)/(protected)/collections/[id]/+page.svelte b/src/routes/(app)/(protected)/collections/[id]/+page.svelte
index e69de29..063f830 100644
--- a/src/routes/(app)/(protected)/collections/[id]/+page.svelte
+++ b/src/routes/(app)/(protected)/collections/[id]/+page.svelte
@@ -0,0 +1,86 @@
+
+
+