|
|
@@ -11,7 +11,7 @@ export namespace Account {
|
|
|
id: z.string().optional(),
|
|
|
}),
|
|
|
async (input) =>
|
|
|
- Database.transaction(async (tx) => {
|
|
|
+ Database.use(async (tx) => {
|
|
|
const id = input.id ?? Identifier.create("account")
|
|
|
await tx.insert(AccountTable).values({
|
|
|
id,
|
|
|
@@ -21,13 +21,12 @@ export namespace Account {
|
|
|
)
|
|
|
|
|
|
export const fromID = fn(z.string(), async (id) =>
|
|
|
- Database.transaction(async (tx) => {
|
|
|
- return tx
|
|
|
+ Database.use((tx) =>
|
|
|
+ tx
|
|
|
.select()
|
|
|
.from(AccountTable)
|
|
|
.where(eq(AccountTable.id, id))
|
|
|
- .execute()
|
|
|
- .then((rows) => rows[0])
|
|
|
- }),
|
|
|
+ .then((rows) => rows[0]),
|
|
|
+ ),
|
|
|
)
|
|
|
}
|