category change fix

This commit is contained in:
vabene1111
2025-12-04 07:19:58 +01:00
parent 24426c2b7e
commit d0856ce3b7
3 changed files with 5 additions and 4 deletions

View File

@@ -1435,7 +1435,7 @@ class ShoppingListRecipeSerializer(serializers.ModelSerializer):
class FoodShoppingSerializer(serializers.ModelSerializer): class FoodShoppingSerializer(serializers.ModelSerializer):
supermarket_category = SupermarketCategorySerializer(read_only=True) supermarket_category = SupermarketCategorySerializer(read_only=True)
shopping_lists = ShoppingListSerializer(read_only=True) shopping_lists = ShoppingListSerializer(read_only=True, many=True)
class Meta: class Meta:
model = Food model = Food

View File

@@ -174,6 +174,7 @@ const isShoppingLineDelayed = computed(() => {
function categoryUpdate(category: SupermarketCategory) { function categoryUpdate(category: SupermarketCategory) {
const api = new ApiApi() const api = new ApiApi()
shoppingListFood.value.food.supermarketCategory = category shoppingListFood.value.food.supermarketCategory = category
useShoppingStore().updateEntriesStructure()
api.apiFoodUpdate({id: shoppingListFood.value.food.id, food: shoppingListFood.value.food}).then(r => { api.apiFoodUpdate({id: shoppingListFood.value.food.id, food: shoppingListFood.value.food}).then(r => {
useMessageStore().addPreparedMessage(PreparedMessage.UPDATE_SUCCESS) useMessageStore().addPreparedMessage(PreparedMessage.UPDATE_SUCCESS)
}).catch(err => { }).catch(err => {

View File

@@ -58,10 +58,10 @@ export interface FoodShopping {
readonly supermarketCategory: SupermarketCategory; readonly supermarketCategory: SupermarketCategory;
/** /**
* *
* @type {ShoppingList} * @type {Array<ShoppingList>}
* @memberof FoodShopping * @memberof FoodShopping
*/ */
readonly shoppingLists: ShoppingList; readonly shoppingLists: Array<ShoppingList>;
} }
/** /**
@@ -88,7 +88,7 @@ export function FoodShoppingFromJSONTyped(json: any, ignoreDiscriminator: boolea
'name': json['name'], 'name': json['name'],
'pluralName': json['plural_name'] == null ? undefined : json['plural_name'], 'pluralName': json['plural_name'] == null ? undefined : json['plural_name'],
'supermarketCategory': SupermarketCategoryFromJSON(json['supermarket_category']), 'supermarketCategory': SupermarketCategoryFromJSON(json['supermarket_category']),
'shoppingLists': ShoppingListFromJSON(json['shopping_lists']), 'shoppingLists': ((json['shopping_lists'] as Array<any>).map(ShoppingListFromJSON)),
}; };
} }