From 70da3a9399d3385b53f7831beb08f716b972860d Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 1 Oct 2025 19:34:37 -0400 Subject: wip: zen --- packages/console/app/src/context/auth.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'packages/console/app/src/context') diff --git a/packages/console/app/src/context/auth.ts b/packages/console/app/src/context/auth.ts index 585cac3c6..7097787fb 100644 --- a/packages/console/app/src/context/auth.ts +++ b/packages/console/app/src/context/auth.ts @@ -1,5 +1,5 @@ import { getRequestEvent } from "solid-js/web" -import { and, Database, eq, inArray } from "@opencode/console-core/drizzle/index.js" +import { and, Database, eq, inArray, sql } from "@opencode/console-core/drizzle/index.js" import { WorkspaceTable } from "@opencode/console-core/schema/workspace.sql.js" import { UserTable } from "@opencode/console-core/schema/user.sql.js" import { redirect } from "@solidjs/router" @@ -54,8 +54,8 @@ export const getActor = async (workspace?: string): Promise => { } const accounts = Object.keys(auth.data.account ?? {}) if (accounts.length) { - const result = await Database.transaction(async (tx) => { - return await tx + const result = await Database.use((tx) => + tx .select({ user: UserTable, }) @@ -65,9 +65,15 @@ export const getActor = async (workspace?: string): Promise => { .where(and(inArray(AccountTable.id, accounts), eq(WorkspaceTable.id, workspace))) .limit(1) .execute() - .then((x) => x[0]) - }) + .then((x) => x[0]), + ) if (result) { + await Database.use((tx) => + tx + .update(UserTable) + .set({ timeSeen: sql`now()` }) + .where(eq(UserTable.id, result.user.id)), + ) return { type: "user", properties: { -- cgit v1.2.3