feat: stabilize admin dashboard, refactor group management, implement PWA, and fix routing
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { requireAuth } from '~/server/utils/auth'
|
||||
import { prisma } from '~/server/utils/prisma'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const user = requireAuth(event)
|
||||
const body = await readBody(event)
|
||||
const { displayName, bio, avatar } = body
|
||||
|
||||
// Обновляем данные в таблице Profile
|
||||
const updatedProfile = await prisma.profile.update({
|
||||
where: { userId: user.id },
|
||||
data: {
|
||||
...(displayName !== undefined && { displayName }),
|
||||
...(bio !== undefined && { bio }),
|
||||
...(avatar !== undefined && { avatar })
|
||||
}
|
||||
})
|
||||
|
||||
return { success: true, profile: updatedProfile }
|
||||
})
|
||||
Reference in New Issue
Block a user