This commit is contained in:
2025-11-13 08:35:47 +03:30
parent 8c02c80a09
commit 75117b5bd1
7 changed files with 77 additions and 0 deletions
+2
View File
@@ -15,6 +15,7 @@ import { AdminModule } from './modules/admin/admin.module';
// import { CacheService } from './modules/utils/cache.service'; // import { CacheService } from './modules/utils/cache.service';
import { ThrottlerModule } from '@nestjs/throttler'; import { ThrottlerModule } from '@nestjs/throttler';
import { RestaurantsModule } from './modules/restaurants/restaurants.module'; import { RestaurantsModule } from './modules/restaurants/restaurants.module';
import { FoodsModule } from './modules/foods/foods.module';
@Module({ @Module({
imports: [ imports: [
@@ -43,6 +44,7 @@ import { RestaurantsModule } from './modules/restaurants/restaurants.module';
}, },
]), ]),
RestaurantsModule, RestaurantsModule,
FoodsModule,
], ],
controllers: [], controllers: [],
// providers: [CacheService], // providers: [CacheService],
+1
View File
@@ -0,0 +1 @@
export class CreateFoodDto {}
+4
View File
@@ -0,0 +1,4 @@
import { PartialType } from '@nestjs/swagger';
import { CreateFoodDto } from './create-food.dto';
export class UpdateFoodDto extends PartialType(CreateFoodDto) {}
@@ -0,0 +1 @@
export class Food {}
+34
View File
@@ -0,0 +1,34 @@
import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
import { FoodsService } from './foods.service';
import { CreateFoodDto } from './dto/create-food.dto';
import { UpdateFoodDto } from './dto/update-food.dto';
@Controller('foods')
export class FoodsController {
constructor(private readonly foodsService: FoodsService) {}
@Post()
create(@Body() createFoodDto: CreateFoodDto) {
return this.foodsService.create(createFoodDto);
}
@Get()
findAll() {
return this.foodsService.findAll();
}
@Get(':id')
findOne(@Param('id') id: string) {
return this.foodsService.findOne(+id);
}
@Patch(':id')
update(@Param('id') id: string, @Body() updateFoodDto: UpdateFoodDto) {
return this.foodsService.update(+id, updateFoodDto);
}
@Delete(':id')
remove(@Param('id') id: string) {
return this.foodsService.remove(+id);
}
}
+9
View File
@@ -0,0 +1,9 @@
import { Module } from '@nestjs/common';
import { FoodsService } from './foods.service';
import { FoodsController } from './foods.controller';
@Module({
controllers: [FoodsController],
providers: [FoodsService],
})
export class FoodsModule {}
+26
View File
@@ -0,0 +1,26 @@
import { Injectable } from '@nestjs/common';
import { CreateFoodDto } from './dto/create-food.dto';
import { UpdateFoodDto } from './dto/update-food.dto';
@Injectable()
export class FoodsService {
create(createFoodDto: CreateFoodDto) {
return 'This action adds a new food';
}
findAll() {
return `This action returns all foods`;
}
findOne(id: number) {
return `This action returns a #${id} food`;
}
update(id: number, updateFoodDto: UpdateFoodDto) {
return `This action updates a #${id} food`;
}
remove(id: number) {
return `This action removes a #${id} food`;
}
}