67 lines
1.7 KiB
TypeScript
67 lines
1.7 KiB
TypeScript
import {
|
|
Controller,
|
|
Get,
|
|
Post,
|
|
Put,
|
|
Delete,
|
|
Param,
|
|
Body,
|
|
} from '@nestjs/common';
|
|
import { RestfulService } from './restful.service';
|
|
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
|
|
|
|
@ApiTags('Restful')
|
|
@Controller('restful')
|
|
export class RestfulController {
|
|
constructor(private readonly restfulService: RestfulService) {}
|
|
|
|
@Get()
|
|
@ApiOperation({ summary: 'Get all items' })
|
|
@ApiResponse({ status: 200, description: 'Returns all items.' })
|
|
getAllItems() {
|
|
return this.restfulService.getAllItems();
|
|
}
|
|
|
|
// @Get(':id')
|
|
// @ApiOperation({ summary: 'Get an item by ID' })
|
|
// @ApiResponse({
|
|
// status: 200,
|
|
// description: 'Returns the item with the given ID.',
|
|
// })
|
|
// getItem(@Param('id') id: string) {
|
|
// return this.restfulService.getItem(id);
|
|
// }
|
|
|
|
// @Post()
|
|
// @ApiOperation({ summary: 'Create a new item' })
|
|
// @ApiResponse({
|
|
// status: 201,
|
|
// description: 'The item has been successfully created.',
|
|
// })
|
|
// createItem(@Body() createDto: any) {
|
|
// return this.restfulService.createItem(createDto);
|
|
// }
|
|
|
|
// @Put(':id')
|
|
// @ApiOperation({ summary: 'Update an item' })
|
|
// @ApiResponse({
|
|
// status: 200,
|
|
// description: 'The item has been successfully updated.',
|
|
// })
|
|
// updateItem(@Param('id') id: string, @Body() updateDto: any) {
|
|
// return this.restfulService.updateItem(id, updateDto);
|
|
// }
|
|
|
|
// @Delete(':id')
|
|
// @ApiOperation({ summary: 'Delete an item' })
|
|
// @ApiResponse({
|
|
// status: 200,
|
|
// description: 'The item has been successfully deleted.',
|
|
// })
|
|
// deleteItem(@Param('id') id: string) {
|
|
// return this.restfulService.deleteItem(id);
|
|
// }
|
|
}
|
|
|
|
export default RestfulController;
|