| 
									
										
										
										
											2024-05-01 02:20:52 -05:00
										 |  |  | import { BaseCRUDAPI } from "../base/base-clients"; | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  | import type { CreateGroupRecipeAction, GroupRecipeActionOut } from "~/lib/api/types/household"; | 
					
						
							| 
									
										
										
										
											2024-05-01 02:20:52 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | const prefix = "/api"; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const routes = { | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |   groupRecipeActions: `${prefix}/households/recipe-actions`, | 
					
						
							|  |  |  |   groupRecipeActionsId: (id: string | number) => `${prefix}/households/recipe-actions/${id}`, | 
					
						
							|  |  |  |   groupRecipeActionsIdTriggerRecipeSlug: (id: string | number, recipeSlug: string) => `${prefix}/households/recipe-actions/${id}/trigger/${recipeSlug}`, | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2024-05-01 02:20:52 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  | export class GroupRecipeActionsAPI extends BaseCRUDAPI<CreateGroupRecipeAction, GroupRecipeActionOut> { | 
					
						
							|  |  |  |   baseRoute = routes.groupRecipeActions; | 
					
						
							|  |  |  |   itemRoute = routes.groupRecipeActionsId; | 
					
						
							| 
									
										
										
										
											2024-09-14 09:59:36 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  |   async triggerAction(id: string | number, recipeSlug: string, scaledAmount: number) { | 
					
						
							|  |  |  |     return await this.requests.post(routes.groupRecipeActionsIdTriggerRecipeSlug(id, recipeSlug), { scaledAmount }); | 
					
						
							| 
									
										
										
										
											2024-05-01 02:20:52 -05:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2025-06-20 00:09:12 +07:00
										 |  |  | } |