mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-23 15:19:41 +02:00
feat(frontend): ✨ Add Initial CookBook Support
This commit is contained in:
parent
2e6352cfbd
commit
83ab858e46
10 changed files with 266 additions and 32 deletions
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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue