This commit is contained in:
Frank
2025-10-16 22:27:28 -04:00
parent ca9b13e8a2
commit 1947580b08
14 changed files with 1096 additions and 147 deletions

View File

@@ -8,7 +8,6 @@ import { AccountTable } from "./schema/account.sql"
export namespace Account {
export const create = fn(
z.object({
email: z.string().email(),
id: z.string().optional(),
}),
async (input) =>
@@ -16,7 +15,6 @@ export namespace Account {
const id = input.id ?? Identifier.create("account")
await tx.insert(AccountTable).values({
id,
email: input.email,
})
return id
}),
@@ -32,15 +30,4 @@ export namespace Account {
.then((rows) => rows[0])
}),
)
export const fromEmail = fn(z.string().email(), async (email) =>
Database.transaction(async (tx) => {
return tx
.select()
.from(AccountTable)
.where(eq(AccountTable.email, email))
.execute()
.then((rows) => rows[0])
}),
)
}