universo-platform-3d

Форк
0
54 строки · 1.6 Кб
1
import {
2
  Body,
3
  Controller,
4
  Delete,
5
  Get,
6
  Param,
7
  Patch,
8
  Post,
9
  UsePipes,
10
  ValidationPipe
11
} from '@nestjs/common'
12
import { EnvironmentService } from './environment.service'
13
import { UpdateEnvironmentDto } from './dto/update-environment.dto'
14
import { ApiCreatedResponse, ApiOkResponse, ApiParam } from '@nestjs/swagger'
15
import { EnvironmentApiResponse } from './environment.model'
16
import { 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 structure
21
export class EnvironmentController {
22
  constructor(private readonly environmentService: EnvironmentService) {}
23

24
  /***********************
25
   AUTH REQUIRED ENDPOINTS
26
   **********************/
27

28
  @Post()
29
  @ApiCreatedResponse({ type: EnvironmentApiResponse })
30
  public create() {
31
    return this.environmentService.create()
32
  }
33

34
  @Get(':id')
35
  @ApiParam({ name: 'id', type: 'string', required: true })
36
  @ApiOkResponse({ type: EnvironmentApiResponse })
37
  public findOne(@Param('id') id: string) {
38
    return this.environmentService.findOne(id)
39
  }
40

41
  @Patch(':id')
42
  @ApiParam({ name: 'id', type: 'string', required: true })
43
  @ApiOkResponse({ type: EnvironmentApiResponse })
44
  public update(@Param('id') id: string, @Body() dto: UpdateEnvironmentDto) {
45
    return this.environmentService.update(id, dto)
46
  }
47

48
  @Delete(':id')
49
  @ApiParam({ name: 'id', type: 'string', required: true })
50
  @ApiOkResponse({ type: EnvironmentApiResponse })
51
  public remove(@Param('id') id: string) {
52
    return this.environmentService.remove(id)
53
  }
54
}
55

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.