summaryrefslogtreecommitdiffhomepage
path: root/packages/console/app/src/routes/auth
diff options
context:
space:
mode:
authorFrank <[email protected]>2025-10-06 16:15:10 -0400
committerFrank <[email protected]>2025-10-06 17:13:19 -0400
commit9e8fd16e6e4154ae0bccff8342e4b0c7780d8db8 (patch)
treec9f936bfcaf7cf7f275334e869738c87989a2362 /packages/console/app/src/routes/auth
parent1b17d8070bcddeddaea3dea403f031a161539901 (diff)
downloadopencode-9e8fd16e6e4154ae0bccff8342e4b0c7780d8db8.tar.gz
opencode-9e8fd16e6e4154ae0bccff8342e4b0c7780d8db8.zip
wip: zen
Diffstat (limited to 'packages/console/app/src/routes/auth')
-rw-r--r--packages/console/app/src/routes/auth/index.ts22
1 files changed, 20 insertions, 2 deletions
diff --git a/packages/console/app/src/routes/auth/index.ts b/packages/console/app/src/routes/auth/index.ts
index 59d172386..f522e761d 100644
--- a/packages/console/app/src/routes/auth/index.ts
+++ b/packages/console/app/src/routes/auth/index.ts
@@ -1,11 +1,29 @@
-import { Account } from "@opencode-ai/console-core/account.js"
+import { Actor } from "@opencode-ai/console-core/actor.js"
+import { and, Database, eq, isNull } from "@opencode-ai/console-core/drizzle/index.js"
+import { UserTable } from "@opencode-ai/console-core/schema/user.sql.js"
+import { WorkspaceTable } from "@opencode-ai/console-core/schema/workspace.sql.js"
import { redirect } from "@solidjs/router"
import type { APIEvent } from "@solidjs/start/server"
import { withActor } from "~/context/auth.withActor"
export async function GET(input: APIEvent) {
try {
- const workspaces = await withActor(async () => Account.workspaces())
+ const workspaces = await withActor(async () => {
+ const actor = Actor.assert("account")
+ return Database.transaction(async (tx) =>
+ tx
+ .select({ id: WorkspaceTable.id })
+ .from(UserTable)
+ .innerJoin(WorkspaceTable, eq(UserTable.workspaceID, WorkspaceTable.id))
+ .where(
+ and(
+ eq(UserTable.accountID, actor.properties.accountID),
+ isNull(UserTable.timeDeleted),
+ isNull(WorkspaceTable.timeDeleted),
+ ),
+ ),
+ )
+ })
return redirect(`/workspace/${workspaces[0].id}`)
} catch {
return redirect("/auth/authorize")