mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-04 04:55:21 +02:00
fix: Mealplans Disappearing/Can't be edited (#4379)
This commit is contained in:
parent
c40d2d0486
commit
79b36024a4
2 changed files with 8 additions and 5 deletions
|
@ -220,7 +220,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, computed, reactive, ref, watch, onMounted } from "@nuxtjs/composition-api";
|
||||
import { defineComponent, computed, reactive, ref, watch, onMounted, useContext } from "@nuxtjs/composition-api";
|
||||
import { format } from "date-fns";
|
||||
import { SortableEvent } from "sortablejs";
|
||||
import draggable from "vuedraggable";
|
||||
|
@ -249,6 +249,7 @@ export default defineComponent({
|
|||
},
|
||||
setup(props) {
|
||||
const api = useUserApi();
|
||||
const { $auth } = useContext();
|
||||
const { household } = useHouseholdSelf();
|
||||
|
||||
const state = ref({
|
||||
|
@ -309,6 +310,7 @@ export default defineComponent({
|
|||
existing: false,
|
||||
id: 0,
|
||||
groupId: "",
|
||||
userId: $auth.user?.id || "",
|
||||
});
|
||||
|
||||
function openDialog(date: Date) {
|
||||
|
@ -317,17 +319,18 @@ export default defineComponent({
|
|||
}
|
||||
|
||||
function editMeal(mealplan: UpdatePlanEntry) {
|
||||
const { date, title, text, entryType, recipeId, id, groupId } = mealplan;
|
||||
const { date, title, text, entryType, recipeId, id, groupId, userId } = mealplan;
|
||||
if (!entryType) return;
|
||||
|
||||
newMeal.date = date;
|
||||
newMeal.title = title || "";
|
||||
newMeal.text = text || "";
|
||||
newMeal.recipeId = recipeId;
|
||||
newMeal.recipeId = recipeId || undefined;
|
||||
newMeal.entryType = entryType;
|
||||
newMeal.existing = true;
|
||||
newMeal.id = id;
|
||||
newMeal.groupId = groupId;
|
||||
newMeal.userId = userId || $auth.user?.id || "";
|
||||
|
||||
state.value.dialog = true;
|
||||
dialog.note = !recipeId;
|
||||
|
|
|
@ -47,12 +47,12 @@ class CreatePlanEntry(MealieModel):
|
|||
class UpdatePlanEntry(CreatePlanEntry):
|
||||
id: int
|
||||
group_id: UUID
|
||||
user_id: UUID | None = None
|
||||
user_id: UUID
|
||||
|
||||
|
||||
class SavePlanEntry(CreatePlanEntry):
|
||||
group_id: UUID
|
||||
user_id: UUID | None = None
|
||||
user_id: UUID
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue