be s
This commit is contained in:
24
backend/src/sensors/sensors.controller.ts
Normal file
24
backend/src/sensors/sensors.controller.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
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);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user