mirror of
https://github.com/hay-kot/mealie.git
synced 2025-07-07 13:32:21 -07:00
feat: additional cookbook features (tags, tools, and public) (#1116)
* migration: add public, tags, and tools * generate frontend types * add help icon * start replacement for tool-tag-category selector * add help icon utility * use generator types * add support for cookbook features * add UI elements for cookbook features * fix tests * fix type error
This commit is contained in:
parent
1092e0ce7c
commit
cfaac2e060
23 changed files with 374 additions and 97 deletions
|
@ -1,32 +1,18 @@
|
|||
import { BaseCRUDAPI } from "../_base";
|
||||
import { CategoryBase } from "~/types/api-types/recipe";
|
||||
import { RecipeCategory } from "~/types/api-types/user";
|
||||
import { CreateCookBook, RecipeCookBook, UpdateCookBook } from "~/types/api-types/cookbook";
|
||||
|
||||
const prefix = "/api";
|
||||
|
||||
export interface CreateCookBook {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface CookBook extends CreateCookBook {
|
||||
id: number;
|
||||
slug: string;
|
||||
description: string;
|
||||
position: number;
|
||||
group_id: number;
|
||||
categories: RecipeCategory[] | CategoryBase[];
|
||||
}
|
||||
|
||||
const routes = {
|
||||
cookbooks: `${prefix}/groups/cookbooks`,
|
||||
cookbooksId: (id: number) => `${prefix}/groups/cookbooks/${id}`,
|
||||
};
|
||||
|
||||
export class CookbookAPI extends BaseCRUDAPI<CookBook, CreateCookBook> {
|
||||
export class CookbookAPI extends BaseCRUDAPI<RecipeCookBook, CreateCookBook> {
|
||||
baseRoute: string = routes.cookbooks;
|
||||
itemRoute = routes.cookbooksId;
|
||||
|
||||
async updateAll(payload: CookBook[]) {
|
||||
async updateAll(payload: UpdateCookBook[]) {
|
||||
return await this.requests.put(this.baseRoute, payload);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue