mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-11-03 18:53:17 -05:00 
			
		
		
		
	* feat(backend): ✨ new meal-planner feature * feat(frontend): ✨ new meal plan feature * refactor(backend): ♻️ refactor base services classes and add mixins for crud * feat(frontend): ✨ add UI/API for mealplanner * feat(backend): ✨ add get_today and get_slice options for mealplanner * test(backend): ✅ add and update group mealplanner tests * fix(backend): 🐛 Fix recipe_id column type for PG Co-authored-by: hay-kot <hay-kot@pm.me>
		
			
				
	
	
		
			33 lines
		
	
	
		
			792 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			792 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { BaseCRUDAPI } from "./_base";
 | 
						|
import { Category } from "./categories";
 | 
						|
import { CategoryBase } from "~/types/api-types/recipe";
 | 
						|
 | 
						|
const prefix = "/api";
 | 
						|
 | 
						|
export interface CreateCookBook {
 | 
						|
  name: string;
 | 
						|
}
 | 
						|
 | 
						|
export interface CookBook extends CreateCookBook {
 | 
						|
  id: number;
 | 
						|
  slug: string;
 | 
						|
  description: string;
 | 
						|
  position: number;
 | 
						|
  group_id: number;
 | 
						|
  categories: Category[] | CategoryBase[];
 | 
						|
}
 | 
						|
 | 
						|
const routes = {
 | 
						|
  cookbooks: `${prefix}/groups/cookbooks`,
 | 
						|
  cookbooksId: (id: number) => `${prefix}/groups/cookbooks/${id}`,
 | 
						|
};
 | 
						|
 | 
						|
export class CookbookAPI extends BaseCRUDAPI<CookBook, CreateCookBook> {
 | 
						|
  baseRoute: string = routes.cookbooks;
 | 
						|
  itemRoute = routes.cookbooksId;
 | 
						|
 | 
						|
  async updateAll(payload: CookBook[]) {
 | 
						|
    return await this.requests.put(this.baseRoute, payload);
 | 
						|
  }
 | 
						|
}
 |