universo-platform-3d
54 строки · 1.6 Кб
1import {2Body,3Controller,4Delete,5Get,6Param,7Patch,8Post,9UsePipes,10ValidationPipe
11} from '@nestjs/common'12import { EnvironmentService } from './environment.service'13import { UpdateEnvironmentDto } from './dto/update-environment.dto'14import { ApiCreatedResponse, ApiOkResponse, ApiParam } from '@nestjs/swagger'15import { EnvironmentApiResponse } from './environment.model'16import { FirebaseTokenAuthGuard } from '../auth/auth.guard'17
18@Controller('environment')19@FirebaseTokenAuthGuard()20@UsePipes(new ValidationPipe({ whitelist: false })) // TEMP disabled to allow for saving of sky data without structure21export class EnvironmentController {22constructor(private readonly environmentService: EnvironmentService) {}23
24/***********************25AUTH REQUIRED ENDPOINTS
26**********************/
27
28@Post()29@ApiCreatedResponse({ type: EnvironmentApiResponse })30public create() {31return this.environmentService.create()32}33
34@Get(':id')35@ApiParam({ name: 'id', type: 'string', required: true })36@ApiOkResponse({ type: EnvironmentApiResponse })37public findOne(@Param('id') id: string) {38return this.environmentService.findOne(id)39}40
41@Patch(':id')42@ApiParam({ name: 'id', type: 'string', required: true })43@ApiOkResponse({ type: EnvironmentApiResponse })44public update(@Param('id') id: string, @Body() dto: UpdateEnvironmentDto) {45return this.environmentService.update(id, dto)46}47
48@Delete(':id')49@ApiParam({ name: 'id', type: 'string', required: true })50@ApiOkResponse({ type: EnvironmentApiResponse })51public remove(@Param('id') id: string) {52return this.environmentService.remove(id)53}54}
55