feat(operations): add create_project operation across agent, mcp, and cli (#529)

* feat(operations): add create_project operation across agent, mcp, and cli

* fix(api): remove legacy team creation endpoint

* fix(api): preserve ProjectInfo response on POST /teams/:teamId/projects
This commit is contained in:
Yiling-J
2026-11-13 11:43:08 +08:00
committed by GitHub
parent 97c2939b5e
commit c55804a548
20 changed files with 369 additions and 66 deletions
+12 -21
View File
@@ -18,7 +18,12 @@ import {
import { listMembersQuerySchema, AuditAction } from '@shumai/dtos'
import type { Prisma } from '@shumai/db'
import { auditLogService } from '@shumai/core/src/auditLog/auditLog'
import { copyAssetsOp, moveAssetsOp, runOperation } from '@shumai/core/src/operations'
import {
copyAssetsOp,
createProjectOp,
moveAssetsOp,
runOperation,
} from '@shumai/core/src/operations'
type User = Prisma.UserGetPayload<Record<string, never>>
@@ -50,27 +55,13 @@ const route = new Hono<{ Variables: { user: User } }>()
const user = c.get('user')
const req = c.req.valid('json')
await authzService.hasPermission({
user,
permission: Permission.Edit,
type: ResourceType.Team,
id: teamId,
})
const newProject = await runOperation(
createProjectOp,
{ userId: user.id, via: 'api' },
{ teamId, ...req },
)
const newProject = await projectService.createProject(user, {
teamId,
...req,
})
await auditLogService.logAction({
action: AuditAction.project_create,
teamId,
userId: user.id,
projectId: newProject.id,
itemId: newProject.id,
})
return c.json(newProject)
return c.json(await projectService.getProject(newProject.id))
})
.put('/projects/:projectId', zValidator('json', updateProjectRequestSchema), async (c) => {
const projectId = c.req.param('projectId')