import { Body, Controller, Post, UseGuards } from '@nestjs/common'; import { AuthGuard } from '../auth/auth.guard.js'; import { CurrentUser } from '../auth/current-user.decorator.js'; import { ProjectBootstrapService, type BootstrapProjectResult, } from './project-bootstrap.service.js'; import { CreateWorkspaceDto } from './workspace.dto.js'; @Controller('api/workspaces') @UseGuards(AuthGuard) export class WorkspaceController { constructor(private readonly bootstrap: ProjectBootstrapService) {} @Post() async create( @CurrentUser() user: { id: string }, @Body() dto: CreateWorkspaceDto, ): Promise { return this.bootstrap.bootstrap({ name: dto.name, description: dto.description, userId: user.id, teamId: dto.teamId, repoUrl: dto.repoUrl, }); } }