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

chore: frontend testing setup (#1739)

* add vitest

* initialize lib w/ tests

* move to dev dep

* run tests in CI

* update file names

* move api folder to lib

* move api and api types to same folder

* update generator outpath

* rm husky

* i guess i _did_ need those types

* reorg types

* extract validators into testable components

* (WIP) start composable testing

* fix import type

* fix linter complaint

* simplify icon type def

* fix linter errors (maybe?)

* rename client file for sorting
This commit is contained in:
Hayden 2022-10-22 11:51:07 -08:00 committed by GitHub
parent 9f6bcc83d5
commit fcc5d99d40
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
182 changed files with 902 additions and 487 deletions

View file

@ -1,278 +0,0 @@
/* 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 AdminAboutInfo {
production: boolean;
version: string;
demoStatus: boolean;
allowSignup: boolean;
versionLatest: string;
apiPort: number;
apiDocs: boolean;
dbType: string;
dbUrl?: string;
defaultGroup: string;
buildId: string;
recipeScraperVersion: string;
}
export interface AllBackups {
imports: BackupFile[];
templates: string[];
}
export interface BackupFile {
name: string;
date: string;
size: string;
}
export interface AppInfo {
production: boolean;
version: string;
demoStatus: boolean;
allowSignup: boolean;
}
export interface AppStatistics {
totalRecipes: number;
totalUsers: number;
totalGroups: number;
uncategorizedRecipes: number;
untaggedRecipes: number;
}
export interface BackupOptions {
recipes?: boolean;
settings?: boolean;
themes?: boolean;
groups?: boolean;
users?: boolean;
notifications?: boolean;
}
export interface CheckAppConfig {
emailReady: boolean;
ldapReady: boolean;
baseUrlSet: boolean;
isUpToDate: boolean;
}
export interface ChowdownURL {
url: string;
}
export interface CommentImport {
name: string;
status: boolean;
exception?: string;
}
export interface CreateBackup {
tag?: string;
options: BackupOptions;
templates?: string[];
}
export interface CustomPageBase {
name: string;
slug?: string;
position: number;
categories?: RecipeCategoryResponse[];
}
export interface RecipeCategoryResponse {
name: string;
id: string;
slug: string;
recipes?: 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;
recipeIngredient?: RecipeIngredient[];
dateAdded?: string;
dateUpdated?: string;
createdAt?: string;
updateAt?: 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 RecipeIngredient {
title?: string;
note?: string;
unit?: IngredientUnit | CreateIngredientUnit;
food?: IngredientFood | CreateIngredientFood;
disableAmount?: boolean;
quantity?: number;
originalText?: string;
referenceId?: string;
}
export interface IngredientUnit {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
fraction?: boolean;
abbreviation?: string;
useAbbreviation?: boolean;
id: string;
createdAt?: string;
updateAt?: string;
}
export interface CreateIngredientUnit {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
fraction?: boolean;
abbreviation?: string;
useAbbreviation?: boolean;
}
export interface IngredientFood {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
id: string;
label?: MultiPurposeLabelSummary;
createdAt?: string;
updateAt?: string;
}
export interface MultiPurposeLabelSummary {
name: string;
color?: string;
groupId: string;
id: string;
}
export interface CreateIngredientFood {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
}
export interface CustomPageImport {
name: string;
status: boolean;
exception?: string;
}
export interface CustomPageOut {
name: string;
slug?: string;
position: number;
categories?: RecipeCategoryResponse[];
id: number;
}
export interface DockerVolumeText {
text: string;
}
export interface EmailReady {
ready: boolean;
}
export interface EmailSuccess {
success: boolean;
error?: string;
}
export interface EmailTest {
email: string;
}
export interface GroupImport {
name: string;
status: boolean;
exception?: string;
}
export interface ImportBase {
name: string;
status: boolean;
exception?: string;
}
export interface ImportJob {
recipes?: boolean;
settings?: boolean;
themes?: boolean;
groups?: boolean;
users?: boolean;
notifications?: boolean;
name: string;
force?: boolean;
rebase?: boolean;
}
export interface MaintenanceLogs {
logs: string[];
}
export interface MaintenanceStorageDetails {
tempDirSize: string;
backupsDirSize: string;
groupsDirSize: string;
recipesDirSize: string;
userDirSize: string;
}
export interface MaintenanceSummary {
dataDirSize: string;
logFileSize: string;
cleanableImages: number;
cleanableDirs: number;
}
export interface MigrationFile {
name: string;
date: string;
}
export interface MigrationImport {
name: string;
status: boolean;
exception?: string;
slug?: string;
}
export interface Migrations {
type: string;
files?: MigrationFile[];
}
export interface NotificationImport {
name: string;
status: boolean;
exception?: string;
}
export interface RecipeImport {
name: string;
status: boolean;
exception?: string;
slug?: string;
}
export interface SettingsImport {
name: string;
status: boolean;
exception?: string;
}
export interface UserImport {
name: string;
status: boolean;
exception?: string;
}

View file

@ -1,20 +0,0 @@
/* 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 MealieAnalytics {
installationId: string;
version: string;
databaseType: string;
usingEmail: boolean;
usingLdap: boolean;
apiTokens: number;
users: number;
groups: number;
recipes: number;
shoppingLists: number;
cookbooks: number;
}

View file

@ -1,189 +0,0 @@
/* 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 CreateCookBook {
name: string;
description?: string;
slug?: string;
position?: number;
public?: boolean;
categories?: CategoryBase[];
tags?: TagBase[];
tools?: RecipeTool[];
requireAllCategories?: boolean;
requireAllTags?: boolean;
requireAllTools?: boolean;
}
export interface CategoryBase {
name: string;
id: string;
slug: string;
}
export interface TagBase {
name: string;
id: string;
slug: string;
}
export interface RecipeTool {
id: string;
name: string;
slug: string;
onHand?: boolean;
}
export interface ReadCookBook {
name: string;
description?: string;
slug?: string;
position?: number;
public?: boolean;
categories?: CategoryBase[];
tags?: TagBase[];
tools?: RecipeTool[];
requireAllCategories?: boolean;
requireAllTags?: boolean;
requireAllTools?: boolean;
groupId: string;
id: string;
}
export interface RecipeCookBook {
name: string;
description?: string;
slug?: string;
position?: number;
public?: boolean;
categories?: CategoryBase[];
tags?: TagBase[];
tools?: RecipeTool[];
requireAllCategories?: boolean;
requireAllTags?: boolean;
requireAllTools?: boolean;
groupId: string;
id: string;
recipes: 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;
recipeIngredient?: RecipeIngredient[];
dateAdded?: string;
dateUpdated?: string;
createdAt?: string;
updateAt?: string;
}
export interface RecipeCategory {
id?: string;
name: string;
slug: string;
}
export interface RecipeTag {
id?: string;
name: string;
slug: string;
}
export interface RecipeIngredient {
title?: string;
note?: string;
unit?: IngredientUnit | CreateIngredientUnit;
food?: IngredientFood | CreateIngredientFood;
disableAmount?: boolean;
quantity?: number;
originalText?: string;
referenceId?: string;
}
export interface IngredientUnit {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
fraction?: boolean;
abbreviation?: string;
useAbbreviation?: boolean;
id: string;
createdAt?: string;
updateAt?: string;
}
export interface CreateIngredientUnit {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
fraction?: boolean;
abbreviation?: string;
useAbbreviation?: boolean;
}
export interface IngredientFood {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
id: string;
label?: MultiPurposeLabelSummary;
createdAt?: string;
updateAt?: string;
}
export interface MultiPurposeLabelSummary {
name: string;
color?: string;
groupId: string;
id: string;
}
export interface CreateIngredientFood {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
}
export interface SaveCookBook {
name: string;
description?: string;
slug?: string;
position?: number;
public?: boolean;
categories?: CategoryBase[];
tags?: TagBase[];
tools?: RecipeTool[];
requireAllCategories?: boolean;
requireAllTags?: boolean;
requireAllTools?: boolean;
groupId: string;
}
export interface UpdateCookBook {
name: string;
description?: string;
slug?: string;
position?: number;
public?: boolean;
categories?: CategoryBase[];
tags?: TagBase[];
tools?: RecipeTool[];
requireAllCategories?: boolean;
requireAllTags?: boolean;
requireAllTools?: boolean;
groupId: string;
id: string;
}

View file

@ -1,24 +0,0 @@
/* 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 EventCategory = "general" | "recipe" | "backup" | "scheduled" | "migration" | "group" | "user";
export interface Event {
id?: number;
title: string;
text: string;
timeStamp?: string;
category?: EventCategory & string;
}
export interface EventsOut {
total: number;
events: Event[];
}
export interface TestEvent {
id?: number;
testUrl?: string;
}

View file

@ -1,473 +0,0 @@
/* 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 WebhookType = "mealplan";
export type SupportedMigrations = "nextcloud" | "chowdown" | "paprika" | "mealie_alpha";
export interface CreateGroupPreferences {
privateGroup?: boolean;
firstDayOfWeek?: number;
recipePublic?: boolean;
recipeShowNutrition?: boolean;
recipeShowAssets?: boolean;
recipeLandscapeView?: boolean;
recipeDisableComments?: boolean;
recipeDisableAmount?: boolean;
groupId: 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;
}
export interface UpdateGroupPreferences {
privateGroup?: boolean;
firstDayOfWeek?: number;
recipePublic?: boolean;
recipeShowNutrition?: boolean;
recipeShowAssets?: boolean;
recipeLandscapeView?: boolean;
recipeDisableComments?: boolean;
recipeDisableAmount?: boolean;
}
export interface GroupDataExport {
id: string;
groupId: string;
name: string;
filename: string;
path: string;
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 GroupStatistics {
totalRecipes: number;
totalUsers: number;
totalCategories: number;
totalTags: number;
totalTools: number;
}
export interface GroupStorage {
usedStorageBytes: number;
usedStorageStr: string;
totalStorageBytes: number;
totalStorageStr: 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 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 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 ShoppingListCreate {
name?: string;
extras?: {
[k: string]: unknown;
};
createdAt?: string;
updateAt?: string;
}
export interface ShoppingListItemCreate {
shoppingListId: string;
checked?: boolean;
position?: number;
isFood?: boolean;
note?: string;
quantity?: number;
unitId?: string;
unit?: IngredientUnit;
foodId?: string;
food?: IngredientFood;
labelId?: string;
recipeReferences?: ShoppingListItemRecipeRef[];
extras?: {
[k: string]: unknown;
};
createdAt?: string;
updateAt?: string;
}
export interface IngredientUnit {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
fraction?: boolean;
abbreviation?: string;
useAbbreviation?: boolean;
id: string;
createdAt?: string;
updateAt?: string;
}
export interface IngredientFood {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
id: string;
label?: MultiPurposeLabelSummary;
createdAt?: string;
updateAt?: string;
}
export interface MultiPurposeLabelSummary {
name: string;
color?: string;
groupId: string;
id: string;
}
export interface ShoppingListItemRecipeRef {
recipeId: string;
recipeQuantity?: number;
}
export interface ShoppingListItemOut {
shoppingListId: string;
checked?: boolean;
position?: number;
isFood?: boolean;
note?: string;
quantity?: number;
unitId?: string;
unit?: IngredientUnit;
foodId?: string;
food?: IngredientFood;
labelId?: string;
recipeReferences?: (ShoppingListItemRecipeRef | ShoppingListItemRecipeRefOut)[];
extras?: {
[k: string]: unknown;
};
createdAt?: string;
updateAt?: string;
id: string;
label?: MultiPurposeLabelSummary;
}
export interface ShoppingListItemRecipeRefOut {
recipeId: string;
recipeQuantity?: number;
id: string;
shoppingListItemId: string;
}
export interface ShoppingListItemUpdate {
shoppingListId: string;
checked?: boolean;
position?: number;
isFood?: boolean;
note?: string;
quantity?: number;
unitId?: string;
unit?: IngredientUnit;
foodId?: string;
food?: IngredientFood;
labelId?: string;
recipeReferences?: ShoppingListItemRecipeRef[];
extras?: {
[k: string]: unknown;
};
createdAt?: string;
updateAt?: string;
id: string;
}
export interface ShoppingListOut {
name?: string;
extras?: {
[k: string]: unknown;
};
createdAt?: string;
updateAt?: string;
groupId: string;
id: string;
listItems?: ShoppingListItemOut[];
recipeReferences: ShoppingListRecipeRefOut[];
}
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;
recipeIngredient?: RecipeIngredient[];
dateAdded?: string;
dateUpdated?: string;
createdAt?: string;
updateAt?: 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 RecipeIngredient {
title?: string;
note?: string;
unit?: IngredientUnit | CreateIngredientUnit;
food?: IngredientFood | CreateIngredientFood;
disableAmount?: boolean;
quantity?: number;
originalText?: string;
referenceId?: string;
}
export interface CreateIngredientUnit {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
fraction?: boolean;
abbreviation?: string;
useAbbreviation?: boolean;
}
export interface CreateIngredientFood {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
}
export interface ShoppingListSave {
name?: string;
extras?: {
[k: string]: unknown;
};
createdAt?: string;
updateAt?: string;
groupId: string;
}
export interface ShoppingListSummary {
name?: string;
extras?: {
[k: string]: unknown;
};
createdAt?: string;
updateAt?: string;
groupId: string;
id: string;
}
export interface ShoppingListUpdate {
name?: string;
extras?: {
[k: string]: unknown;
};
createdAt?: string;
updateAt?: string;
groupId: string;
id: string;
listItems?: ShoppingListItemOut[];
}

View file

@ -1,34 +0,0 @@
/* 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 MultiPurposeLabelCreate {
name: string;
color?: string;
}
export interface MultiPurposeLabelOut {
name: string;
color?: string;
groupId: string;
id: string;
}
export interface MultiPurposeLabelSave {
name: string;
color?: string;
groupId: string;
}
export interface MultiPurposeLabelSummary {
name: string;
color?: string;
groupId: string;
id: string;
}
export interface MultiPurposeLabelUpdate {
name: string;
color?: string;
groupId: string;
id: string;
}

View file

@ -1,224 +0,0 @@
/* 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 PlanEntryType = "breakfast" | "lunch" | "dinner" | "side";
export type PlanRulesDay = "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday" | "unset";
export type PlanRulesType = "breakfast" | "lunch" | "dinner" | "side" | "unset";
export interface Category {
id: string;
name: string;
slug: string;
}
export interface CreatePlanEntry {
date: string;
entryType?: PlanEntryType & string;
title?: string;
text?: string;
recipeId?: string;
}
export interface CreateRandomEntry {
date: string;
entryType?: PlanEntryType & string;
}
export interface ListItem {
title?: string;
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;
categories?: Category[];
tags?: Tag[];
}
export interface Tag {
id: string;
name: string;
slug: string;
}
export interface PlanRulesOut {
day?: PlanRulesDay & string;
entryType?: PlanRulesType & string;
categories?: Category[];
tags?: Tag[];
groupId: string;
id: string;
}
export interface PlanRulesSave {
day?: PlanRulesDay & string;
entryType?: PlanRulesType & string;
categories?: Category[];
tags?: Tag[];
groupId: string;
}
export interface ReadPlanEntry {
date: string;
entryType?: PlanEntryType & string;
title?: string;
text?: string;
recipeId?: string;
id: number;
groupId: string;
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;
recipeIngredient?: RecipeIngredient[];
dateAdded?: string;
dateUpdated?: string;
createdAt?: string;
updateAt?: 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 RecipeIngredient {
title?: string;
note?: string;
unit?: IngredientUnit | CreateIngredientUnit;
food?: IngredientFood | CreateIngredientFood;
disableAmount?: boolean;
quantity?: number;
originalText?: string;
referenceId?: string;
}
export interface IngredientUnit {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
fraction?: boolean;
abbreviation?: string;
useAbbreviation?: boolean;
id: string;
createdAt?: string;
updateAt?: string;
}
export interface CreateIngredientUnit {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
fraction?: boolean;
abbreviation?: string;
useAbbreviation?: boolean;
}
export interface IngredientFood {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
id: string;
label?: MultiPurposeLabelSummary;
createdAt?: string;
updateAt?: string;
}
export interface MultiPurposeLabelSummary {
name: string;
color?: string;
groupId: string;
id: string;
}
export interface CreateIngredientFood {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
}
export interface SavePlanEntry {
date: string;
entryType?: PlanEntryType & string;
title?: string;
text?: string;
recipeId?: string;
groupId: string;
}
export interface ShoppingListIn {
name: string;
group?: string;
items: ListItem[];
}
export interface ShoppingListOut {
name: string;
group?: string;
items: ListItem[];
id: number;
}
export interface UpdatePlanEntry {
date: string;
entryType?: PlanEntryType & string;
title?: string;
text?: string;
recipeId?: string;
id: number;
groupId: string;
}

View file

@ -1,25 +0,0 @@
/* 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 OcrAssetReq {
recipeSlug: string;
assetName: string;
}
export interface OcrTsvResponse {
level?: number;
pageNum?: number;
blockNum?: number;
parNum?: number;
lineNum?: number;
wordNum?: number;
left?: number;
top?: number;
width?: number;
height?: number;
conf?: number;
text?: string;
}

View file

@ -1,425 +0,0 @@
/* 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 ExportTypes = "json";
export type RegisteredParser = "nlp" | "brute";
export type OrderDirection = "asc" | "desc";
export interface AssignCategories {
recipes: string[];
categories: CategoryBase[];
}
export interface CategoryBase {
name: string;
id: string;
slug: string;
}
export interface AssignSettings {
recipes: string[];
settings: RecipeSettings;
}
export interface RecipeSettings {
public?: boolean;
showNutrition?: boolean;
showAssets?: boolean;
landscapeView?: boolean;
disableComments?: boolean;
disableAmount?: boolean;
locked?: boolean;
}
export interface AssignTags {
recipes: string[];
tags: TagBase[];
}
export interface TagBase {
name: string;
id: string;
slug: string;
}
export interface CategoryIn {
name: string;
}
export interface CategoryOut {
name: string;
id: string;
slug: string;
groupId: string;
}
export interface CategorySave {
name: string;
groupId: string;
}
export interface CreateIngredientFood {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
}
export interface CreateIngredientUnit {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
fraction?: boolean;
abbreviation?: string;
useAbbreviation?: boolean;
}
export interface CreateRecipe {
name: string;
}
export interface CreateRecipeBulk {
url: string;
categories?: RecipeCategory[];
tags?: RecipeTag[];
}
export interface RecipeCategory {
id?: string;
name: string;
slug: string;
}
export interface RecipeTag {
id?: string;
name: string;
slug: string;
}
export interface CreateRecipeByUrlBulk {
imports: CreateRecipeBulk[];
}
export interface DeleteRecipes {
recipes: string[];
}
export interface ExportBase {
recipes: string[];
}
export interface ExportRecipes {
recipes: string[];
exportType?: ExportTypes & string;
}
export interface IngredientConfidence {
average?: number;
comment?: number;
name?: number;
unit?: number;
quantity?: number;
food?: number;
}
export interface IngredientFood {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
id: string;
label?: MultiPurposeLabelSummary;
createdAt?: string;
updateAt?: string;
}
export interface MultiPurposeLabelSummary {
name: string;
color?: string;
groupId: string;
id: string;
}
/**
* A list of ingredient references.
*/
export interface IngredientReferences {
referenceId?: string;
}
export interface IngredientRequest {
parser?: RegisteredParser & string;
ingredient: string;
}
export interface IngredientUnit {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
fraction?: boolean;
abbreviation?: string;
useAbbreviation?: boolean;
id: string;
createdAt?: string;
updateAt?: string;
}
export interface IngredientsRequest {
parser?: RegisteredParser & string;
ingredients: string[];
}
export interface MergeFood {
fromFood: string;
toFood: string;
}
export interface MergeUnit {
fromUnit: string;
toUnit: string;
}
export interface Nutrition {
calories?: string;
fatContent?: string;
proteinContent?: string;
carbohydrateContent?: string;
fiberContent?: string;
sodiumContent?: string;
sugarContent?: string;
}
export interface ParsedIngredient {
input?: string;
confidence?: IngredientConfidence;
ingredient: RecipeIngredient;
}
export interface RecipeIngredient {
title?: string;
note?: string;
unit?: IngredientUnit | CreateIngredientUnit;
food?: IngredientFood | CreateIngredientFood;
disableAmount?: boolean;
quantity?: number;
originalText?: string;
referenceId?: string;
}
export interface Recipe {
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;
recipeIngredient?: RecipeIngredient[];
dateAdded?: string;
dateUpdated?: string;
createdAt?: string;
updateAt?: string;
recipeInstructions?: RecipeStep[];
nutrition?: Nutrition;
settings?: RecipeSettings;
assets?: RecipeAsset[];
notes?: RecipeNote[];
extras?: {
[k: string]: unknown;
};
isOcrRecipe?: boolean;
comments?: RecipeCommentOut[];
}
export interface RecipeTool {
id: string;
name: string;
slug: string;
onHand?: boolean;
}
export interface RecipeStep {
id?: string;
title?: string;
text: string;
ingredientReferences?: IngredientReferences[];
}
export interface RecipeAsset {
name: string;
icon: string;
fileName?: string;
}
export interface RecipeNote {
title: string;
text: string;
}
export interface RecipeCommentOut {
recipeId: string;
text: string;
id: string;
createdAt: string;
updateAt: string;
userId: string;
user: UserBase;
}
export interface UserBase {
id: string;
username?: string;
admin: boolean;
}
export interface RecipeCategoryResponse {
name: string;
id: string;
slug: string;
recipes?: 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;
recipeIngredient?: RecipeIngredient[];
dateAdded?: string;
dateUpdated?: string;
createdAt?: string;
updateAt?: string;
}
export interface RecipeCommentCreate {
recipeId: string;
text: string;
}
export interface RecipeCommentSave {
recipeId: string;
text: string;
userId: string;
}
export interface RecipeCommentUpdate {
id: string;
text: string;
}
export interface RecipePaginationQuery {
page?: number;
perPage?: number;
orderBy?: string;
orderDirection?: OrderDirection & string;
queryFilter?: string;
loadFood?: boolean;
}
export interface RecipeShareToken {
recipeId: string;
expiresAt?: string;
groupId: string;
id: string;
createdAt: string;
recipe: Recipe;
}
export interface RecipeShareTokenCreate {
recipeId: string;
expiresAt?: string;
}
export interface RecipeShareTokenSave {
recipeId: string;
expiresAt?: string;
groupId: string;
}
export interface RecipeShareTokenSummary {
recipeId: string;
expiresAt?: string;
groupId: string;
id: string;
createdAt: string;
}
export interface RecipeSlug {
slug: string;
}
export interface RecipeTagResponse {
name: string;
id: string;
slug: string;
recipes?: RecipeSummary[];
}
export interface RecipeToolCreate {
name: string;
onHand?: boolean;
}
export interface RecipeToolOut {
name: string;
onHand?: boolean;
id: string;
slug: string;
}
export interface RecipeToolResponse {
name: string;
onHand?: boolean;
id: string;
slug: string;
recipes?: Recipe[];
}
export interface RecipeToolSave {
name: string;
onHand?: boolean;
groupId: string;
}
export interface RecipeZipTokenResponse {
token: string;
}
export interface SaveIngredientFood {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
groupId: string;
}
export interface SaveIngredientUnit {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
fraction?: boolean;
abbreviation?: string;
useAbbreviation?: boolean;
groupId: string;
}
export interface ScrapeRecipe {
url: string;
includeTags?: boolean;
}
export interface ScrapeRecipeTest {
url: string;
}
export interface SlugResponse {}
export interface TagIn {
name: string;
}
export interface TagOut {
name: string;
groupId: string;
id: string;
slug: string;
}
export interface TagSave {
name: string;
groupId: string;
}
export interface UnitFoodBase {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
}
export interface UpdateImageResponse {
image: string;
}
export interface PaginationQuery {
page?: number;
perPage?: number;
orderBy?: string;
orderDirection?: OrderDirection & string;
queryFilter?: string;
}

View file

@ -1,49 +0,0 @@
/* 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 ReportCategory = "backup" | "restore" | "migration" | "bulk_import";
export type ReportSummaryStatus = "in-progress" | "success" | "failure" | "partial";
export interface ReportCreate {
timestamp?: string;
category: ReportCategory;
groupId: string;
name: string;
status?: ReportSummaryStatus & string;
}
export interface ReportEntryCreate {
reportId: string;
timestamp?: string;
success?: boolean;
message: string;
exception?: string;
}
export interface ReportEntryOut {
reportId: string;
timestamp?: string;
success?: boolean;
message: string;
exception?: string;
id: string;
}
export interface ReportOut {
timestamp?: string;
category: ReportCategory;
groupId: string;
name: string;
status?: ReportSummaryStatus & string;
id: string;
entries?: ReportEntryOut[];
}
export interface ReportSummary {
timestamp?: string;
category: ReportCategory;
groupId: string;
name: string;
status?: ReportSummaryStatus & string;
id: string;
}

View file

@ -1,31 +0,0 @@
/* 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 OrderDirection = "asc" | "desc";
export interface ErrorResponse {
message: string;
error?: boolean;
exception?: string;
}
export interface FileTokenResponse {
fileToken: string;
}
export interface PaginationQuery {
page?: number;
perPage?: number;
orderBy?: string;
orderDirection?: OrderDirection & string;
queryFilter?: string;
}
export interface SuccessResponse {
message: string;
error?: boolean;
}
export interface ValidationResponse {
valid: boolean;
}

View file

@ -1,25 +0,0 @@
/* 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 ServerTaskNames = "Background Task" | "Database Backup" | "Bulk Recipe Import";
export type ServerTaskStatus = "running" | "finished" | "failed";
export interface ServerTask {
groupId: string;
name?: ServerTaskNames & string;
createdAt?: string;
status?: ServerTaskStatus & string;
log?: string;
id: number;
}
export interface ServerTaskCreate {
groupId: string;
name?: ServerTaskNames & string;
createdAt?: string;
status?: ServerTaskStatus & string;
log?: string;
}

View file

@ -1,8 +0,0 @@
/* 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 _Master_ {}

View file

@ -1,286 +0,0 @@
/* 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 ChangePassword {
currentPassword: string;
newPassword: string;
}
export interface CreateToken {
name: string;
integrationId?: string;
userId: string;
token: string;
}
export interface CreateUserRegistration {
group?: string;
groupToken?: string;
email: string;
username: string;
password: string;
passwordConfirm: string;
advanced?: boolean;
private?: boolean;
seedData?: boolean;
locale?: string;
}
export interface DeleteTokenResponse {
tokenDelete: string;
}
export interface ForgotPassword {
email: string;
}
export interface GroupBase {
name: string;
}
export interface GroupInDB {
name: string;
id: string;
categories?: CategoryBase[];
webhooks?: unknown[];
users?: UserOut[];
preferences?: ReadGroupPreferences;
}
export interface CategoryBase {
name: string;
id: string;
slug: string;
}
export interface UserOut {
username?: string;
fullName?: string;
email: string;
admin?: boolean;
group: string;
advanced?: boolean;
favoriteRecipes?: string[];
canInvite?: boolean;
canManage?: boolean;
canOrganize?: boolean;
id: string;
groupId: string;
tokens?: LongLiveTokenOut[];
cacheKey: string;
}
export interface LongLiveTokenOut {
token: string;
name: string;
id: number;
}
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 LongLiveTokenIn {
name: string;
integrationId?: string;
}
export interface LongLiveTokenInDB {
name: string;
integrationId?: string;
userId: string;
token: string;
id: number;
user: PrivateUser;
}
export interface PrivateUser {
username?: string;
fullName?: string;
email: string;
admin?: boolean;
group: string;
advanced?: boolean;
favoriteRecipes?: string[];
canInvite?: boolean;
canManage?: boolean;
canOrganize?: boolean;
id: string;
groupId: string;
tokens?: LongLiveTokenOut[];
cacheKey: string;
password: string;
loginAttemps?: number;
lockedAt?: string;
}
export interface PrivatePasswordResetToken {
userId: string;
token: string;
user: PrivateUser;
}
export interface ResetPassword {
token: string;
email: string;
password: string;
passwordConfirm: string;
}
export interface SavePasswordResetToken {
userId: string;
token: string;
}
export interface Token {
access_token: string;
token_type: string;
}
export interface TokenData {
user_id?: string;
username?: string;
}
export interface UnlockResults {
unlocked?: number;
}
export interface UpdateGroup {
name: string;
id: string;
categories?: CategoryBase[];
webhooks?: unknown[];
}
export interface UserBase {
username?: string;
fullName?: string;
email: string;
admin?: boolean;
group?: string;
advanced?: boolean;
favoriteRecipes?: string[];
canInvite?: boolean;
canManage?: boolean;
canOrganize?: boolean;
}
export interface UserFavorites {
username?: string;
fullName?: string;
email: string;
admin?: boolean;
group?: string;
advanced?: boolean;
favoriteRecipes?: RecipeSummary[];
canInvite?: boolean;
canManage?: boolean;
canOrganize?: boolean;
}
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;
recipeIngredient?: RecipeIngredient[];
dateAdded?: string;
dateUpdated?: string;
createdAt?: string;
updateAt?: 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 RecipeIngredient {
title?: string;
note?: string;
unit?: IngredientUnit | CreateIngredientUnit;
food?: IngredientFood | CreateIngredientFood;
disableAmount?: boolean;
quantity?: number;
originalText?: string;
referenceId?: string;
}
export interface IngredientUnit {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
fraction?: boolean;
abbreviation?: string;
useAbbreviation?: boolean;
id: string;
createdAt?: string;
updateAt?: string;
}
export interface CreateIngredientUnit {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
fraction?: boolean;
abbreviation?: string;
useAbbreviation?: boolean;
}
export interface IngredientFood {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
id: string;
label?: MultiPurposeLabelSummary;
createdAt?: string;
updateAt?: string;
}
export interface MultiPurposeLabelSummary {
name: string;
color?: string;
groupId: string;
id: string;
}
export interface CreateIngredientFood {
name: string;
description?: string;
extras?: {
[k: string]: unknown;
};
labelId?: string;
}
export interface UserIn {
username?: string;
fullName?: string;
email: string;
admin?: boolean;
group?: string;
advanced?: boolean;
favoriteRecipes?: string[];
canInvite?: boolean;
canManage?: boolean;
canOrganize?: boolean;
password: string;
}
export interface ValidateResetToken {
token: string;
}

View file

@ -1,25 +0,0 @@
import { AxiosResponse } from "axios";
export type NoUndefinedField<T> = { [P in keyof T]-?: NoUndefinedField<NonNullable<T[P]>> };
export interface RequestResponse<T> {
response: AxiosResponse<T> | null;
data: T | null;
error: any;
}
export interface ApiRequestInstance {
get<T>(url: string, data?: unknown): Promise<RequestResponse<T>>;
post<T>(url: string, data: unknown): Promise<RequestResponse<T>>;
put<T, U = T>(url: string, data: U): Promise<RequestResponse<T>>;
patch<T, U = Partial<T>>(url: string, data: U): Promise<RequestResponse<T>>;
delete<T>(url: string): Promise<RequestResponse<T>>;
}
export interface PaginationData<T> {
page: number;
per_page: number;
total: number;
total_pages: number;
items: T[];
}

View file

@ -1,5 +1,5 @@
import { OcrTsvResponse } from "~/types/api-types/ocr";
import { Recipe } from "~/types/api-types/recipe";
import { OcrTsvResponse } from "~/lib/api/types/ocr";
import { Recipe } from "~/lib/api/types/recipe";
export type CanvasRect = {
startX: number;

View file

@ -1,7 +0,0 @@
export type RecipeOrganizer = "categories" | "tags" | "tools";
export enum Organizer {
Category = "categories",
Tag = "tags",
Tool = "tools",
}