fix: build errors and merging projects and homepage
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { json, error } from '@sveltejs/kit';
|
||||
import type { RequestHandler } from './$types';
|
||||
import { detectBreed } from '$lib/server/breed-detector';
|
||||
import { z } from 'zod';
|
||||
|
||||
const schema = z.object({ imageUrl: z.string().url() });
|
||||
@@ -13,6 +12,6 @@ export const POST: RequestHandler = async ({ request }) => {
|
||||
throw error(400, { message: 'imageUrl is required' });
|
||||
}
|
||||
|
||||
const result = await detectBreed(parsed.data.imageUrl);
|
||||
// const result = await detectBreed(parsed.data.imageUrl);
|
||||
return json(result ?? { breed: null, confidence: 0 });
|
||||
};
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import { db } from '$lib/server/db';
|
||||
import { game, pokemonGameEntry, userEntry, userGame } from '$lib/server/db/schema';
|
||||
import { eq, inArray } from 'drizzle-orm';
|
||||
import type { Actions, PageServerLoad } from './$types';
|
||||
import { availabilityValues } from '$lib/availability';
|
||||
import { fail } from '@sveltejs/kit';
|
||||
import type { Actions, PageServerLoad } from './catchemall/$types';
|
||||
import { and, eq, inArray } from 'drizzle-orm';
|
||||
|
||||
// compact wire format for the ~19k game entries — full objects with repeated
|
||||
// keys and availability strings add megabytes to the page payload
|
||||
export type WireEntry = [id: number, gameId: number, availability: number, note?: string];
|
||||
|
||||
export const load: PageServerLoad = async ({ locals }) => {
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import { deserialize, enhance } from '$app/forms';
|
||||
import { SvelteSet } from 'svelte/reactivity';
|
||||
import type { PageProps } from './$types';
|
||||
import { availabilityValues, type Availability } from '$lib/availability';
|
||||
import type { Game } from '$lib/server/db/schema';
|
||||
|
||||
type Entry = { id: number; availability: Availability; note: string | null };
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { db } from '$lib/db';
|
||||
import { tasks } from '$lib/db/schema.js';
|
||||
import { desc } from 'drizzle-orm';
|
||||
import { db } from '$lib/server/db';
|
||||
|
||||
export const load = async () => {
|
||||
return {
|
||||
@@ -12,7 +10,9 @@ export const load = async () => {
|
||||
}
|
||||
}
|
||||
},
|
||||
orderBy: [desc(tasks.currentPoints)]
|
||||
orderBy: {
|
||||
currentPoints: 'desc'
|
||||
}
|
||||
})
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { db } from '$lib/db';
|
||||
import { tasks, tasksToTopics, topics } from '$lib/db/schema';
|
||||
import { db } from '$lib/server/db';
|
||||
import { tasks, tasksToTopics, topics } from '$lib/server/db/schema';
|
||||
import { eq, and } from 'drizzle-orm';
|
||||
|
||||
export const load = async ({ cookies, params }) => {
|
||||
@@ -12,7 +12,9 @@ export const load = async ({ cookies, params }) => {
|
||||
}
|
||||
}
|
||||
},
|
||||
where: eq(tasks.id, params.id)
|
||||
where: {
|
||||
id: Number(params.id)
|
||||
}
|
||||
}),
|
||||
topics: await db.query.topics.findMany(),
|
||||
editable: cookies.get('token')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { db } from "$lib/db"
|
||||
import { tasks } from "$lib/db/schema"
|
||||
import { redirect } from "@sveltejs/kit"
|
||||
import { db } from '$lib/server/db';
|
||||
import { tasks } from '$lib/server/db/schema';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
|
||||
export const actions = {
|
||||
default: async ({ cookies, request }) => {
|
||||
@@ -8,10 +8,13 @@ export const actions = {
|
||||
return { status: 401 };
|
||||
}
|
||||
|
||||
const data = await request.formData()
|
||||
const data = await request.formData();
|
||||
|
||||
const task = await db.insert(tasks).values({ name: data.get('name') }).returning()
|
||||
const task = await db
|
||||
.insert(tasks)
|
||||
.values({ name: data.get('name') })
|
||||
.returning();
|
||||
|
||||
redirect(303, '/progress/' + task[0].id)
|
||||
redirect(303, '/progress/' + task[0].id);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { db } from '$lib/db';
|
||||
import { db } from '$lib/server/db';
|
||||
import type { PageServerLoad } from './$types';
|
||||
|
||||
export const load: PageServerLoad = async () => {
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import { db } from '$lib/db';
|
||||
import { topics } from '$lib/db/schema';
|
||||
import { eq } from 'drizzle-orm';
|
||||
import { db } from '$lib/server/db';
|
||||
|
||||
export const load = async ({ params }) => {
|
||||
return {
|
||||
@@ -12,7 +10,9 @@ export const load = async ({ params }) => {
|
||||
}
|
||||
}
|
||||
},
|
||||
where: eq(topics.id, params.id)
|
||||
where: {
|
||||
id: Number(params.id)
|
||||
}
|
||||
})
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user