1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 23:59:45 +02:00

Feature/group based notifications (#918)

* fix group page

* setup group notification for backend

* update type generators

* script to auto-generate schema exports

* setup frontend CRUD interface

* remove old notifications UI

* drop old events api

* add test functionality

* update naming for fields

* add event dispatcher functionality

* bump to python 3.10

* bump python version

* purge old event code

* use-async apprise

* set mealie logo as image

* unify styles for buttons rows

* add links to banners
This commit is contained in:
Hayden 2022-01-09 21:04:24 -09:00 committed by GitHub
parent 50a341ed3f
commit 190773c5d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
74 changed files with 1992 additions and 1229 deletions

View file

@ -5,12 +5,211 @@
/* Do not modify it by hand - just update the pydantic models and then re-run the script
*/
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;
time?: 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 {
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 {
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 {
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 IngredientFood {
name: string;
description?: string;
id: number;
}
export interface IngredientUnit {
name: string;
description?: string;
fraction?: boolean;
abbreviation?: string;
id: number;
}
export interface MultiPurposeLabelSummary {
name: string;
groupId: string;
id: string;
}
export interface ReadGroupPreferences {
privateGroup?: boolean;
firstDayOfWeek?: number;
recipePublic?: boolean;
recipeShowNutrition?: boolean;
recipeShowAssets?: boolean;
recipeLandscapeView?: boolean;
recipeDisableComments?: boolean;
recipeDisableAmount?: boolean;
groupId: string;
id: number;
}
export interface ReadInviteToken {
token: string;
usesLeft: number;
groupId: string;
}
export interface ReadWebhook {
enabled?: boolean;
name?: string;
@ -19,6 +218,11 @@ export interface ReadWebhook {
groupId: string;
id: number;
}
export interface SaveInviteToken {
usesLeft: number;
groupId: string;
token: string;
}
export interface SaveWebhook {
enabled?: boolean;
name?: string;
@ -26,3 +230,78 @@ export interface SaveWebhook {
time?: string;
groupId: string;
}
export interface SetPermissions {
userId: string;
canManage?: boolean;
canInvite?: boolean;
canOrganize?: boolean;
}
/**
* Create Shopping List
*/
export interface ShoppingListCreate {
name?: string;
}
export interface ShoppingListItemCreate {
shoppingListId: string;
checked?: boolean;
position?: number;
isFood?: boolean;
note?: string;
quantity?: number;
unitId?: number;
unit?: IngredientUnit;
foodId?: number;
food?: IngredientFood;
recipeId?: number;
labelId?: string;
}
export interface ShoppingListItemOut {
shoppingListId: string;
checked?: boolean;
position?: number;
isFood?: boolean;
note?: string;
quantity?: number;
unitId?: number;
unit?: IngredientUnit;
foodId?: number;
food?: IngredientFood;
recipeId?: number;
labelId?: string;
id: string;
label?: MultiPurposeLabelSummary;
}
/**
* Create Shopping List
*/
export interface ShoppingListOut {
name?: string;
groupId: string;
id: string;
listItems?: ShoppingListItemOut[];
}
/**
* Create Shopping List
*/
export interface ShoppingListSave {
name?: string;
groupId: string;
}
/**
* Create Shopping List
*/
export interface ShoppingListSummary {
name?: string;
groupId: string;
id: string;
}
/**
* Create Shopping List
*/
export interface ShoppingListUpdate {
name?: string;
groupId: string;
id: string;
listItems?: ShoppingListItemOut[];
}

View file

@ -0,0 +1,59 @@
/* 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 IngredientFood {
name: string;
description?: string;
id: number;
}
export interface MultiPurposeLabelCreate {
name: string;
}
export interface MultiPurposeLabelOut {
name: string;
groupId: string;
id: string;
shoppingListItems?: ShoppingListItemOut[];
foods?: IngredientFood[];
}
export interface ShoppingListItemOut {
shoppingListId: string;
checked?: boolean;
position?: number;
isFood?: boolean;
note?: string;
quantity?: number;
unitId?: number;
unit?: IngredientUnit;
foodId?: number;
food?: IngredientFood;
recipeId?: number;
labelId?: string;
id: string;
label?: MultiPurposeLabelSummary;
}
export interface IngredientUnit {
name: string;
description?: string;
fraction?: boolean;
abbreviation?: string;
id: number;
}
export interface MultiPurposeLabelSummary {
name: string;
groupId: string;
id: string;
}
export interface MultiPurposeLabelSave {
name: string;
groupId: string;
}
export interface MultiPurposeLabelUpdate {
name: string;
groupId: string;
id: string;
}

View file

@ -5,13 +5,36 @@
/* 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 interface AssignCategories {
recipes: string[];
categories: CategoryBase[];
}
export interface CategoryBase {
name: string;
id: number;
slug: string;
}
export interface AssignTags {
recipes: string[];
tags: TagBase[];
}
export interface TagBase {
name: string;
id: number;
slug: string;
}
export interface BulkActionError {
recipe: string;
error: string;
}
export interface BulkActionsResponse {
success: boolean;
message: string;
errors?: BulkActionError[];
}
export interface CategoryIn {
name: string;
}
@ -47,6 +70,13 @@ export interface CreateRecipeByUrl {
export interface CreateRecipeByUrlBulk {
imports: CreateRecipeBulk[];
}
export interface DeleteRecipes {
recipes: string[];
}
export interface ExportRecipes {
recipes: string[];
exportType?: ExportTypes & string;
}
export interface IngredientConfidence {
average?: number;
comment?: number;
@ -60,6 +90,12 @@ export interface IngredientFood {
description?: string;
id: number;
}
/**
* A list of ingredient references.
*/
export interface IngredientReferences {
referenceId?: string;
}
export interface IngredientRequest {
parser?: RegisteredParser & string;
ingredient: string;
@ -141,12 +177,6 @@ export interface RecipeStep {
text: string;
ingredientReferences?: IngredientReferences[];
}
/**
* A list of ingredient references.
*/
export interface IngredientReferences {
referenceId?: string;
}
export interface RecipeSettings {
public?: boolean;
showNutrition?: boolean;
@ -198,6 +228,30 @@ export interface RecipeCommentUpdate {
id: string;
text: string;
}
export interface RecipeShareToken {
recipeId: number;
expiresAt?: string;
groupId: string;
id: string;
createdAt: string;
recipe: Recipe;
}
export interface RecipeShareTokenCreate {
recipeId: number;
expiresAt?: string;
}
export interface RecipeShareTokenSave {
recipeId: number;
expiresAt?: string;
groupId: string;
}
export interface RecipeShareTokenSummary {
recipeId: number;
expiresAt?: string;
groupId: string;
id: string;
createdAt: string;
}
export interface RecipeSlug {
slug: string;
}
@ -247,11 +301,6 @@ export interface RecipeToolResponse {
recipes?: Recipe[];
}
export interface SlugResponse {}
export interface TagBase {
name: string;
id: number;
slug: string;
}
export interface TagIn {
name: string;
}

View file

@ -19,6 +19,19 @@ export interface CreateToken {
userId: string;
token: string;
}
export interface CreateUserRegistration {
group?: string;
groupToken?: string;
email: string;
username: string;
password: string;
passwordConfirm: string;
advanced?: boolean;
private?: boolean;
}
export interface ForgotPassword {
email: string;
}
export interface GroupBase {
name: string;
}
@ -28,7 +41,6 @@ export interface GroupInDB {
categories?: CategoryBase[];
webhooks?: unknown[];
users?: UserOut[];
shoppingLists?: ShoppingListOut[];
preferences?: ReadGroupPreferences;
}
export interface UserOut {
@ -52,18 +64,6 @@ export interface LongLiveTokenOut {
id: number;
createdAt: string;
}
export interface ShoppingListOut {
name: string;
group?: string;
items: ListItem[];
id: number;
}
export interface ListItem {
title?: string;
text?: string;
quantity?: number;
checked?: boolean;
}
export interface ReadGroupPreferences {
privateGroup?: boolean;
firstDayOfWeek?: number;
@ -103,6 +103,11 @@ export interface PrivateUser {
cacheKey: string;
password: string;
}
export interface PrivatePasswordResetToken {
userId: string;
token: string;
user: PrivateUser;
}
export interface RecipeSummary {
id?: number;
userId?: string;
@ -166,6 +171,16 @@ export interface CreateIngredientFood {
name: string;
description?: string;
}
export interface ResetPassword {
token: string;
email: string;
password: string;
passwordConfirm: string;
}
export interface SavePasswordResetToken {
userId: string;
token: string;
}
export interface SignUpIn {
name: string;
admin: boolean;
@ -231,3 +246,6 @@ export interface UserIn {
canOrganize?: boolean;
password: string;
}
export interface ValidateResetToken {
token: string;
}