mirror of
https://github.com/aljazceru/opencode.git
synced 2026-01-29 20:55:06 +01:00
wip: zen
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user