-
-
Notifications
You must be signed in to change notification settings - Fork 763
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'mealie-next' into feature/food-seed-plurals
- Loading branch information
Showing
38 changed files
with
756 additions
and
212 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
alembic/versions/2024-09-18-14.52.55_1fe4bd37ccc8_add_households_filter_to_meal_plans.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
"""add households filter to meal plans | ||
Revision ID: 1fe4bd37ccc8 | ||
Revises: be568e39ffdf | ||
Create Date: 2024-09-18 14:52:55.831540 | ||
""" | ||
|
||
import sqlalchemy as sa | ||
|
||
import mealie.db.migration_types | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "1fe4bd37ccc8" | ||
down_revision: str | None = "be568e39ffdf" | ||
branch_labels: str | tuple[str, ...] | None = None | ||
depends_on: str | tuple[str, ...] | None = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
op.create_table( | ||
"plan_rules_to_households", | ||
sa.Column("group_plan_rule_id", mealie.db.migration_types.GUID(), nullable=True), | ||
sa.Column("household_id", mealie.db.migration_types.GUID(), nullable=True), | ||
sa.ForeignKeyConstraint( | ||
["group_plan_rule_id"], | ||
["group_meal_plan_rules.id"], | ||
), | ||
sa.ForeignKeyConstraint( | ||
["household_id"], | ||
["households.id"], | ||
), | ||
sa.UniqueConstraint("group_plan_rule_id", "household_id", name="group_plan_rule_id_household_id_key"), | ||
) | ||
with op.batch_alter_table("plan_rules_to_households", schema=None) as batch_op: | ||
batch_op.create_index( | ||
batch_op.f("ix_plan_rules_to_households_group_plan_rule_id"), ["group_plan_rule_id"], unique=False | ||
) | ||
batch_op.create_index(batch_op.f("ix_plan_rules_to_households_household_id"), ["household_id"], unique=False) | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
with op.batch_alter_table("plan_rules_to_households", schema=None) as batch_op: | ||
batch_op.drop_index(batch_op.f("ix_plan_rules_to_households_household_id")) | ||
batch_op.drop_index(batch_op.f("ix_plan_rules_to_households_group_plan_rule_id")) | ||
|
||
op.drop_table("plan_rules_to_households") | ||
# ### end Alembic commands ### |
51 changes: 51 additions & 0 deletions
51
docs/docs/contributors/developers-guide/migration-guide.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Migration Guide | ||
|
||
This guide is a reference for developers maintaining custom integrations with Mealie. While we aim to keep breaking changes to a minimum, major versions are likely to contain at least *some* breaking changes. To clarify: *most users do not need to worry about this, this is **only** for those maintaining integrations and/or leveraging the API*. | ||
|
||
While this guide aims to simplify the migration process for developers, it's not necessarily a comprehensive list of breaking changes. Starting with v2, a comprehensive list of breaking changes are highlighted in the release notes. | ||
|
||
## V1 → V2 | ||
|
||
The biggest change between V1 and V2 is the introduction of Households. For more information on how households work in relation to groups/users, check out the [Groups and Households](./features.md#groups-and-households) section in the Features guide. | ||
|
||
### `updateAt` is now `updatedAt` | ||
|
||
We have renamed the `updateAt` field to `updatedAt`. While the API will still accept `updateAt` as an alias, the API will return it as `updatedAt`. The field's behavior has otherwise been unchanged. | ||
|
||
### Backend Endpoint Changes | ||
|
||
These endpoints have moved, but are otherwise unchanged: | ||
- `/groups/webhooks` -> `/households/webhooks` | ||
- `/groups/shopping/items` -> `/households/shopping/items` | ||
- `/groups/shopping/lists` -> `/households/shopping/lists` | ||
- `/groups/mealplans` -> `/households/mealplans` | ||
- `/groups/mealplans/rules` -> `/households/mealplans/rules` | ||
- `/groups/invitations` -> `/households/invitations` | ||
- `/groups/recipe-actions` -> `/households/recipe-actions` | ||
- `/groups/events/notifications` -> `/households/events/notifications` | ||
- `/groups/cookbooks` -> `/households/cookbooks` | ||
- `/explore/foods/{group_slug}` -> `/explore/groups/{group_slug}/foods` | ||
- `/explore/organizers/{group_slug}/categories` -> `/explore/groups/{group_slug}/categories` | ||
- `/explore/organizers/{group_slug}/tags` -> `/explore/groups/{group_slug}/tags` | ||
- `/explore/organizers/{group_slug}/tools` -> `/explore/groups/{group_slug}/tools` | ||
- `/explore/cookbooks/{group_slug}` -> `/explore/groups/{group_slug}/cookbooks` | ||
- `/explore/recipes/{group_slug}` -> `/explore/groups/{group_slug}/recipes` | ||
|
||
`/groups/members` previously returned a `UserOut` object, but now returns a `UserSummary`. Should you need the full user information (username, email, etc.), rather than just the summary, see `/households/members` instead for the household members. | ||
|
||
These endpoints have been completely removed: | ||
- `/admin/analytics` (no longer used) | ||
- `/groups/permissions` (see household permissions) | ||
- `/groups/statistics` (see household statistics) | ||
- `/groups/categories` (see organizer endpoints) | ||
- `/recipes/summary/untagged` (no longer used) | ||
- `/recipes/summary/uncategorized` (no longer used) | ||
- `/users/group-users` (see `/groups/members` and `/households/members`) | ||
|
||
### Frontend Links | ||
|
||
These frontend pages have moved: | ||
- `/group/mealplan/...` -> `/household/mealplan/...` | ||
- `/group/members` -> `/household/members` | ||
- `/group/notifiers` -> `/household/notifiers` | ||
- `/group/webhooks` -> `/household/webhooks` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
frontend/components/Domain/Household/GroupHouseholdSelector.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<template> | ||
<v-select | ||
v-model="selected" | ||
:items="households" | ||
:label="label" | ||
:hint="description" | ||
:persistent-hint="!!description" | ||
item-text="name" | ||
:multiple="multiselect" | ||
:prepend-inner-icon="$globals.icons.household" | ||
return-object | ||
> | ||
<template #selection="data"> | ||
<v-chip | ||
:key="data.index" | ||
class="ma-1" | ||
:input-value="data.selected" | ||
small | ||
close | ||
label | ||
color="accent" | ||
dark | ||
@click:close="removeByIndex(data.index)" | ||
> | ||
{{ data.item.name || data.item }} | ||
</v-chip> | ||
</template> | ||
</v-select> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { computed, defineComponent, onMounted, useContext } from "@nuxtjs/composition-api"; | ||
import { useHouseholdStore } from "~/composables/store/use-household-store"; | ||
interface HouseholdLike { | ||
id: string; | ||
name: string; | ||
} | ||
export default defineComponent({ | ||
props: { | ||
value: { | ||
type: Array as () => HouseholdLike[], | ||
required: true, | ||
}, | ||
multiselect: { | ||
type: Boolean, | ||
default: false, | ||
}, | ||
description: { | ||
type: String, | ||
default: "", | ||
}, | ||
}, | ||
setup(props, context) { | ||
const selected = computed({ | ||
get: () => props.value, | ||
set: (val) => { | ||
context.emit("input", val); | ||
}, | ||
}); | ||
onMounted(() => { | ||
if (selected.value === undefined) { | ||
selected.value = []; | ||
} | ||
}); | ||
const { i18n } = useContext(); | ||
const label = computed( | ||
() => props.multiselect ? i18n.tc("household.households") : i18n.tc("household.household") | ||
); | ||
const { store: households } = useHouseholdStore(); | ||
function removeByIndex(index: number) { | ||
if (selected.value === undefined) { | ||
return; | ||
} | ||
const newSelected = selected.value.filter((_, i) => i !== index); | ||
selected.value = [...newSelected]; | ||
} | ||
return { | ||
selected, | ||
label, | ||
households, | ||
removeByIndex, | ||
}; | ||
}, | ||
}); | ||
</script> |
Oops, something went wrong.