This commit is contained in:
2025-12-25 23:49:47 -07:00
parent 13821cbcd5
commit 0d608cf3f4
26 changed files with 7 additions and 94 deletions

View File

@@ -21,7 +21,6 @@ export const POST: APIRoute = async ({ request, locals }) => {
return new Response('Category is required', { status: 400 });
}
// Check for running entry
const runningEntry = await db.select().from(timeEntries).where(
and(
eq(timeEntries.userId, locals.user.id),
@@ -33,13 +32,11 @@ export const POST: APIRoute = async ({ request, locals }) => {
return new Response('Timer already running', { status: 400 });
}
// Get default org (first one)
const member = await db.select().from(members).where(eq(members.userId, locals.user.id)).limit(1).get();
if (!member) {
return new Response('No organization found', { status: 400 });
}
// Verify category belongs to user's organization
const category = await db.select().from(categories).where(
and(
eq(categories.id, categoryId),
@@ -64,7 +61,6 @@ export const POST: APIRoute = async ({ request, locals }) => {
description,
});
// Add tags if provided
if (tags.length > 0) {
await db.insert(timeEntryTags).values(
tags.map((tagId: string) => ({