diff options
| author | Frank <[email protected]> | 2025-10-01 19:34:37 -0400 |
|---|---|---|
| committer | Frank <[email protected]> | 2025-10-01 19:34:37 -0400 |
| commit | 70da3a9399d3385b53f7831beb08f716b972860d (patch) | |
| tree | 6934fafb8558d426df88ca83d043eb3ac5910dcd /packages/console/app/src/context | |
| parent | 1024537b471c341581826b39c360d34d6c32404f (diff) | |
| download | opencode-70da3a9399d3385b53f7831beb08f716b972860d.tar.gz opencode-70da3a9399d3385b53f7831beb08f716b972860d.zip | |
wip: zen
Diffstat (limited to 'packages/console/app/src/context')
| -rw-r--r-- | packages/console/app/src/context/auth.ts | 16 |
1 files changed, 11 insertions, 5 deletions
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<Actor.Info> => { } 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<Actor.Info> => { .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: { |
