1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 15:49:42 +02:00

feat: Add Households to Mealie (#3970)

This commit is contained in:
Michael Genson 2024-08-22 10:14:32 -05:00 committed by GitHub
parent 0c29cef17d
commit eb170cc7e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
315 changed files with 6975 additions and 3577 deletions

View file

@ -1,5 +1,6 @@
import { RecipeAPI } from "./user/recipes";
import { UserApi } from "./user/users";
import { HouseholdAPI } from "./user/households";
import { GroupAPI } from "./user/groups";
import { BackupAPI } from "./user/backups";
import { UploadFile } from "./user/upload";
@ -28,6 +29,7 @@ import { ApiRequestInstance } from "~/lib/api/types/non-generated";
export class UserApiClient {
public recipes: RecipeAPI;
public users: UserApi;
public households: HouseholdAPI;
public groups: GroupAPI;
public backups: BackupAPI;
public categories: CategoriesAPI;
@ -63,6 +65,7 @@ export class UserApiClient {
// Users
this.users = new UserApi(requests);
this.households = new HouseholdAPI(requests);
this.groups = new GroupAPI(requests);
this.cookbooks = new CookbookAPI(requests);
this.groupRecipeActions = new GroupRecipeActionsAPI(requests);

View file

@ -3,10 +3,11 @@ import { RecipeCookBook } from "~/lib/api/types/cookbook";
import { ApiRequestInstance } from "~/lib/api/types/non-generated";
const prefix = "/api";
const exploreGroupSlug = (groupSlug: string | number) => `${prefix}/explore/groups/${groupSlug}`
const routes = {
cookbooksGroupSlug: (groupSlug: string | number) => `${prefix}/explore/cookbooks/${groupSlug}`,
cookbooksGroupSlugCookbookId: (groupSlug: string | number, cookbookId: string | number) => `${prefix}/explore/cookbooks/${groupSlug}/${cookbookId}`,
cookbooksGroupSlug: (groupSlug: string | number) => `${exploreGroupSlug(groupSlug)}/cookbooks`,
cookbooksGroupSlugCookbookId: (groupSlug: string | number, cookbookId: string | number) => `${exploreGroupSlug(groupSlug)}/cookbooks/${cookbookId}`,
};
export class PublicCookbooksApi extends BaseCRUDAPIReadOnly<RecipeCookBook> {

View file

@ -3,10 +3,11 @@ 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) => `${prefix}/explore/foods/${groupSlug}`,
foodsGroupSlugFoodId: (groupSlug: string | number, foodId: string | number) => `${prefix}/explore/foods/${groupSlug}/${foodId}`,
foodsGroupSlug: (groupSlug: string | number) => `${exploreGroupSlug(groupSlug)}/foods`,
foodsGroupSlugFoodId: (groupSlug: string | number, foodId: string | number) => `${exploreGroupSlug(groupSlug)}/foods/${foodId}`,
};
export class PublicFoodsApi extends BaseCRUDAPIReadOnly<IngredientFood> {

View file

@ -3,14 +3,15 @@ import { RecipeCategory, RecipeTag, RecipeTool } 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 = {
categoriesGroupSlug: (groupSlug: string | number) => `${prefix}/explore/organizers/${groupSlug}/categories`,
categoriesGroupSlugCategoryId: (groupSlug: string | number, categoryId: string | number) => `${prefix}/explore/organizers/${groupSlug}/categories/${categoryId}`,
tagsGroupSlug: (groupSlug: string | number) => `${prefix}/explore/organizers/${groupSlug}/tags`,
tagsGroupSlugTagId: (groupSlug: string | number, tagId: string | number) => `${prefix}/explore/organizers/${groupSlug}/tags/${tagId}`,
toolsGroupSlug: (groupSlug: string | number) => `${prefix}/explore/organizers/${groupSlug}/tools`,
toolsGroupSlugToolId: (groupSlug: string | number, toolId: string | number) => `${prefix}/explore/organizers/${groupSlug}/tools/${toolId}`,
categoriesGroupSlug: (groupSlug: string | number) => `${exploreGroupSlug(groupSlug)}/organizers/categories`,
categoriesGroupSlugCategoryId: (groupSlug: string | number, categoryId: string | number) => `${exploreGroupSlug(groupSlug)}/organizers/categories/${categoryId}`,
tagsGroupSlug: (groupSlug: string | number) => `${exploreGroupSlug(groupSlug)}/organizers/tags`,
tagsGroupSlugTagId: (groupSlug: string | number, tagId: string | number) => `${exploreGroupSlug(groupSlug)}/organizers/tags/${tagId}`,
toolsGroupSlug: (groupSlug: string | number) => `${exploreGroupSlug(groupSlug)}/organizers/tools`,
toolsGroupSlugToolId: (groupSlug: string | number, toolId: string | number) => `${exploreGroupSlug(groupSlug)}/organizers/tools`,
};
export class PublicCategoriesApi extends BaseCRUDAPIReadOnly<RecipeCategory> {

View file

@ -5,10 +5,11 @@ import { ApiRequestInstance, PaginationData } from "~/lib/api/types/non-generate
import { RecipeSearchQuery } from "../../user/recipes/recipe";
const prefix = "/api";
const exploreGroupSlug = (groupSlug: string | number) => `${prefix}/explore/groups/${groupSlug}`
const routes = {
recipesGroupSlug: (groupSlug: string | number) => `${prefix}/explore/recipes/${groupSlug}`,
recipesGroupSlugRecipeSlug: (groupSlug: string | number, recipeSlug: string | number) => `${prefix}/explore/recipes/${groupSlug}/${recipeSlug}`,
recipesGroupSlug: (groupSlug: string | number) => `${exploreGroupSlug(groupSlug)}/recipes`,
recipesGroupSlugRecipeSlug: (groupSlug: string | number, recipeSlug: string | number) => `${exploreGroupSlug(groupSlug)}/recipes/${recipeSlug}`,
};
export class PublicRecipeApi extends BaseCRUDAPIReadOnly<Recipe> {

View file

@ -10,6 +10,8 @@ export interface AdminAboutInfo {
version: string;
demoStatus: boolean;
allowSignup: boolean;
defaultGroupSlug?: string | null;
defaultHouseholdSlug?: string | null;
enableOidc: boolean;
oidcRedirect: boolean;
oidcProviderName: string;
@ -18,8 +20,9 @@ export interface AdminAboutInfo {
apiPort: number;
apiDocs: boolean;
dbType: string;
dbUrl?: string;
dbUrl?: string | null;
defaultGroup: string;
defaultHousehold: string;
buildId: string;
recipeScraperVersion: string;
}
@ -37,7 +40,8 @@ export interface AppInfo {
version: string;
demoStatus: boolean;
allowSignup: boolean;
defaultGroupSlug?: string;
defaultGroupSlug?: string | null;
defaultHouseholdSlug?: string | null;
enableOidc: boolean;
oidcRedirect: boolean;
oidcProviderName: string;
@ -51,6 +55,7 @@ export interface AppStartupInfo {
export interface AppStatistics {
totalRecipes: number;
totalUsers: number;
totalHouseholds: number;
totalGroups: number;
uncategorizedRecipes: number;
untaggedRecipes: number;
@ -93,16 +98,16 @@ export interface ChowdownURL {
export interface CommentImport {
name: string;
status: boolean;
exception?: string;
exception?: string | null;
}
export interface CreateBackup {
tag?: string;
tag?: string | null;
options: BackupOptions;
templates?: string[];
templates?: string[] | null;
}
export interface CustomPageBase {
name: string;
slug?: string;
slug: string | null;
position: number;
categories?: RecipeCategoryResponse[];
}
@ -113,38 +118,41 @@ export interface RecipeCategoryResponse {
recipes?: RecipeSummary[];
}
export interface RecipeSummary {
id?: string;
id?: string | null;
userId?: string;
householdId?: string;
groupId?: string;
name?: string;
name?: string | null;
slug?: string;
image?: unknown;
recipeYield?: string;
totalTime?: string;
prepTime?: string;
cookTime?: string;
performTime?: string;
description?: string;
recipeCategory?: RecipeCategory[];
tags?: RecipeTag[];
recipeYield?: string | null;
totalTime?: string | null;
prepTime?: string | null;
cookTime?: string | null;
performTime?: string | null;
description?: string | null;
recipeCategory?: RecipeCategory[] | null;
tags?: RecipeTag[] | null;
tools?: RecipeTool[];
rating?: number;
orgURL?: string;
dateAdded?: string;
dateUpdated?: string;
createdAt?: string;
updateAt?: string;
lastMade?: string;
rating?: number | null;
orgURL?: string | null;
dateAdded?: string | null;
dateUpdated?: string | null;
createdAt?: string | null;
updatedAt?: string | null;
lastMade?: string | null;
}
export interface RecipeCategory {
id?: string;
id?: string | null;
name: string;
slug: string;
[k: string]: unknown;
}
export interface RecipeTag {
id?: string;
id?: string | null;
name: string;
slug: string;
[k: string]: unknown;
}
export interface RecipeTool {
id: string;
@ -155,11 +163,11 @@ export interface RecipeTool {
export interface CustomPageImport {
name: string;
status: boolean;
exception?: string;
exception?: string | null;
}
export interface CustomPageOut {
name: string;
slug?: string;
slug: string | null;
position: number;
categories?: RecipeCategoryResponse[];
id: number;
@ -169,7 +177,7 @@ export interface EmailReady {
}
export interface EmailSuccess {
success: boolean;
error?: string;
error?: string | null;
}
export interface EmailTest {
email: string;
@ -177,12 +185,12 @@ export interface EmailTest {
export interface GroupImport {
name: string;
status: boolean;
exception?: string;
exception?: string | null;
}
export interface ImportBase {
name: string;
status: boolean;
exception?: string;
exception?: string | null;
}
export interface ImportJob {
recipes?: boolean;
@ -217,8 +225,8 @@ export interface MigrationFile {
export interface MigrationImport {
name: string;
status: boolean;
exception?: string;
slug?: string;
exception?: string | null;
slug?: string | null;
}
export interface Migrations {
type: string;
@ -227,25 +235,26 @@ export interface Migrations {
export interface NotificationImport {
name: string;
status: boolean;
exception?: string;
exception?: string | null;
}
export interface OIDCInfo {
configurationUrl?: string;
clientId?: string;
configurationUrl: string | null;
clientId: string | null;
groupsClaim: string | null;
}
export interface RecipeImport {
name: string;
status: boolean;
exception?: string;
slug?: string;
exception?: string | null;
slug?: string | null;
}
export interface SettingsImport {
name: string;
status: boolean;
exception?: string;
exception?: string | null;
}
export interface UserImport {
name: string;
status: boolean;
exception?: string;
exception?: string | null;
}

View file

@ -8,7 +8,7 @@
export interface CreateCookBook {
name: string;
description?: string;
slug?: string;
slug?: string | null;
position?: number;
public?: boolean;
categories?: CategoryBase[];
@ -37,7 +37,7 @@ export interface RecipeTool {
export interface ReadCookBook {
name: string;
description?: string;
slug?: string;
slug?: string | null;
position?: number;
public?: boolean;
categories?: CategoryBase[];
@ -47,12 +47,13 @@ export interface ReadCookBook {
requireAllTags?: boolean;
requireAllTools?: boolean;
groupId: string;
householdId: string;
id: string;
}
export interface RecipeCookBook {
name: string;
description?: string;
slug?: string;
slug?: string | null;
position?: number;
public?: boolean;
categories?: CategoryBase[];
@ -62,47 +63,51 @@ export interface RecipeCookBook {
requireAllTags?: boolean;
requireAllTools?: boolean;
groupId: string;
householdId: string;
id: string;
recipes: RecipeSummary[];
}
export interface RecipeSummary {
id?: string;
id?: string | null;
userId?: string;
householdId?: string;
groupId?: string;
name?: string;
name?: string | null;
slug?: string;
image?: unknown;
recipeYield?: string;
totalTime?: string;
prepTime?: string;
cookTime?: string;
performTime?: string;
description?: string;
recipeCategory?: RecipeCategory[];
tags?: RecipeTag[];
recipeYield?: string | null;
totalTime?: string | null;
prepTime?: string | null;
cookTime?: string | null;
performTime?: string | null;
description?: string | null;
recipeCategory?: RecipeCategory[] | null;
tags?: RecipeTag[] | null;
tools?: RecipeTool[];
rating?: number;
orgURL?: string;
dateAdded?: string;
dateUpdated?: string;
createdAt?: string;
updateAt?: string;
lastMade?: string;
rating?: number | null;
orgURL?: string | null;
dateAdded?: string | null;
dateUpdated?: string | null;
createdAt?: string | null;
updatedAt?: string | null;
lastMade?: string | null;
}
export interface RecipeCategory {
id?: string;
id?: string | null;
name: string;
slug: string;
[k: string]: unknown;
}
export interface RecipeTag {
id?: string;
id?: string | null;
name: string;
slug: string;
[k: string]: unknown;
}
export interface SaveCookBook {
name: string;
description?: string;
slug?: string;
slug?: string | null;
position?: number;
public?: boolean;
categories?: CategoryBase[];
@ -112,11 +117,12 @@ export interface SaveCookBook {
requireAllTags?: boolean;
requireAllTools?: boolean;
groupId: string;
householdId: string;
}
export interface UpdateCookBook {
name: string;
description?: string;
slug?: string;
slug?: string | null;
position?: number;
public?: boolean;
categories?: CategoryBase[];
@ -126,5 +132,6 @@ export interface UpdateCookBook {
requireAllTags?: boolean;
requireAllTools?: boolean;
groupId: string;
householdId: string;
id: string;
}

View file

@ -5,10 +5,6 @@
/* Do not modify it by hand - just update the pydantic models and then re-run the script
*/
export type RecipeActionType =
| "link"
| "post";
export type WebhookType = "mealplan";
export type SupportedMigrations =
| "nextcloud"
| "chowdown"
@ -17,59 +13,23 @@ export type SupportedMigrations =
| "mealie_alpha"
| "tandoor"
| "plantoeat"
| "myrecipebox"
| "recipekeeper";
export interface CreateGroupPreferences {
privateGroup?: boolean;
firstDayOfWeek?: number;
recipePublic?: boolean;
recipeShowNutrition?: boolean;
recipeShowAssets?: boolean;
recipeLandscapeView?: boolean;
recipeDisableComments?: boolean;
recipeDisableAmount?: boolean;
groupId: string;
}
export interface CreateGroupRecipeAction {
actionType: RecipeActionType;
title: string;
url: string;
}
export interface CreateInviteToken {
uses: number;
}
export interface CreateWebhook {
enabled?: boolean;
name?: string;
url?: string;
webhookType?: WebhookType & string;
scheduledTime: string;
}
export interface DataMigrationCreate {
sourceType: SupportedMigrations;
}
export interface EmailInitationResponse {
success: boolean;
error?: string;
}
export interface EmailInvitation {
email: string;
token: string;
}
export interface GroupAdminUpdate {
id: string;
name: string;
preferences?: UpdateGroupPreferences;
preferences?: UpdateGroupPreferences | null;
}
export interface UpdateGroupPreferences {
privateGroup?: boolean;
firstDayOfWeek?: number;
recipePublic?: boolean;
recipeShowNutrition?: boolean;
recipeShowAssets?: boolean;
recipeLandscapeView?: boolean;
recipeDisableComments?: boolean;
recipeDisableAmount?: boolean;
}
export interface GroupDataExport {
id: string;
@ -80,140 +40,6 @@ export interface GroupDataExport {
size: string;
expires: string;
}
export interface GroupEventNotifierCreate {
name: string;
appriseUrl: string;
}
/**
* These events are in-sync with the EventTypes found in the EventBusService.
* If you modify this, make sure to update the EventBusService as well.
*/
export interface GroupEventNotifierOptions {
testMessage?: boolean;
webhookTask?: boolean;
recipeCreated?: boolean;
recipeUpdated?: boolean;
recipeDeleted?: boolean;
userSignup?: boolean;
dataMigrations?: boolean;
dataExport?: boolean;
dataImport?: boolean;
mealplanEntryCreated?: boolean;
shoppingListCreated?: boolean;
shoppingListUpdated?: boolean;
shoppingListDeleted?: boolean;
cookbookCreated?: boolean;
cookbookUpdated?: boolean;
cookbookDeleted?: boolean;
tagCreated?: boolean;
tagUpdated?: boolean;
tagDeleted?: boolean;
categoryCreated?: boolean;
categoryUpdated?: boolean;
categoryDeleted?: boolean;
}
/**
* These events are in-sync with the EventTypes found in the EventBusService.
* If you modify this, make sure to update the EventBusService as well.
*/
export interface GroupEventNotifierOptionsOut {
testMessage?: boolean;
webhookTask?: boolean;
recipeCreated?: boolean;
recipeUpdated?: boolean;
recipeDeleted?: boolean;
userSignup?: boolean;
dataMigrations?: boolean;
dataExport?: boolean;
dataImport?: boolean;
mealplanEntryCreated?: boolean;
shoppingListCreated?: boolean;
shoppingListUpdated?: boolean;
shoppingListDeleted?: boolean;
cookbookCreated?: boolean;
cookbookUpdated?: boolean;
cookbookDeleted?: boolean;
tagCreated?: boolean;
tagUpdated?: boolean;
tagDeleted?: boolean;
categoryCreated?: boolean;
categoryUpdated?: boolean;
categoryDeleted?: boolean;
id: string;
}
/**
* These events are in-sync with the EventTypes found in the EventBusService.
* If you modify this, make sure to update the EventBusService as well.
*/
export interface GroupEventNotifierOptionsSave {
testMessage?: boolean;
webhookTask?: boolean;
recipeCreated?: boolean;
recipeUpdated?: boolean;
recipeDeleted?: boolean;
userSignup?: boolean;
dataMigrations?: boolean;
dataExport?: boolean;
dataImport?: boolean;
mealplanEntryCreated?: boolean;
shoppingListCreated?: boolean;
shoppingListUpdated?: boolean;
shoppingListDeleted?: boolean;
cookbookCreated?: boolean;
cookbookUpdated?: boolean;
cookbookDeleted?: boolean;
tagCreated?: boolean;
tagUpdated?: boolean;
tagDeleted?: boolean;
categoryCreated?: boolean;
categoryUpdated?: boolean;
categoryDeleted?: boolean;
notifierId: string;
}
export interface GroupEventNotifierOut {
id: string;
name: string;
enabled: boolean;
groupId: string;
options: GroupEventNotifierOptionsOut;
}
export interface GroupEventNotifierPrivate {
id: string;
name: string;
enabled: boolean;
groupId: string;
options: GroupEventNotifierOptionsOut;
appriseUrl: string;
}
export interface GroupEventNotifierSave {
name: string;
appriseUrl: string;
enabled?: boolean;
groupId: string;
options?: GroupEventNotifierOptions;
}
export interface GroupEventNotifierUpdate {
name: string;
appriseUrl?: string;
enabled?: boolean;
groupId: string;
options?: GroupEventNotifierOptions;
id: string;
}
export interface GroupRecipeActionOut {
actionType: RecipeActionType;
title: string;
url: string;
groupId: string;
id: string;
}
export interface GroupStatistics {
totalRecipes: number;
totalUsers: number;
totalCategories: number;
totalTags: number;
totalTools: number;
}
export interface GroupStorage {
usedStorageBytes: number;
usedStorageStr: string;
@ -222,408 +48,9 @@ export interface GroupStorage {
}
export interface ReadGroupPreferences {
privateGroup?: boolean;
firstDayOfWeek?: number;
recipePublic?: boolean;
recipeShowNutrition?: boolean;
recipeShowAssets?: boolean;
recipeLandscapeView?: boolean;
recipeDisableComments?: boolean;
recipeDisableAmount?: boolean;
groupId: string;
id: string;
}
export interface ReadInviteToken {
token: string;
usesLeft: number;
groupId: string;
}
export interface ReadWebhook {
enabled?: boolean;
name?: string;
url?: string;
webhookType?: WebhookType & string;
scheduledTime: string;
groupId: string;
id: string;
}
export interface SaveGroupRecipeAction {
actionType: RecipeActionType;
title: string;
url: string;
groupId: string;
}
export interface SaveInviteToken {
usesLeft: number;
groupId: string;
token: string;
}
export interface SaveWebhook {
enabled?: boolean;
name?: string;
url?: string;
webhookType?: WebhookType & string;
scheduledTime: string;
groupId: string;
}
export interface SeederConfig {
locale: string;
}
export interface SetPermissions {
userId: string;
canManage?: boolean;
canInvite?: boolean;
canOrganize?: boolean;
}
export interface ShoppingListAddRecipeParams {
recipeIncrementQuantity?: number;
recipeIngredients?: RecipeIngredient[];
}
export interface RecipeIngredient {
quantity?: number;
unit?: IngredientUnit | CreateIngredientUnit;
food?: IngredientFood | CreateIngredientFood;
note?: string;
isFood?: boolean;
disableAmount?: boolean;
display?: string;
title?: string;
originalText?: string;
referenceId?: string;
}
export interface IngredientUnit {
name: string;
pluralName?: string;
description?: string;
extras?: {
[k: string]: unknown;
};
fraction?: boolean;
abbreviation?: string;
pluralAbbreviation?: string;
useAbbreviation?: boolean;
aliases?: IngredientUnitAlias[];
id: string;
createdAt?: string;
updateAt?: string;
}
export interface IngredientUnitAlias {
name: string;
}
export interface CreateIngredientUnit {
name: string;
pluralName?: string;
description?: string;
extras?: {
[k: string]: unknown;
};
fraction?: boolean;
abbreviation?: string;
pluralAbbreviation?: string;
useAbbreviation?: boolean;
aliases?: CreateIngredientUnitAlias[];
}
export interface CreateIngredientUnitAlias {
name: string;
}
export interface IngredientFood {
name: string;
pluralName?: string;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
aliases?: IngredientFoodAlias[];
id: string;
label?: MultiPurposeLabelSummary;
createdAt?: string;
updateAt?: string;
}
export interface IngredientFoodAlias {
name: string;
}
export interface MultiPurposeLabelSummary {
name: string;
color?: string;
groupId: string;
id: string;
}
export interface CreateIngredientFood {
name: string;
pluralName?: string;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
aliases?: CreateIngredientFoodAlias[];
}
export interface CreateIngredientFoodAlias {
name: string;
}
export interface ShoppingListCreate {
name?: string;
extras?: {
[k: string]: unknown;
};
createdAt?: string;
updateAt?: string;
}
export interface ShoppingListItemBase {
quantity?: number;
unit?: IngredientUnit | CreateIngredientUnit;
food?: IngredientFood | CreateIngredientFood;
note?: string;
isFood?: boolean;
disableAmount?: boolean;
display?: string;
shoppingListId: string;
checked?: boolean;
position?: number;
foodId?: string;
labelId?: string;
unitId?: string;
extras?: {
[k: string]: unknown;
};
}
export interface ShoppingListItemCreate {
quantity?: number;
unit?: IngredientUnit | CreateIngredientUnit;
food?: IngredientFood | CreateIngredientFood;
note?: string;
isFood?: boolean;
disableAmount?: boolean;
display?: string;
shoppingListId: string;
checked?: boolean;
position?: number;
foodId?: string;
labelId?: string;
unitId?: string;
extras?: {
[k: string]: unknown;
};
recipeReferences?: ShoppingListItemRecipeRefCreate[];
}
export interface ShoppingListItemRecipeRefCreate {
recipeId: string;
recipeQuantity?: number;
recipeScale?: number;
recipeNote?: string;
}
export interface ShoppingListItemOut {
quantity?: number;
unit?: IngredientUnit;
food?: IngredientFood;
note?: string;
isFood?: boolean;
disableAmount?: boolean;
display?: string;
shoppingListId: string;
checked?: boolean;
position?: number;
foodId?: string;
labelId?: string;
unitId?: string;
extras?: {
[k: string]: unknown;
};
id: string;
label?: MultiPurposeLabelSummary;
recipeReferences?: ShoppingListItemRecipeRefOut[];
createdAt?: string;
updateAt?: string;
}
export interface ShoppingListItemRecipeRefOut {
recipeId: string;
recipeQuantity?: number;
recipeScale?: number;
recipeNote?: string;
id: string;
shoppingListItemId: string;
}
export interface ShoppingListItemRecipeRefUpdate {
recipeId: string;
recipeQuantity?: number;
recipeScale?: number;
recipeNote?: string;
id: string;
shoppingListItemId: string;
}
export interface ShoppingListItemUpdate {
quantity?: number;
unit?: IngredientUnit | CreateIngredientUnit;
food?: IngredientFood | CreateIngredientFood;
note?: string;
isFood?: boolean;
disableAmount?: boolean;
display?: string;
shoppingListId: string;
checked?: boolean;
position?: number;
foodId?: string;
labelId?: string;
unitId?: string;
extras?: {
[k: string]: unknown;
};
recipeReferences?: (ShoppingListItemRecipeRefCreate | ShoppingListItemRecipeRefUpdate)[];
}
/**
* Only used for bulk update operations where the shopping list item id isn't already supplied
*/
export interface ShoppingListItemUpdateBulk {
quantity?: number;
unit?: IngredientUnit | CreateIngredientUnit;
food?: IngredientFood | CreateIngredientFood;
note?: string;
isFood?: boolean;
disableAmount?: boolean;
display?: string;
shoppingListId: string;
checked?: boolean;
position?: number;
foodId?: string;
labelId?: string;
unitId?: string;
extras?: {
[k: string]: unknown;
};
recipeReferences?: (ShoppingListItemRecipeRefCreate | ShoppingListItemRecipeRefUpdate)[];
id: string;
}
/**
* Container for bulk shopping list item changes
*/
export interface ShoppingListItemsCollectionOut {
createdItems?: ShoppingListItemOut[];
updatedItems?: ShoppingListItemOut[];
deletedItems?: ShoppingListItemOut[];
}
export interface ShoppingListMultiPurposeLabelCreate {
shoppingListId: string;
labelId: string;
position?: number;
}
export interface ShoppingListMultiPurposeLabelOut {
shoppingListId: string;
labelId: string;
position?: number;
id: string;
label: MultiPurposeLabelSummary;
}
export interface ShoppingListMultiPurposeLabelUpdate {
shoppingListId: string;
labelId: string;
position?: number;
id: string;
}
export interface ShoppingListOut {
name?: string;
extras?: {
[k: string]: unknown;
};
createdAt?: string;
updateAt?: string;
groupId: string;
userId: string;
id: string;
listItems?: ShoppingListItemOut[];
recipeReferences: ShoppingListRecipeRefOut[];
labelSettings: ShoppingListMultiPurposeLabelOut[];
}
export interface ShoppingListRecipeRefOut {
id: string;
shoppingListId: string;
recipeId: string;
recipeQuantity: number;
recipe: RecipeSummary;
}
export interface RecipeSummary {
id?: string;
userId?: string;
groupId?: string;
name?: string;
slug?: string;
image?: unknown;
recipeYield?: string;
totalTime?: string;
prepTime?: string;
cookTime?: string;
performTime?: string;
description?: string;
recipeCategory?: RecipeCategory[];
tags?: RecipeTag[];
tools?: RecipeTool[];
rating?: number;
orgURL?: string;
dateAdded?: string;
dateUpdated?: string;
createdAt?: string;
updateAt?: string;
lastMade?: string;
}
export interface RecipeCategory {
id?: string;
name: string;
slug: string;
}
export interface RecipeTag {
id?: string;
name: string;
slug: string;
}
export interface RecipeTool {
id: string;
name: string;
slug: string;
onHand?: boolean;
}
export interface ShoppingListRemoveRecipeParams {
recipeDecrementQuantity?: number;
}
export interface ShoppingListSave {
name?: string;
extras?: {
[k: string]: unknown;
};
createdAt?: string;
updateAt?: string;
groupId: string;
userId: string;
}
export interface ShoppingListSummary {
name?: string;
extras?: {
[k: string]: unknown;
};
createdAt?: string;
updateAt?: string;
groupId: string;
userId: string;
id: string;
recipeReferences: ShoppingListRecipeRefOut[];
labelSettings: ShoppingListMultiPurposeLabelOut[];
}
export interface ShoppingListUpdate {
name?: string;
extras?: {
[k: string]: unknown;
};
createdAt?: string;
updateAt?: string;
groupId: string;
userId: string;
id: string;
listItems?: ShoppingListItemOut[];
}
export interface RecipeIngredientBase {
quantity?: number;
unit?: IngredientUnit | CreateIngredientUnit;
food?: IngredientFood | CreateIngredientFood;
note?: string;
isFood?: boolean;
disableAmount?: boolean;
display?: string;
}

View file

@ -0,0 +1,664 @@
/* tslint:disable */
/* eslint-disable */
/**
/* This file was automatically generated from pydantic models by running pydantic2ts.
/* Do not modify it by hand - just update the pydantic models and then re-run the script
*/
export type GroupRecipeActionType = "link" | "post";
export type WebhookType = "mealplan";
export interface CreateGroupRecipeAction {
actionType: GroupRecipeActionType;
title: string;
url: string;
}
export interface CreateHouseholdPreferences {
privateHousehold?: boolean;
firstDayOfWeek?: number;
recipePublic?: boolean;
recipeShowNutrition?: boolean;
recipeShowAssets?: boolean;
recipeLandscapeView?: boolean;
recipeDisableComments?: boolean;
recipeDisableAmount?: boolean;
}
export interface CreateInviteToken {
uses: number;
}
export interface CreateWebhook {
enabled?: boolean;
name?: string;
url?: string;
webhookType?: WebhookType & string;
scheduledTime: string;
}
export interface EmailInitationResponse {
success: boolean;
error?: string | null;
}
export interface EmailInvitation {
email: string;
token: string;
}
export interface GroupEventNotifierCreate {
name: string;
appriseUrl?: string | null;
}
/**
* These events are in-sync with the EventTypes found in the EventBusService.
* If you modify this, make sure to update the EventBusService as well.
*/
export interface GroupEventNotifierOptions {
testMessage?: boolean;
webhookTask?: boolean;
recipeCreated?: boolean;
recipeUpdated?: boolean;
recipeDeleted?: boolean;
userSignup?: boolean;
dataMigrations?: boolean;
dataExport?: boolean;
dataImport?: boolean;
mealplanEntryCreated?: boolean;
shoppingListCreated?: boolean;
shoppingListUpdated?: boolean;
shoppingListDeleted?: boolean;
cookbookCreated?: boolean;
cookbookUpdated?: boolean;
cookbookDeleted?: boolean;
tagCreated?: boolean;
tagUpdated?: boolean;
tagDeleted?: boolean;
categoryCreated?: boolean;
categoryUpdated?: boolean;
categoryDeleted?: boolean;
}
export interface GroupEventNotifierOptionsOut {
testMessage?: boolean;
webhookTask?: boolean;
recipeCreated?: boolean;
recipeUpdated?: boolean;
recipeDeleted?: boolean;
userSignup?: boolean;
dataMigrations?: boolean;
dataExport?: boolean;
dataImport?: boolean;
mealplanEntryCreated?: boolean;
shoppingListCreated?: boolean;
shoppingListUpdated?: boolean;
shoppingListDeleted?: boolean;
cookbookCreated?: boolean;
cookbookUpdated?: boolean;
cookbookDeleted?: boolean;
tagCreated?: boolean;
tagUpdated?: boolean;
tagDeleted?: boolean;
categoryCreated?: boolean;
categoryUpdated?: boolean;
categoryDeleted?: boolean;
id: string;
}
export interface GroupEventNotifierOptionsSave {
testMessage?: boolean;
webhookTask?: boolean;
recipeCreated?: boolean;
recipeUpdated?: boolean;
recipeDeleted?: boolean;
userSignup?: boolean;
dataMigrations?: boolean;
dataExport?: boolean;
dataImport?: boolean;
mealplanEntryCreated?: boolean;
shoppingListCreated?: boolean;
shoppingListUpdated?: boolean;
shoppingListDeleted?: boolean;
cookbookCreated?: boolean;
cookbookUpdated?: boolean;
cookbookDeleted?: boolean;
tagCreated?: boolean;
tagUpdated?: boolean;
tagDeleted?: boolean;
categoryCreated?: boolean;
categoryUpdated?: boolean;
categoryDeleted?: boolean;
notifierId: string;
}
export interface GroupEventNotifierOut {
id: string;
name: string;
enabled: boolean;
groupId: string;
householdId: string;
options: GroupEventNotifierOptionsOut;
}
export interface GroupEventNotifierPrivate {
id: string;
name: string;
enabled: boolean;
groupId: string;
householdId: string;
options: GroupEventNotifierOptionsOut;
appriseUrl: string;
}
export interface GroupEventNotifierSave {
name: string;
appriseUrl?: string | null;
enabled?: boolean;
groupId: string;
householdId: string;
options?: GroupEventNotifierOptions;
}
export interface GroupEventNotifierUpdate {
name: string;
appriseUrl?: string | null;
enabled?: boolean;
groupId: string;
householdId: string;
options?: GroupEventNotifierOptions;
id: string;
}
export interface GroupRecipeActionOut {
actionType: GroupRecipeActionType;
title: string;
url: string;
groupId: string;
householdId: string;
id: string;
}
export interface HouseholdCreate {
groupId?: string | null;
name: string;
}
export interface HouseholdInDB {
groupId: string;
name: string;
id: string;
slug: string;
preferences?: ReadHouseholdPreferences | null;
group: string;
users?: HouseholdUserSummary[] | null;
webhooks?: ReadWebhook[];
}
export interface ReadHouseholdPreferences {
privateHousehold?: boolean;
firstDayOfWeek?: number;
recipePublic?: boolean;
recipeShowNutrition?: boolean;
recipeShowAssets?: boolean;
recipeLandscapeView?: boolean;
recipeDisableComments?: boolean;
recipeDisableAmount?: boolean;
id: string;
}
export interface HouseholdUserSummary {
id: string;
fullName: string;
}
export interface ReadWebhook {
enabled?: boolean;
name?: string;
url?: string;
webhookType?: WebhookType & string;
scheduledTime: string;
groupId: string;
householdId: string;
id: string;
}
export interface HouseholdSave {
groupId: string;
name: string;
}
export interface HouseholdStatistics {
totalRecipes: number;
totalUsers: number;
totalCategories: number;
totalTags: number;
totalTools: number;
}
export interface HouseholdSummary {
groupId: string;
name: string;
id: string;
slug: string;
preferences?: ReadHouseholdPreferences | null;
}
export interface ReadInviteToken {
token: string;
usesLeft: number;
groupId: string;
householdId: string;
}
export interface SaveGroupRecipeAction {
actionType: GroupRecipeActionType;
title: string;
url: string;
groupId: string;
householdId: string;
}
export interface SaveHouseholdPreferences {
privateHousehold?: boolean;
firstDayOfWeek?: number;
recipePublic?: boolean;
recipeShowNutrition?: boolean;
recipeShowAssets?: boolean;
recipeLandscapeView?: boolean;
recipeDisableComments?: boolean;
recipeDisableAmount?: boolean;
householdId: string;
}
export interface SaveInviteToken {
usesLeft: number;
groupId: string;
householdId: string;
token: string;
}
export interface SaveWebhook {
enabled?: boolean;
name?: string;
url?: string;
webhookType?: WebhookType & string;
scheduledTime: string;
groupId: string;
householdId: string;
}
export interface SetPermissions {
userId: string;
canManage?: boolean;
canInvite?: boolean;
canOrganize?: boolean;
}
export interface ShoppingListAddRecipeParams {
recipeIncrementQuantity?: number;
recipeIngredients?: RecipeIngredient[] | null;
}
export interface RecipeIngredient {
quantity?: number | null;
unit?: IngredientUnit | CreateIngredientUnit | null;
food?: IngredientFood | CreateIngredientFood | null;
note?: string | null;
isFood?: boolean | null;
disableAmount?: boolean;
display?: string;
title?: string | null;
originalText?: string | null;
referenceId?: string;
}
export interface IngredientUnit {
id: string;
name: string;
pluralName?: string | null;
description?: string;
extras?: {
[k: string]: unknown;
} | null;
onHand?: boolean;
fraction?: boolean;
abbreviation?: string;
pluralAbbreviation?: string | null;
useAbbreviation?: boolean;
aliases?: IngredientUnitAlias[];
createdAt?: string | null;
updatedAt?: string | null;
}
export interface IngredientUnitAlias {
name: string;
[k: string]: unknown;
}
export interface CreateIngredientUnit {
id?: string | null;
name: string;
pluralName?: string | null;
description?: string;
extras?: {
[k: string]: unknown;
} | null;
onHand?: boolean;
fraction?: boolean;
abbreviation?: string;
pluralAbbreviation?: string | null;
useAbbreviation?: boolean;
aliases?: CreateIngredientUnitAlias[];
[k: string]: unknown;
}
export interface CreateIngredientUnitAlias {
name: string;
[k: string]: unknown;
}
export interface IngredientFood {
id: string;
name: string;
pluralName?: string | null;
description?: string;
extras?: {
[k: string]: unknown;
} | null;
onHand?: boolean;
labelId?: string | null;
aliases?: IngredientFoodAlias[];
label?: MultiPurposeLabelSummary | null;
createdAt?: string | null;
updatedAt?: string | null;
}
export interface IngredientFoodAlias {
name: string;
[k: string]: unknown;
}
export interface MultiPurposeLabelSummary {
name: string;
color?: string;
groupId: string;
id: string;
}
export interface CreateIngredientFood {
id?: string | null;
name: string;
pluralName?: string | null;
description?: string;
extras?: {
[k: string]: unknown;
} | null;
onHand?: boolean;
labelId?: string | null;
aliases?: CreateIngredientFoodAlias[];
[k: string]: unknown;
}
export interface CreateIngredientFoodAlias {
name: string;
[k: string]: unknown;
}
export interface ShoppingListCreate {
name?: string | null;
extras?: {
[k: string]: unknown;
} | null;
createdAt?: string | null;
updatedAt?: string | null;
}
export interface ShoppingListItemBase {
quantity?: number;
unit?: IngredientUnit | CreateIngredientUnit | null;
food?: IngredientFood | CreateIngredientFood | null;
note?: string | null;
isFood?: boolean;
disableAmount?: boolean | null;
display?: string;
shoppingListId: string;
checked?: boolean;
position?: number;
foodId?: string | null;
labelId?: string | null;
unitId?: string | null;
extras?: {
[k: string]: unknown;
} | null;
}
export interface ShoppingListItemCreate {
quantity?: number;
unit?: IngredientUnit | CreateIngredientUnit | null;
food?: IngredientFood | CreateIngredientFood | null;
note?: string | null;
isFood?: boolean;
disableAmount?: boolean | null;
display?: string;
shoppingListId: string;
checked?: boolean;
position?: number;
foodId?: string | null;
labelId?: string | null;
unitId?: string | null;
extras?: {
[k: string]: unknown;
} | null;
id?: string | null;
recipeReferences?: ShoppingListItemRecipeRefCreate[];
}
export interface ShoppingListItemRecipeRefCreate {
recipeId: string;
recipeQuantity?: number;
recipeScale?: number | null;
recipeNote?: string | null;
}
export interface ShoppingListItemOut {
quantity?: number;
unit?: IngredientUnit | null;
food?: IngredientFood | null;
note?: string | null;
isFood?: boolean;
disableAmount?: boolean | null;
display?: string;
shoppingListId: string;
checked?: boolean;
position?: number;
foodId?: string | null;
labelId?: string | null;
unitId?: string | null;
extras?: {
[k: string]: unknown;
} | null;
id: string;
groupId: string;
householdId: string;
label?: MultiPurposeLabelSummary | null;
recipeReferences?: ShoppingListItemRecipeRefOut[];
createdAt?: string | null;
updatedAt?: string | null;
}
export interface ShoppingListItemRecipeRefOut {
recipeId: string;
recipeQuantity?: number;
recipeScale?: number | null;
recipeNote?: string | null;
id: string;
shoppingListItemId: string;
}
export interface ShoppingListItemRecipeRefUpdate {
recipeId: string;
recipeQuantity?: number;
recipeScale?: number | null;
recipeNote?: string | null;
id: string;
shoppingListItemId: string;
}
export interface ShoppingListItemUpdate {
quantity?: number;
unit?: IngredientUnit | CreateIngredientUnit | null;
food?: IngredientFood | CreateIngredientFood | null;
note?: string | null;
isFood?: boolean;
disableAmount?: boolean | null;
display?: string;
shoppingListId: string;
checked?: boolean;
position?: number;
foodId?: string | null;
labelId?: string | null;
unitId?: string | null;
extras?: {
[k: string]: unknown;
} | null;
recipeReferences?: (ShoppingListItemRecipeRefCreate | ShoppingListItemRecipeRefUpdate)[];
}
/**
* Only used for bulk update operations where the shopping list item id isn't already supplied
*/
export interface ShoppingListItemUpdateBulk {
quantity?: number;
unit?: IngredientUnit | CreateIngredientUnit | null;
food?: IngredientFood | CreateIngredientFood | null;
note?: string | null;
isFood?: boolean;
disableAmount?: boolean | null;
display?: string;
shoppingListId: string;
checked?: boolean;
position?: number;
foodId?: string | null;
labelId?: string | null;
unitId?: string | null;
extras?: {
[k: string]: unknown;
} | null;
recipeReferences?: (ShoppingListItemRecipeRefCreate | ShoppingListItemRecipeRefUpdate)[];
id: string;
}
/**
* Container for bulk shopping list item changes
*/
export interface ShoppingListItemsCollectionOut {
createdItems?: ShoppingListItemOut[];
updatedItems?: ShoppingListItemOut[];
deletedItems?: ShoppingListItemOut[];
}
export interface ShoppingListMultiPurposeLabelCreate {
shoppingListId: string;
labelId: string;
position?: number;
}
export interface ShoppingListMultiPurposeLabelOut {
shoppingListId: string;
labelId: string;
position?: number;
id: string;
label: MultiPurposeLabelSummary;
}
export interface ShoppingListMultiPurposeLabelUpdate {
shoppingListId: string;
labelId: string;
position?: number;
id: string;
}
export interface ShoppingListOut {
name?: string | null;
extras?: {
[k: string]: unknown;
} | null;
createdAt?: string | null;
updatedAt?: string | null;
groupId: string;
userId: string;
id: string;
listItems?: ShoppingListItemOut[];
householdId: string;
recipeReferences?: ShoppingListRecipeRefOut[];
labelSettings?: ShoppingListMultiPurposeLabelOut[];
}
export interface ShoppingListRecipeRefOut {
id: string;
shoppingListId: string;
recipeId: string;
recipeQuantity: number;
recipe: RecipeSummary;
}
export interface RecipeSummary {
id?: string | null;
userId?: string;
householdId?: string;
groupId?: string;
name?: string | null;
slug?: string;
image?: unknown;
recipeYield?: string | null;
totalTime?: string | null;
prepTime?: string | null;
cookTime?: string | null;
performTime?: string | null;
description?: string | null;
recipeCategory?: RecipeCategory[] | null;
tags?: RecipeTag[] | null;
tools?: RecipeTool[];
rating?: number | null;
orgURL?: string | null;
dateAdded?: string | null;
dateUpdated?: string | null;
createdAt?: string | null;
updatedAt?: string | null;
lastMade?: string | null;
}
export interface RecipeCategory {
id?: string | null;
name: string;
slug: string;
[k: string]: unknown;
}
export interface RecipeTag {
id?: string | null;
name: string;
slug: string;
[k: string]: unknown;
}
export interface RecipeTool {
id: string;
name: string;
slug: string;
onHand?: boolean;
}
export interface ShoppingListRemoveRecipeParams {
recipeDecrementQuantity?: number;
}
export interface ShoppingListSave {
name?: string | null;
extras?: {
[k: string]: unknown;
} | null;
createdAt?: string | null;
updatedAt?: string | null;
groupId: string;
userId: string;
}
export interface ShoppingListSummary {
name?: string | null;
extras?: {
[k: string]: unknown;
} | null;
createdAt?: string | null;
updatedAt?: string | null;
groupId: string;
userId: string;
id: string;
householdId: string;
recipeReferences: ShoppingListRecipeRefOut[];
labelSettings: ShoppingListMultiPurposeLabelOut[];
}
export interface ShoppingListUpdate {
name?: string | null;
extras?: {
[k: string]: unknown;
} | null;
createdAt?: string | null;
updatedAt?: string | null;
groupId: string;
userId: string;
id: string;
listItems?: ShoppingListItemOut[];
}
export interface UpdateHousehold {
groupId: string;
name: string;
id: string;
slug: string;
}
export interface UpdateHouseholdAdmin {
groupId: string;
name: string;
id: string;
preferences?: UpdateHouseholdPreferences | null;
}
export interface UpdateHouseholdPreferences {
privateHousehold?: boolean;
firstDayOfWeek?: number;
recipePublic?: boolean;
recipeShowNutrition?: boolean;
recipeShowAssets?: boolean;
recipeLandscapeView?: boolean;
recipeDisableComments?: boolean;
recipeDisableAmount?: boolean;
}
export interface RecipeIngredientBase {
quantity?: number | null;
unit?: IngredientUnit | CreateIngredientUnit | null;
food?: IngredientFood | CreateIngredientFood | null;
note?: string | null;
isFood?: boolean | null;
disableAmount?: boolean | null;
display?: string;
}

View file

@ -19,46 +19,18 @@ export interface CreatePlanEntry {
entryType?: PlanEntryType & string;
title?: string;
text?: string;
recipeId?: string;
recipeId?: string | null;
}
export interface CreateRandomEntry {
date: string;
entryType?: PlanEntryType & string;
}
export interface ListItem {
title?: string;
title?: string | null;
text?: string;
quantity?: number;
checked?: boolean;
}
export interface MealDayIn {
date?: string;
meals: MealIn[];
}
export interface MealIn {
slug?: string;
name?: string;
description?: string;
}
export interface MealDayOut {
date?: string;
meals: MealIn[];
id: number;
}
export interface MealPlanIn {
group: string;
startDate: string;
endDate: string;
planDays: MealDayIn[];
}
export interface MealPlanOut {
group: string;
startDate: string;
endDate: string;
planDays: MealDayIn[];
id: number;
shoppingList?: number;
}
export interface PlanRulesCreate {
day?: PlanRulesDay & string;
entryType?: PlanRulesType & string;
@ -76,6 +48,7 @@ export interface PlanRulesOut {
categories?: Category[];
tags?: Tag[];
groupId: string;
householdId: string;
id: string;
}
export interface PlanRulesSave {
@ -84,51 +57,56 @@ export interface PlanRulesSave {
categories?: Category[];
tags?: Tag[];
groupId: string;
householdId: string;
}
export interface ReadPlanEntry {
date: string;
entryType?: PlanEntryType & string;
title?: string;
text?: string;
recipeId?: string;
recipeId?: string | null;
id: number;
groupId: string;
userId?: string;
recipe?: RecipeSummary;
userId?: string | null;
householdId: string;
recipe?: RecipeSummary | null;
}
export interface RecipeSummary {
id?: string;
id?: string | null;
userId?: string;
householdId?: string;
groupId?: string;
name?: string;
name?: string | null;
slug?: string;
image?: unknown;
recipeYield?: string;
totalTime?: string;
prepTime?: string;
cookTime?: string;
performTime?: string;
description?: string;
recipeCategory?: RecipeCategory[];
tags?: RecipeTag[];
recipeYield?: string | null;
totalTime?: string | null;
prepTime?: string | null;
cookTime?: string | null;
performTime?: string | null;
description?: string | null;
recipeCategory?: RecipeCategory[] | null;
tags?: RecipeTag[] | null;
tools?: RecipeTool[];
rating?: number;
orgURL?: string;
dateAdded?: string;
dateUpdated?: string;
createdAt?: string;
updateAt?: string;
lastMade?: string;
rating?: number | null;
orgURL?: string | null;
dateAdded?: string | null;
dateUpdated?: string | null;
createdAt?: string | null;
updatedAt?: string | null;
lastMade?: string | null;
}
export interface RecipeCategory {
id?: string;
id?: string | null;
name: string;
slug: string;
[k: string]: unknown;
}
export interface RecipeTag {
id?: string;
id?: string | null;
name: string;
slug: string;
[k: string]: unknown;
}
export interface RecipeTool {
id: string;
@ -141,18 +119,18 @@ export interface SavePlanEntry {
entryType?: PlanEntryType & string;
title?: string;
text?: string;
recipeId?: string;
recipeId?: string | null;
groupId: string;
userId?: string;
userId?: string | null;
}
export interface ShoppingListIn {
name: string;
group?: string;
group?: string | null;
items: ListItem[];
}
export interface ShoppingListOut {
name: string;
group?: string;
group?: string | null;
items: ListItem[];
id: number;
}
@ -161,8 +139,8 @@ export interface UpdatePlanEntry {
entryType?: PlanEntryType & string;
title?: string;
text?: string;
recipeId?: string;
recipeId?: string | null;
id: number;
groupId: string;
userId?: string;
userId?: string | null;
}

View file

@ -0,0 +1,65 @@
/* tslint:disable */
/* eslint-disable */
/**
/* This file was automatically generated from pydantic models by running pydantic2ts.
/* Do not modify it by hand - just update the pydantic models and then re-run the script
*/
export interface OpenAIIngredient {
/**
*
* The input is simply the ingredient string you are processing as-is. It is forbidden to
* modify this at all, you must provide the input exactly as you received it.
*
*/
input: string;
/**
*
* This value is a float between 0 - 100, where 100 is full confidence that the result is correct,
* and 0 is no confidence that the result is correct. If you're unable to parse anything,
* and you put the entire string in the notes, you should return 0 confidence. If you can easily
* parse the string into each component, then you should return a confidence of 100. If you have to
* guess which part is the unit and which part is the food, your confidence should be lower, such as 60.
* Even if there is no unit or note, if you're able to determine the food, you may use a higher confidence.
* If the entire ingredient consists of only a food, you can use a confidence of 100.
*
*/
confidence?: number | null;
/**
*
* The numerical representation of how much of this ingredient. For instance, if you receive
* "3 1/2 grams of minced garlic", the quantity is "3 1/2". Quantity may be represented as a whole number
* (integer), a float or decimal, or a fraction. You should output quantity in only whole numbers or
* floats, converting fractions into floats. Floats longer than 10 decimal places should be
* rounded to 10 decimal places.
*
*/
quantity?: number | null;
/**
*
* The unit of measurement for this ingredient. For instance, if you receive
* "2 lbs chicken breast", the unit is "lbs" (short for "pounds").
*
*/
unit?: string | null;
/**
*
* The actual physical ingredient used in the recipe. For instance, if you receive
* "3 cups of onions, chopped", the food is "onions".
*
*/
food?: string | null;
/**
*
* The rest of the text that represents more detail on how to prepare the ingredient.
* Anything that is not one of the above should be the note. For instance, if you receive
* "one can of butter beans, drained" the note would be "drained". If you receive
* "3 cloves of garlic peeled and finely chopped", the note would be "peeled and finely chopped".
*
*/
note?: string | null;
}
export interface OpenAIIngredients {
ingredients?: OpenAIIngredient[];
}
export interface OpenAIBase {}

View file

@ -55,29 +55,32 @@ export interface CategorySave {
groupId: string;
}
export interface CreateIngredientFood {
id?: string | null;
name: string;
pluralName?: string;
pluralName?: string | null;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
aliases?: CreateIngredientFoodAlias[];
} | null;
onHand?: boolean;
labelId?: string | null;
aliases?: CreateIngredientFoodAlias[];
}
export interface CreateIngredientFoodAlias {
name: string;
}
export interface CreateIngredientUnit {
id?: string | null;
name: string;
pluralName?: string;
pluralName?: string | null;
description?: string;
extras?: {
[k: string]: unknown;
};
} | null;
onHand?: boolean;
fraction?: boolean;
abbreviation?: string;
pluralAbbreviation?: string;
pluralAbbreviation?: string | null;
useAbbreviation?: boolean;
aliases?: CreateIngredientUnitAlias[];
}
@ -89,16 +92,16 @@ export interface CreateRecipe {
}
export interface CreateRecipeBulk {
url: string;
categories?: RecipeCategory[];
tags?: RecipeTag[];
categories?: RecipeCategory[] | null;
tags?: RecipeTag[] | null;
}
export interface RecipeCategory {
id?: string;
id?: string | null;
name: string;
slug: string;
}
export interface RecipeTag {
id?: string;
id?: string | null;
name: string;
slug: string;
}
@ -116,27 +119,27 @@ export interface ExportRecipes {
exportType?: ExportTypes & string;
}
export interface IngredientConfidence {
average?: number;
comment?: number;
name?: number;
unit?: number;
quantity?: number;
food?: number;
average?: number | null;
comment?: number | null;
name?: number | null;
unit?: number | null;
quantity?: number | null;
food?: number | null;
}
export interface IngredientFood {
id: string;
name: string;
pluralName?: string;
pluralName?: string | null;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
aliases?: IngredientFoodAlias[];
id: string;
label?: MultiPurposeLabelSummary;
createdAt?: string;
updateAt?: string;
} | null;
onHand?: boolean;
labelId?: string | null;
aliases?: IngredientFoodAlias[];
label?: MultiPurposeLabelSummary | null;
createdAt?: string | null;
updatedAt?: string | null;
}
export interface IngredientFoodAlias {
name: string;
@ -151,27 +154,28 @@ export interface MultiPurposeLabelSummary {
* A list of ingredient references.
*/
export interface IngredientReferences {
referenceId?: string;
referenceId?: string | null;
}
export interface IngredientRequest {
parser?: RegisteredParser & string;
ingredient: string;
}
export interface IngredientUnit {
id: string;
name: string;
pluralName?: string;
pluralName?: string | null;
description?: string;
extras?: {
[k: string]: unknown;
};
} | null;
onHand?: boolean;
fraction?: boolean;
abbreviation?: string;
pluralAbbreviation?: string;
pluralAbbreviation?: string | null;
useAbbreviation?: boolean;
aliases?: IngredientUnitAlias[];
id: string;
createdAt?: string;
updateAt?: string;
createdAt?: string | null;
updatedAt?: string | null;
}
export interface IngredientUnitAlias {
name: string;
@ -189,64 +193,65 @@ export interface MergeUnit {
toUnit: string;
}
export interface Nutrition {
calories?: string;
fatContent?: string;
proteinContent?: string;
carbohydrateContent?: string;
fiberContent?: string;
sodiumContent?: string;
sugarContent?: string;
calories?: string | null;
fatContent?: string | null;
proteinContent?: string | null;
carbohydrateContent?: string | null;
fiberContent?: string | null;
sodiumContent?: string | null;
sugarContent?: string | null;
}
export interface ParsedIngredient {
input?: string;
input?: string | null;
confidence?: IngredientConfidence;
ingredient: RecipeIngredient;
}
export interface RecipeIngredient {
quantity?: number;
unit?: IngredientUnit | CreateIngredientUnit;
food?: IngredientFood | CreateIngredientFood;
note?: string;
isFood?: boolean;
quantity?: number | null;
unit?: IngredientUnit | CreateIngredientUnit | null;
food?: IngredientFood | CreateIngredientFood | null;
note?: string | null;
isFood?: boolean | null;
disableAmount?: boolean;
display?: string;
title?: string;
originalText?: string;
title?: string | null;
originalText?: string | null;
referenceId?: string;
}
export interface Recipe {
id?: string;
id?: string | null;
userId?: string;
householdId?: string;
groupId?: string;
name?: string;
name?: string | null;
slug?: string;
image?: unknown;
recipeYield?: string;
totalTime?: string;
prepTime?: string;
cookTime?: string;
performTime?: string;
description?: string;
recipeCategory?: RecipeCategory[];
tags?: RecipeTag[];
recipeYield?: string | null;
totalTime?: string | null;
prepTime?: string | null;
cookTime?: string | null;
performTime?: string | null;
description?: string | null;
recipeCategory?: RecipeCategory[] | null;
tags?: RecipeTag[] | null;
tools?: RecipeTool[];
rating?: number;
orgURL?: string;
dateAdded?: string;
dateUpdated?: string;
createdAt?: string;
updateAt?: string;
lastMade?: string;
rating?: number | null;
orgURL?: string | null;
dateAdded?: string | null;
dateUpdated?: string | null;
createdAt?: string | null;
updatedAt?: string | null;
lastMade?: string | null;
recipeIngredient?: RecipeIngredient[];
recipeInstructions?: RecipeStep[];
nutrition?: Nutrition;
settings?: RecipeSettings;
assets?: RecipeAsset[];
notes?: RecipeNote[];
recipeInstructions?: RecipeStep[] | null;
nutrition?: Nutrition | null;
settings?: RecipeSettings | null;
assets?: RecipeAsset[] | null;
notes?: RecipeNote[] | null;
extras?: {
[k: string]: unknown;
};
comments?: RecipeCommentOut[];
} | null;
comments?: RecipeCommentOut[] | null;
}
export interface RecipeTool {
id: string;
@ -255,15 +260,15 @@ export interface RecipeTool {
onHand?: boolean;
}
export interface RecipeStep {
id?: string;
title?: string;
id?: string | null;
title?: string | null;
text: string;
ingredientReferences?: IngredientReferences[];
}
export interface RecipeAsset {
name: string;
icon: string;
fileName?: string;
fileName?: string | null;
}
export interface RecipeNote {
title: string;
@ -274,13 +279,13 @@ export interface RecipeCommentOut {
text: string;
id: string;
createdAt: string;
updateAt: string;
updatedAt: string;
userId: string;
user: UserBase;
}
export interface UserBase {
id: string;
username?: string;
username?: string | null;
admin: boolean;
}
export interface RecipeCategoryResponse {
@ -290,28 +295,29 @@ export interface RecipeCategoryResponse {
recipes?: RecipeSummary[];
}
export interface RecipeSummary {
id?: string;
id?: string | null;
userId?: string;
householdId?: string;
groupId?: string;
name?: string;
name?: string | null;
slug?: string;
image?: unknown;
recipeYield?: string;
totalTime?: string;
prepTime?: string;
cookTime?: string;
performTime?: string;
description?: string;
recipeCategory?: RecipeCategory[];
tags?: RecipeTag[];
recipeYield?: string | null;
totalTime?: string | null;
prepTime?: string | null;
cookTime?: string | null;
performTime?: string | null;
description?: string | null;
recipeCategory?: RecipeCategory[] | null;
tags?: RecipeTag[] | null;
tools?: RecipeTool[];
rating?: number;
orgURL?: string;
dateAdded?: string;
dateUpdated?: string;
createdAt?: string;
updateAt?: string;
lastMade?: string;
rating?: number | null;
orgURL?: string | null;
dateAdded?: string | null;
dateUpdated?: string | null;
createdAt?: string | null;
updatedAt?: string | null;
lastMade?: string | null;
}
export interface RecipeCommentCreate {
recipeId: string;
@ -327,15 +333,15 @@ export interface RecipeCommentUpdate {
text: string;
}
export interface RecipeDuplicate {
name?: string;
name?: string | null;
}
export interface RecipeIngredientBase {
quantity?: number;
unit?: IngredientUnit | CreateIngredientUnit;
food?: IngredientFood | CreateIngredientFood;
note?: string;
isFood?: boolean;
disableAmount?: boolean;
quantity?: number | null;
unit?: IngredientUnit | CreateIngredientUnit | null;
food?: IngredientFood | CreateIngredientFood | null;
note?: string | null;
isFood?: boolean | null;
disableAmount?: boolean | null;
display?: string;
}
export interface RecipeLastMade {
@ -379,17 +385,17 @@ export interface RecipeTimelineEventCreate {
userId: string;
subject: string;
eventType: TimelineEventType;
eventMessage?: string;
image?: TimelineEventImage & string;
eventMessage?: string | null;
image?: TimelineEventImage | null;
timestamp?: string;
}
export interface RecipeTimelineEventIn {
recipeId: string;
userId?: string;
userId?: string | null;
subject: string;
eventType: TimelineEventType;
eventMessage?: string;
image?: TimelineEventImage & string;
eventMessage?: string | null;
image?: TimelineEventImage | null;
timestamp?: string;
}
export interface RecipeTimelineEventOut {
@ -397,17 +403,19 @@ export interface RecipeTimelineEventOut {
userId: string;
subject: string;
eventType: TimelineEventType;
eventMessage?: string;
image?: TimelineEventImage & string;
eventMessage?: string | null;
image?: TimelineEventImage | null;
timestamp?: string;
id: string;
groupId: string;
householdId: string;
createdAt: string;
updateAt: string;
updatedAt: string;
}
export interface RecipeTimelineEventUpdate {
subject: string;
eventMessage?: string;
image?: TimelineEventImage;
eventMessage?: string | null;
image?: TimelineEventImage | null;
}
export interface RecipeToolCreate {
name: string;
@ -435,26 +443,30 @@ export interface RecipeZipTokenResponse {
token: string;
}
export interface SaveIngredientFood {
id?: string | null;
name: string;
pluralName?: string;
pluralName?: string | null;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
} | null;
onHand?: boolean;
labelId?: string | null;
aliases?: CreateIngredientFoodAlias[];
groupId: string;
}
export interface SaveIngredientUnit {
id?: string | null;
name: string;
pluralName?: string;
pluralName?: string | null;
description?: string;
extras?: {
[k: string]: unknown;
};
} | null;
onHand?: boolean;
fraction?: boolean;
abbreviation?: string;
pluralAbbreviation?: string;
pluralAbbreviation?: string | null;
useAbbreviation?: boolean;
aliases?: CreateIngredientUnitAlias[];
groupId: string;
@ -465,8 +477,9 @@ export interface ScrapeRecipe {
}
export interface ScrapeRecipeTest {
url: string;
useOpenAI?: boolean;
}
export interface SlugResponse { }
export interface SlugResponse {}
export interface TagIn {
name: string;
}
@ -481,12 +494,14 @@ export interface TagSave {
groupId: string;
}
export interface UnitFoodBase {
id?: string | null;
name: string;
pluralName?: string;
pluralName?: string | null;
description?: string;
extras?: {
[k: string]: unknown;
};
} | null;
onHand?: boolean;
}
export interface UpdateImageResponse {
image: string;

View file

@ -11,7 +11,7 @@ export type OrderDirection = "asc" | "desc";
export interface ErrorResponse {
message: string;
error?: boolean;
exception?: string;
exception?: string | null;
}
export interface FileTokenResponse {
fileToken: string;
@ -19,19 +19,19 @@ export interface FileTokenResponse {
export interface PaginationQuery {
page?: number;
perPage?: number;
orderBy?: string;
orderByNullPosition?: OrderByNullPosition;
orderBy?: string | null;
orderByNullPosition?: OrderByNullPosition | null;
orderDirection?: OrderDirection & string;
queryFilter?: string;
paginationSeed?: string;
queryFilter?: string | null;
paginationSeed?: string | null;
}
export interface RecipeSearchQuery {
cookbook?: string;
cookbook?: string | null;
requireAllCategories?: boolean;
requireAllTags?: boolean;
requireAllTools?: boolean;
requireAllFoods?: boolean;
search?: string;
search?: string | null;
}
export interface SuccessResponse {
message: string;

View file

@ -19,8 +19,9 @@ export interface CreateToken {
token: string;
}
export interface CreateUserRegistration {
group?: string;
groupToken?: string;
group?: string | null;
household?: string | null;
groupToken?: string | null;
email: string;
username: string;
fullName: string;
@ -45,21 +46,19 @@ export interface ForgotPassword {
export interface GroupBase {
name: string;
}
export interface GroupHouseholdSummary {
id: string;
name: string;
}
export interface GroupInDB {
name: string;
id: string;
slug: string;
categories?: CategoryBase[];
categories?: CategoryBase[] | null;
webhooks?: ReadWebhook[];
users?: UserOut[];
preferences?: ReadGroupPreferences;
}
export interface GroupSummary {
name: string;
id: string;
slug: string;
preferences?: ReadGroupPreferences;
households?: GroupHouseholdSummary[] | null;
users?: UserSummary[] | null;
preferences?: ReadGroupPreferences | null;
}
export interface CategoryBase {
name: string;
@ -73,43 +72,24 @@ export interface ReadWebhook {
webhookType?: WebhookType & string;
scheduledTime: string;
groupId: string;
householdId: string;
id: string;
}
export interface UserOut {
export interface UserSummary {
id: string;
username?: string;
fullName?: string;
email: string;
authMethod?: AuthMethod & string;
admin?: boolean;
group: string;
advanced?: boolean;
canInvite?: boolean;
canManage?: boolean;
canOrganize?: boolean;
groupId: string;
groupSlug: string;
tokens?: LongLiveTokenOut[];
cacheKey: string;
}
export interface LongLiveTokenOut {
token: string;
name: string;
id: number;
createdAt?: string;
fullName: string;
}
export interface ReadGroupPreferences {
privateGroup?: boolean;
firstDayOfWeek?: number;
recipePublic?: boolean;
recipeShowNutrition?: boolean;
recipeShowAssets?: boolean;
recipeLandscapeView?: boolean;
recipeDisableComments?: boolean;
recipeDisableAmount?: boolean;
groupId: string;
id: string;
}
export interface GroupSummary {
name: string;
id: string;
slug: string;
preferences?: ReadGroupPreferences | null;
}
export interface LongLiveTokenIn {
name: string;
integrationId?: string;
@ -124,23 +104,32 @@ export interface LongLiveTokenInDB {
}
export interface PrivateUser {
id: string;
username?: string;
fullName?: string;
username?: string | null;
fullName?: string | null;
email: string;
authMethod?: AuthMethod & string;
admin?: boolean;
group: string;
household: string;
advanced?: boolean;
canInvite?: boolean;
canManage?: boolean;
canOrganize?: boolean;
groupId: string;
groupSlug: string;
tokens?: LongLiveTokenOut[];
householdId: string;
householdSlug: string;
tokens?: LongLiveTokenOut[] | null;
cacheKey: string;
password: string;
loginAttemps?: number;
lockedAt?: string;
lockedAt?: string | null;
}
export interface LongLiveTokenOut {
token: string;
name: string;
id: number;
createdAt?: string | null;
}
export interface OIDCRequest {
id_token: string;
@ -168,8 +157,8 @@ export interface Token {
token_type: string;
}
export interface TokenData {
user_id?: string;
username?: string;
user_id?: string | null;
username?: string | null;
}
export interface UnlockResults {
unlocked?: number;
@ -178,7 +167,7 @@ export interface UpdateGroup {
name: string;
id: string;
slug: string;
categories?: CategoryBase[];
categories?: CategoryBase[] | null;
webhooks?: CreateWebhook[];
}
export interface CreateWebhook {
@ -189,53 +178,75 @@ export interface CreateWebhook {
scheduledTime: string;
}
export interface UserBase {
id?: string;
username?: string;
fullName?: string;
id?: string | null;
username?: string | null;
fullName?: string | null;
email: string;
authMethod?: AuthMethod & string;
admin?: boolean;
group?: string;
group?: string | null;
household?: string | null;
advanced?: boolean;
canInvite?: boolean;
canManage?: boolean;
canOrganize?: boolean;
}
export interface UserIn {
id?: string;
username?: string;
fullName?: string;
id?: string | null;
username?: string | null;
fullName?: string | null;
email: string;
authMethod?: AuthMethod & string;
admin?: boolean;
group?: string;
group?: string | null;
household?: string | null;
advanced?: boolean;
canInvite?: boolean;
canManage?: boolean;
canOrganize?: boolean;
password: string;
}
export interface UserOut {
id: string;
username?: string | null;
fullName?: string | null;
email: string;
authMethod?: AuthMethod & string;
admin?: boolean;
group: string;
household: string;
advanced?: boolean;
canInvite?: boolean;
canManage?: boolean;
canOrganize?: boolean;
groupId: string;
groupSlug: string;
householdId: string;
householdSlug: string;
tokens?: LongLiveTokenOut[] | null;
cacheKey: string;
}
export interface UserRatingCreate {
recipeId: string;
rating?: number;
rating?: number | null;
isFavorite?: boolean;
userId: string;
}
export interface UserRatingOut {
recipeId: string;
rating?: number;
rating?: number | null;
isFavorite?: boolean;
userId: string;
id: string;
}
export interface UserRatingSummary {
recipeId: string;
rating?: number;
rating?: number | null;
isFavorite?: boolean;
}
export interface UserSummary {
id: string;
fullName: string;
export interface UserRatingUpdate {
rating?: number | null;
isFavorite?: boolean | null;
}
export interface ValidateResetToken {
token: string;

View file

@ -1,5 +1,5 @@
import { BaseAPI } from "../base/base-clients";
import { EmailInitationResponse, EmailInvitation } from "~/lib/api/types/group";
import { EmailInitationResponse, EmailInvitation } from "~/lib/api/types/household";
import { ForgotPassword } from "~/lib/api/types/user";
import { EmailTest } from "~/lib/api/types/admin";
@ -7,7 +7,7 @@ const routes = {
base: "/api/admin/email",
forgotPassword: "/api/users/forgot-password",
invitation: "/api/groups/invitations/email",
invitation: "/api/households/invitations/email",
};
export class EmailAPI extends BaseAPI {

View file

@ -4,8 +4,8 @@ import { CreateCookBook, RecipeCookBook, UpdateCookBook } from "~/lib/api/types/
const prefix = "/api";
const routes = {
cookbooks: `${prefix}/groups/cookbooks`,
cookbooksId: (id: number) => `${prefix}/groups/cookbooks/${id}`,
cookbooks: `${prefix}/households/cookbooks`,
cookbooksId: (id: number) => `${prefix}/households/cookbooks/${id}`,
};
export class CookbookAPI extends BaseCRUDAPI<CreateCookBook, RecipeCookBook, UpdateCookBook> {

View file

@ -1,11 +1,11 @@
import { BaseCRUDAPI } from "../base/base-clients";
import { GroupEventNotifierCreate, GroupEventNotifierOut, GroupEventNotifierUpdate } from "~/lib/api/types/group";
import { GroupEventNotifierCreate, GroupEventNotifierOut, GroupEventNotifierUpdate } from "~/lib/api/types/household";
const prefix = "/api";
const routes = {
eventNotifier: `${prefix}/groups/events/notifications`,
eventNotifierId: (id: string | number) => `${prefix}/groups/events/notifications/${id}`,
eventNotifier: `${prefix}/households/events/notifications`,
eventNotifierId: (id: string | number) => `${prefix}/households/events/notifications/${id}`,
};
export class GroupEventNotifierApi extends BaseCRUDAPI<

View file

@ -4,8 +4,8 @@ import { PlanRulesCreate, PlanRulesOut } from "~/lib/api/types/meal-plan";
const prefix = "/api";
const routes = {
rule: `${prefix}/groups/mealplans/rules`,
ruleId: (id: string | number) => `${prefix}/groups/mealplans/rules/${id}`,
rule: `${prefix}/households/mealplans/rules`,
ruleId: (id: string | number) => `${prefix}/households/mealplans/rules/${id}`,
};
export class MealPlanRulesApi extends BaseCRUDAPI<PlanRulesCreate, PlanRulesOut> {

View file

@ -4,9 +4,9 @@ import { CreatePlanEntry, CreateRandomEntry, ReadPlanEntry, UpdatePlanEntry } fr
const prefix = "/api";
const routes = {
mealplan: `${prefix}/groups/mealplans`,
random: `${prefix}/groups/mealplans/random`,
mealplanId: (id: string | number) => `${prefix}/groups/mealplans/${id}`,
mealplan: `${prefix}/households/mealplans`,
random: `${prefix}/households/mealplans/random`,
mealplanId: (id: string | number) => `${prefix}/households/mealplans/${id}`,
};
export class MealPlanAPI extends BaseCRUDAPI<CreatePlanEntry, ReadPlanEntry, UpdatePlanEntry> {

View file

@ -1,11 +1,11 @@
import { BaseCRUDAPI } from "../base/base-clients";
import { CreateGroupRecipeAction, GroupRecipeActionOut } from "~/lib/api/types/group";
import { CreateGroupRecipeAction, GroupRecipeActionOut } from "~/lib/api/types/household";
const prefix = "/api";
const routes = {
groupRecipeActions: `${prefix}/groups/recipe-actions`,
groupRecipeActionsId: (id: string | number) => `${prefix}/groups/recipe-actions/${id}`,
groupRecipeActions: `${prefix}/households/recipe-actions`,
groupRecipeActionsId: (id: string | number) => `${prefix}/households/recipe-actions/${id}`,
};
export class GroupRecipeActionsAPI extends BaseCRUDAPI<CreateGroupRecipeAction, GroupRecipeActionOut> {

View file

@ -9,20 +9,20 @@ import {
ShoppingListMultiPurposeLabelUpdate,
ShoppingListOut,
ShoppingListUpdate,
} from "~/lib/api/types/group";
} from "~/lib/api/types/household";
const prefix = "/api";
const routes = {
shoppingLists: `${prefix}/groups/shopping/lists`,
shoppingListsId: (id: string) => `${prefix}/groups/shopping/lists/${id}`,
shoppingListIdAddRecipe: (id: string, recipeId: string) => `${prefix}/groups/shopping/lists/${id}/recipe/${recipeId}`,
shoppingListIdRemoveRecipe: (id: string, recipeId: string) => `${prefix}/groups/shopping/lists/${id}/recipe/${recipeId}/delete`,
shoppingListIdUpdateLabelSettings: (id: string) => `${prefix}/groups/shopping/lists/${id}/label-settings`,
shoppingLists: `${prefix}/households/shopping/lists`,
shoppingListsId: (id: string) => `${prefix}/households/shopping/lists/${id}`,
shoppingListIdAddRecipe: (id: string, recipeId: string) => `${prefix}/households/shopping/lists/${id}/recipe/${recipeId}`,
shoppingListIdRemoveRecipe: (id: string, recipeId: string) => `${prefix}/households/shopping/lists/${id}/recipe/${recipeId}/delete`,
shoppingListIdUpdateLabelSettings: (id: string) => `${prefix}/households/shopping/lists/${id}/label-settings`,
shoppingListItems: `${prefix}/groups/shopping/items`,
shoppingListItemsCreateBulk: `${prefix}/groups/shopping/items/create-bulk`,
shoppingListItemsId: (id: string) => `${prefix}/groups/shopping/items/${id}`,
shoppingListItems: `${prefix}/households/shopping/items`,
shoppingListItemsCreateBulk: `${prefix}/households/shopping/items/create-bulk`,
shoppingListItemsId: (id: string) => `${prefix}/households/shopping/items/${id}`,
};
export class ShoppingListsApi extends BaseCRUDAPI<ShoppingListCreate, ShoppingListOut, ShoppingListUpdate> {

View file

@ -1,12 +1,12 @@
import { BaseCRUDAPI } from "../base/base-clients";
import { CreateWebhook, ReadWebhook } from "~/lib/api/types/group";
import { CreateWebhook, ReadWebhook } from "~/lib/api/types/household";
const prefix = "/api";
const routes = {
webhooks: `${prefix}/groups/webhooks`,
webhooksId: (id: string | number) => `${prefix}/groups/webhooks/${id}`,
webhooksIdTest: (id: string | number) => `${prefix}/groups/webhooks/${id}/test`,
webhooks: `${prefix}/households/webhooks`,
webhooksId: (id: string | number) => `${prefix}/households/webhooks/${id}`,
webhooksIdTest: (id: string | number) => `${prefix}/households/webhooks/${id}/test`,
};
export class WebhooksAPI extends BaseCRUDAPI<CreateWebhook, ReadWebhook> {

View file

@ -1,13 +1,10 @@
import { BaseCRUDAPI } from "../base/base-clients";
import { CategoryBase, GroupBase, GroupInDB, GroupSummary, UserOut } from "~/lib/api/types/user";
import { GroupBase, GroupInDB, GroupSummary, UserSummary } from "~/lib/api/types/user";
import { HouseholdSummary } from "~/lib/api/types/household";
import {
CreateInviteToken,
GroupAdminUpdate,
GroupStatistics,
GroupStorage,
ReadGroupPreferences,
ReadInviteToken,
SetPermissions,
UpdateGroupPreferences,
} from "~/lib/api/types/group";
@ -16,16 +13,14 @@ const prefix = "/api";
const routes = {
groups: `${prefix}/admin/groups`,
groupsSelf: `${prefix}/groups/self`,
categories: `${prefix}/groups/categories`,
members: `${prefix}/groups/members`,
permissions: `${prefix}/groups/permissions`,
preferences: `${prefix}/groups/preferences`,
statistics: `${prefix}/groups/statistics`,
storage: `${prefix}/groups/storage`,
invitation: `${prefix}/groups/invitations`,
households: `${prefix}/households`,
membersHouseholdId: (householdId: string | number | null) => {
return householdId ?
`${prefix}/households/members?householdId=${householdId}` :
`${prefix}/groups/members`;
},
groupsId: (id: string | number) => `${prefix}/admin/groups/${id}`,
};
@ -38,14 +33,6 @@ export class GroupAPI extends BaseCRUDAPI<GroupBase, GroupInDB, GroupAdminUpdate
return await this.requests.get<GroupSummary>(routes.groupsSelf);
}
async getCategories() {
return await this.requests.get<CategoryBase[]>(routes.categories);
}
async setCategories(payload: CategoryBase[]) {
return await this.requests.put<CategoryBase[]>(routes.categories, payload);
}
async getPreferences() {
return await this.requests.get<ReadGroupPreferences>(routes.preferences);
}
@ -55,21 +42,12 @@ export class GroupAPI extends BaseCRUDAPI<GroupBase, GroupInDB, GroupAdminUpdate
return await this.requests.put<ReadGroupPreferences, UpdateGroupPreferences>(routes.preferences, payload);
}
async createInvitation(payload: CreateInviteToken) {
return await this.requests.post<ReadInviteToken>(routes.invitation, payload);
async fetchMembers(householdId: string | number | null = null) {
return await this.requests.get<UserSummary[]>(routes.membersHouseholdId(householdId));
}
async fetchMembers() {
return await this.requests.get<UserOut[]>(routes.members);
}
async setMemberPermissions(payload: SetPermissions) {
// TODO: This should probably be a patch request, which isn't offered by the API currently
return await this.requests.put<UserOut, SetPermissions>(routes.permissions, payload);
}
async statistics() {
return await this.requests.get<GroupStatistics>(routes.statistics);
async fetchHouseholds() {
return await this.requests.get<HouseholdSummary[]>(routes.households);
}
async storage() {

View file

@ -0,0 +1,64 @@
import { BaseCRUDAPI } from "../base/base-clients";
import { UserOut } from "~/lib/api/types/user";
import {
HouseholdCreate,
HouseholdInDB,
UpdateHouseholdAdmin,
HouseholdStatistics,
ReadHouseholdPreferences,
SetPermissions,
UpdateHouseholdPreferences,
CreateInviteToken,
ReadInviteToken,
} from "~/lib/api/types/household";
const prefix = "/api";
const routes = {
households: `${prefix}/admin/households`,
householdsSelf: `${prefix}/households/self`,
members: `${prefix}/households/members`,
permissions: `${prefix}/households/permissions`,
preferences: `${prefix}/households/preferences`,
statistics: `${prefix}/households/statistics`,
invitation: `${prefix}/households/invitations`,
householdsId: (id: string | number) => `${prefix}/admin/households/${id}`,
};
export class HouseholdAPI extends BaseCRUDAPI<HouseholdCreate, HouseholdInDB, UpdateHouseholdAdmin> {
baseRoute = routes.households;
itemRoute = routes.householdsId;
/** Returns the Group Data for the Current User
*/
async getCurrentUserHousehold() {
return await this.requests.get<HouseholdInDB>(routes.householdsSelf);
}
async getPreferences() {
return await this.requests.get<ReadHouseholdPreferences>(routes.preferences);
}
async setPreferences(payload: UpdateHouseholdPreferences) {
// TODO: This should probably be a patch request, which isn't offered by the API currently
return await this.requests.put<ReadHouseholdPreferences, UpdateHouseholdPreferences>(routes.preferences, payload);
}
async createInvitation(payload: CreateInviteToken) {
return await this.requests.post<ReadInviteToken>(routes.invitation, payload);
}
async fetchMembers() {
return await this.requests.get<UserOut[]>(routes.members);
}
async setMemberPermissions(payload: SetPermissions) {
// TODO: This should probably be a patch request, which isn't offered by the API currently
return await this.requests.put<UserOut, SetPermissions>(routes.permissions, payload);
}
async statistics() {
return await this.requests.get<HouseholdStatistics>(routes.statistics);
}
}

View file

@ -1,6 +1,4 @@
import { BaseCRUDAPI } from "../base/base-clients";
import { QueryValue, route } from "~/lib/api/base/route";
import { PaginationData } from "~/lib/api/types/non-generated";
import {
ChangePassword,
DeleteTokenResponse,
@ -12,7 +10,6 @@ import {
UserOut,
UserRatingOut,
UserRatingSummary,
UserSummary,
} from "~/lib/api/types/user";
export interface UserRatingsSummaries {
@ -26,7 +23,6 @@ export interface UserRatingsOut {
const prefix = "/api";
const routes = {
groupUsers: `${prefix}/users/group-users`,
usersSelf: `${prefix}/users/self`,
ratingsSelf: `${prefix}/users/self/ratings`,
passwordReset: `${prefix}/users/reset-password`,
@ -51,10 +47,6 @@ export class UserApi extends BaseCRUDAPI<UserIn, UserOut, UserBase> {
baseRoute: string = routes.users;
itemRoute = (itemid: string) => routes.usersId(itemid);
async getGroupUsers(page = 1, perPage = -1, params = {} as Record<string, QueryValue>) {
return await this.requests.get<PaginationData<UserSummary>>(route(routes.groupUsers, { page, perPage, ...params }));
}
async addFavorite(id: string, slug: string) {
return await this.requests.post(routes.usersIdFavoritesSlug(id, slug), {});
}