mirror of
https://github.com/ArthurDanjou/arthome.git
synced 2026-01-26 09:30:26 +01:00
Working
This commit is contained in:
19
server/api/users/[username].get.ts
Normal file
19
server/api/users/[username].get.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { username } = await getRouterParams(event)
|
||||
const user = await useDrizzle()
|
||||
.query
|
||||
.users
|
||||
.findFirst({
|
||||
where: eq(tables.users.username, username.toLowerCase()),
|
||||
with: {
|
||||
categories: {
|
||||
with: {
|
||||
tabs: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
return user || {
|
||||
message: 'User not found',
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user