feat: restructure into XFlow monorepo with Nuxt 4, Modular Onion Monolith, Android client, and Desktop CLI
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
import { requireAuth } from '~/server/utils/auth'
|
||||
import { prisma } from '~/server/utils/prisma'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const user = requireAuth(event)
|
||||
|
||||
const userGroups = await prisma.groupMember.findMany({
|
||||
where: { userId: user.id },
|
||||
select: { groupId: true }
|
||||
})
|
||||
const groupIds = userGroups.map(m => m.groupId)
|
||||
|
||||
// Get all canvases user has access to
|
||||
const canvasList = await prisma.canvas.findMany({
|
||||
where: {
|
||||
OR: [
|
||||
{ ownerId: user.id },
|
||||
{ isPublic: true },
|
||||
{ groupId: { in: groupIds } }
|
||||
]
|
||||
},
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
nodes: true
|
||||
}
|
||||
})
|
||||
|
||||
// Extract tasks from all canvases
|
||||
const allTasks = []
|
||||
|
||||
for (const canvas of canvasList) {
|
||||
const nodes = Array.isArray(canvas.nodes) ? canvas.nodes :
|
||||
(typeof canvas.nodes === 'string' ? JSON.parse(canvas.nodes) : [])
|
||||
|
||||
if (!Array.isArray(nodes)) continue
|
||||
|
||||
const canvasTasks = nodes.filter(n => {
|
||||
const type = n.type || n.data?.type
|
||||
if (type !== 'task') return false
|
||||
|
||||
// Temporary: Show ALL tasks regardless of assignee so you can see them!
|
||||
return true
|
||||
})
|
||||
|
||||
for (const t of canvasTasks) {
|
||||
allTasks.push({
|
||||
...t,
|
||||
canvasId: canvas.id,
|
||||
canvasName: canvas.name
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return { tasks: allTasks }
|
||||
})
|
||||
Reference in New Issue
Block a user