Files
stack/apps/gateway/src/workspace/workspace.controller.ts
T
2026-08-09 20:12:39 -05:00

29 lines
838 B
TypeScript

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<BootstrapProjectResult> {
return this.bootstrap.bootstrap({
name: dto.name,
description: dto.description,
userId: user.id,
teamId: dto.teamId,
repoUrl: dto.repoUrl,
});
}
}