mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-11-04 03:03:18 -05:00 
			
		
		
		
	
		
			
	
	
		
			33 lines
		
	
	
		
			704 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			33 lines
		
	
	
		
			704 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| 
								 | 
							
								import { BaseCRUDAPI } from "./_base";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const prefix = "/api";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const routes = {
							 | 
						||
| 
								 | 
							
								  mealplan: `${prefix}/groups/mealplans`,
							 | 
						||
| 
								 | 
							
								  mealplanId: (id: string | number) => `${prefix}/groups/mealplans/${id}`,
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								type PlanEntryType = "breakfast" | "lunch" | "dinner" | "snack";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export interface CreateMealPlan {
							 | 
						||
| 
								 | 
							
								  date: string;
							 | 
						||
| 
								 | 
							
								  entryType: PlanEntryType;
							 | 
						||
| 
								 | 
							
								  title: string;
							 | 
						||
| 
								 | 
							
								  text: string;
							 | 
						||
| 
								 | 
							
								  recipeId?: number;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export interface UpdateMealPlan extends CreateMealPlan {
							 | 
						||
| 
								 | 
							
								  id: number;
							 | 
						||
| 
								 | 
							
								  groupId: number;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export interface MealPlan extends UpdateMealPlan {
							 | 
						||
| 
								 | 
							
								  recipe: any;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export class MealPlanAPI extends BaseCRUDAPI<MealPlan, CreateMealPlan> {
							 | 
						||
| 
								 | 
							
								  baseRoute = routes.mealplan;
							 | 
						||
| 
								 | 
							
								  itemRoute = routes.mealplanId;
							 | 
						||
| 
								 | 
							
								}
							 |