summaryrefslogtreecommitdiffhomepage
path: root/cloud/core/src/user.ts
diff options
context:
space:
mode:
authorFrank <[email protected]>2025-08-28 16:44:55 -0400
committerFrank <[email protected]>2025-08-28 16:44:55 -0400
commitc6ef92634d0ae026a59e023e69847b481975462b (patch)
treec88bfbbabf1f46ca922e3212dd929b34d6229a1a /cloud/core/src/user.ts
parentf97fdceb01c69ca563e755c6d50312ef7352f663 (diff)
downloadopencode-c6ef92634d0ae026a59e023e69847b481975462b.tar.gz
opencode-c6ef92634d0ae026a59e023e69847b481975462b.zip
wip cloud
Diffstat (limited to 'cloud/core/src/user.ts')
-rw-r--r--cloud/core/src/user.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/cloud/core/src/user.ts b/cloud/core/src/user.ts
new file mode 100644
index 000000000..7914926ff
--- /dev/null
+++ b/cloud/core/src/user.ts
@@ -0,0 +1,18 @@
+import { z } from "zod"
+import { eq } from "drizzle-orm"
+import { fn } from "./util/fn"
+import { Database } from "./drizzle"
+import { UserTable } from "./schema/user.sql"
+
+export namespace User {
+ export const fromID = fn(z.string(), async (id) =>
+ Database.transaction(async (tx) => {
+ return tx
+ .select()
+ .from(UserTable)
+ .where(eq(UserTable.id, id))
+ .execute()
+ .then((rows) => rows[0])
+ }),
+ )
+}