feat: prisma schema, groups API, deploy workflow

This commit is contained in:
2026-04-23 21:41:11 +05:00
parent 4c50036172
commit 65cf8ca01f
285 changed files with 24602 additions and 25890 deletions
+40
View File
@@ -0,0 +1,40 @@
import { profiles, canvases, follows } from '~/server/utils/db'
export default defineEventHandler(async (event) => {
const userId = getRouterParam(event, 'id')
if (!userId) {
throw createError({ statusCode: 400, message: 'User ID is required' })
}
const profile = profiles.get(userId)
if (!profile) {
throw createError({ statusCode: 404, message: 'Profile not found' })
}
// Count user's canvases
const userCanvases = Array.from(canvases.values()).filter(
canvas => canvas.ownerId === userId
)
// Count followers and following
const followers = Array.from(follows.values()).filter(
follow => follow.followingId === userId
).length
const following = Array.from(follows.values()).filter(
follow => follow.followerId === userId
).length
// Update profile with current stats
const updatedProfile = {
...profile,
canvasCount: userCanvases.length,
followerCount: followers,
followingCount: following
}
profiles.set(userId, updatedProfile)
return { profile: updatedProfile }
})