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
+27
View File
@@ -0,0 +1,27 @@
import { requireAuth } from '~/server/utils/auth'
import { groups, userGroups } from '~/server/utils/db'
export default defineEventHandler(async (event) => {
const user = requireAuth(event)
const body = await readBody(event)
const { name, description = '', isPublic = true } = body
if (!name?.trim()) {
throw createError({ statusCode: 400, message: 'Group name is required' })
}
const id = `group-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`
const now = new Date().toISOString()
const group = { id, name: name.trim(), description, isPublic, createdAt: now, updatedAt: now, ownerId: user.id }
groups.set(id, group)
userGroups.set(`${user.id}-${id}`, {
userId: user.id,
groupId: id,
role: 'admin',
joinedAt: now
})
return { group }
})