mirror of
https://github.com/ArthurDanjou/arthome.git
synced 2026-01-14 20:19:26 +01:00
Working
This commit is contained in:
@@ -10,3 +10,5 @@ export function useDrizzle() {
|
||||
const config = useRuntimeConfig()
|
||||
return drizzle(postgres(config.postgres.url, { prepare: false, max: 50 }), { schema })
|
||||
}
|
||||
|
||||
export type UserInsert = typeof schema.users.$inferInsert
|
||||
|
||||
@@ -45,14 +45,14 @@ export async function createUser(user: UserInsert) {
|
||||
}
|
||||
|
||||
export async function updateUser(userId: number, user: Partial<UserInsert>) {
|
||||
return useDrizzle()
|
||||
await useDrizzle()
|
||||
.update(tables.users)
|
||||
.set(user)
|
||||
.where(eq(tables.users.id, userId))
|
||||
}
|
||||
|
||||
export async function deleteProfilePicture(avatar: string) {
|
||||
if (avatar.startsWith('profile-pictures/')) {
|
||||
await hubBlob().delete(avatar)
|
||||
if (avatar.startsWith('avatars/')) {
|
||||
await hubBlob().del(avatar)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user