mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-31 02:03:35 -04:00 
			
		
		
		
	Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com> Co-authored-by: Kuchenpirat <24235032+Kuchenpirat@users.noreply.github.com>
		
			
				
	
	
		
			22 lines
		
	
	
		
			891 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			891 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| import { BaseCRUDAPIReadOnly } from "~/lib/api/base/base-clients";
 | |
| import { IngredientFood } from "~/lib/api/types/recipe";
 | |
| import { ApiRequestInstance } from "~/lib/api/types/non-generated";
 | |
| 
 | |
| const prefix = "/api";
 | |
| const exploreGroupSlug = (groupSlug: string | number) => `${prefix}/explore/groups/${groupSlug}`
 | |
| 
 | |
| const routes = {
 | |
|     foodsGroupSlug: (groupSlug: string | number) => `${exploreGroupSlug(groupSlug)}/foods`,
 | |
|     foodsGroupSlugFoodId: (groupSlug: string | number, foodId: string | number) => `${exploreGroupSlug(groupSlug)}/foods/${foodId}`,
 | |
| };
 | |
| 
 | |
| export class PublicFoodsApi extends BaseCRUDAPIReadOnly<IngredientFood> {
 | |
|     constructor(requests: ApiRequestInstance, groupSlug: string) {
 | |
|         super(
 | |
|             requests,
 | |
|             routes.foodsGroupSlug(groupSlug),
 | |
|             (itemId: string | number) => routes.foodsGroupSlugFoodId(groupSlug, itemId)
 | |
|         );
 | |
|     }
 | |
| }
 |