mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-30 17:53:31 -04:00 
			
		
		
		
	feat(frontend): ✨ Add Initial CookBook Support
This commit is contained in:
		
							
								
								
									
										31
									
								
								frontend/api/class-interfaces/cookbooks.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								frontend/api/class-interfaces/cookbooks.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,31 @@ | ||||
| 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; | ||||
|   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); | ||||
|   } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user