feat(console): add support actions (#33492)

This commit is contained in:
Victor Navarro 2026-06-24 12:06:51 +02:00 committed by GitHub
commit ad3651d8f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 255 additions and 156 deletions

View file

@ -11,6 +11,7 @@ import { Key } from "./key"
import { KeyTable } from "./schema/key.sql"
import { WorkspaceTable } from "./schema/workspace.sql"
import { AuthTable } from "./schema/auth.sql"
import { AccountTable } from "./schema/account.sql"
export namespace User {
const assertNotSelf = (id: string) => {
@ -161,6 +162,13 @@ export namespace User {
export const joinInvitedWorkspaces = fn(z.void(), async () => {
const account = Actor.assert("account")
const invitations = await Database.use(async (tx) => {
const active = await tx
.select({ id: AccountTable.id })
.from(AccountTable)
.where(and(eq(AccountTable.id, account.properties.accountID), isNull(AccountTable.timeDeleted)))
.then((rows) => rows[0])
if (!active) throw new Error("Account is not active")
const invitations = await tx
.select({
id: UserTable.id,