mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-11-04 03:03:18 -05:00 
			
		
		
		
	
		
			
	
	
		
			23 lines
		
	
	
		
			430 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			23 lines
		
	
	
		
			430 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| 
								 | 
							
								import { BaseCRUDAPI } from "./_base";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const prefix = "/api";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export interface CreateFood {
							 | 
						||
| 
								 | 
							
								  name: string;
							 | 
						||
| 
								 | 
							
								  description: string;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export interface Food extends CreateFood {
							 | 
						||
| 
								 | 
							
								  id: number;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								const routes = {
							 | 
						||
| 
								 | 
							
								  food: `${prefix}/foods`,
							 | 
						||
| 
								 | 
							
								  foodsFood: (tag: string) => `${prefix}/foods/${tag}`,
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export class FoodAPI extends BaseCRUDAPI<Food, CreateFood> {
							 | 
						||
| 
								 | 
							
								  baseRoute: string = routes.food;
							 | 
						||
| 
								 | 
							
								  itemRoute = routes.foodsFood;
							 | 
						||
| 
								 | 
							
								}
							 |