You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tryFullStack/backend/src/sensors/sensors.controller.ts

25 lines
855 B

1 month ago
import { Controller, Get, Param, ParseIntPipe } from '@nestjs/common';
import { SensorsService } from './sensors.service';
import { ApiOkResponse, ApiOperation, ApiTags } from '@nestjs/swagger';
import { Sensor } from './entities/sensor.entity';
@ApiTags('센서')
@Controller('sensors')
export class SensorsController {
constructor(private readonly sensorService: SensorsService) {}
@Get()
@ApiOperation({ summary: '센서 목록 조회' })
@ApiOkResponse({ description: '센서 목록', type: [Sensor] })
async findAll(): Promise<Sensor[]> {
return this.findAll();
}
@Get(':id')
@ApiOperation({ summary: '특정 센서 조회' })
@ApiOkResponse({ description: '센서', type: [Sensor] })
async findOne(@Param('id', ParseIntPipe) id: number): Promise<Sensor | null> {
return this.findOne(id);
}
}