chore(repo): restructure as monorepo with server and client workspaces
- move NestJS app into server/ subdirectory - add client/ React+TypeScript (Vite) app with Hello World - update docker-compose to build and run both services - add root package.json declaring npm workspaces - update .gitignore to cover node_modules and dist at all depths
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
HttpCode,
|
||||
Param,
|
||||
ParseIntPipe,
|
||||
Patch,
|
||||
Post,
|
||||
Query,
|
||||
} from "@nestjs/common";
|
||||
import { ApiOperation, ApiResponse, ApiTags } from "@nestjs/swagger";
|
||||
import { EnvironmentService } from "./environment.service";
|
||||
import { CreateEnvironmentDto } from "./dto/create-environment.dto";
|
||||
import { UpdateEnvironmentDto } from "./dto/update-environment.dto";
|
||||
import { PaginationQueryDto } from "../common/dto/pagination.dto";
|
||||
import { EnvironmentOrderBy } from "./environment.service";
|
||||
|
||||
@ApiTags("environments")
|
||||
@Controller("environments")
|
||||
export class EnvironmentController {
|
||||
constructor(private readonly environmentService: EnvironmentService) {}
|
||||
|
||||
@Post()
|
||||
@ApiOperation({ summary: "Create a new environment" })
|
||||
@ApiResponse({ status: 201, description: "Environment created" })
|
||||
@ApiResponse({ status: 409, description: "Environment name already exists" })
|
||||
create(@Body() dto: CreateEnvironmentDto) {
|
||||
return this.environmentService.create(dto);
|
||||
}
|
||||
|
||||
@Get()
|
||||
@ApiOperation({ summary: "List all environments (paginated)" })
|
||||
@ApiResponse({ status: 200, description: "Paginated environments" })
|
||||
findAll(@Query() query: PaginationQueryDto<EnvironmentOrderBy>) {
|
||||
return this.environmentService.findAll(query);
|
||||
}
|
||||
|
||||
@Get(":id")
|
||||
@ApiOperation({ summary: "Get environment by ID" })
|
||||
@ApiResponse({ status: 200, description: "Environment record" })
|
||||
@ApiResponse({ status: 404, description: "Environment not found" })
|
||||
findOne(@Param("id", ParseIntPipe) id: number) {
|
||||
return this.environmentService.findOne(id);
|
||||
}
|
||||
|
||||
@Patch(":id")
|
||||
@ApiOperation({ summary: "Update an environment" })
|
||||
@ApiResponse({ status: 200, description: "Environment updated" })
|
||||
@ApiResponse({ status: 404, description: "Environment not found" })
|
||||
update(
|
||||
@Param("id", ParseIntPipe) id: number,
|
||||
@Body() dto: UpdateEnvironmentDto,
|
||||
) {
|
||||
return this.environmentService.update(id, dto);
|
||||
}
|
||||
|
||||
@Delete(":id")
|
||||
@HttpCode(204)
|
||||
@ApiOperation({ summary: "Delete an environment" })
|
||||
@ApiResponse({ status: 204, description: "Environment deleted" })
|
||||
@ApiResponse({ status: 404, description: "Environment not found" })
|
||||
remove(@Param("id", ParseIntPipe) id: number) {
|
||||
return this.environmentService.remove(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user