summaryrefslogtreecommitdiffhomepage
path: root/packages/console/core/src/user.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/console/core/src/user.ts')
-rw-r--r--packages/console/core/src/user.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/console/core/src/user.ts b/packages/console/core/src/user.ts
new file mode 100644
index 000000000..7914926ff
--- /dev/null
+++ b/packages/console/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])
+ }),
+ )
+}