mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-21 06:09:40 +02:00
20 lines
808 B
TypeScript
20 lines
808 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 routes = {
|
||
|
foodsGroupSlug: (groupSlug: string | number) => `${prefix}/explore/foods/${groupSlug}`,
|
||
|
foodsGroupSlugFoodId: (groupSlug: string | number, foodId: string | number) => `${prefix}/explore/foods/${groupSlug}/${foodId}`,
|
||
|
};
|
||
|
|
||
|
export class PublicFoodsApi extends BaseCRUDAPIReadOnly<IngredientFood> {
|
||
|
baseRoute = routes.foodsGroupSlug(this.groupSlug);
|
||
|
itemRoute = (itemId: string | number) => routes.foodsGroupSlugFoodId(this.groupSlug, itemId);
|
||
|
|
||
|
constructor(requests: ApiRequestInstance, private readonly groupSlug: string) {
|
||
|
super(requests);
|
||
|
}
|
||
|
}
|