feat: implement meal planning feature with CRUD operations and UI integration
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { Body, Controller, Delete, Get, Param, Post, Query } from '@nestjs/common';
|
||||
import { MealPlanService } from './meal-plan.service';
|
||||
import { CreateMealPlanEntryDto } from './dto/create-meal-plan-entry.dto';
|
||||
|
||||
@Controller('meal-plan')
|
||||
export class MealPlanController {
|
||||
constructor(private readonly mealPlanService: MealPlanService) {}
|
||||
|
||||
@Get()
|
||||
findByRange(@Query('from') from: string, @Query('to') to: string) {
|
||||
return this.mealPlanService.findByRange(from, to);
|
||||
}
|
||||
|
||||
@Get('shopping-list')
|
||||
shoppingList(@Query('from') from: string, @Query('to') to: string) {
|
||||
return this.mealPlanService.shoppingList(from, to);
|
||||
}
|
||||
|
||||
@Post()
|
||||
upsert(@Body() dto: CreateMealPlanEntryDto) {
|
||||
return this.mealPlanService.upsert(dto);
|
||||
}
|
||||
|
||||
@Delete(':date')
|
||||
removeByDate(@Param('date') date: string) {
|
||||
return this.mealPlanService.removeByDate(date);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user