feat: D1 — Shopping list (Issue #30) #43

Merged
marcel merged 24 commits from feat/issue-30-shopping-list into master 2026-04-08 22:22:02 +02:00
2 changed files with 8 additions and 0 deletions
Showing only changes of commit 2253c76287 - Show all commits

View File

@@ -3,6 +3,7 @@ package com.recipeapp.shopping.entity;
import com.recipeapp.household.entity.Household;
import com.recipeapp.planning.entity.WeekPlan;
import jakarta.persistence.*;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@@ -23,6 +24,9 @@ public class ShoppingList {
@JoinColumn(name = "week_plan_id", nullable = false)
private WeekPlan weekPlan;
@Column(name = "generated_at", nullable = false)
private Instant generatedAt = Instant.now();
@OneToMany(mappedBy = "shoppingList", cascade = CascadeType.ALL, orphanRemoval = true)
private List<ShoppingListItem> items = new ArrayList<>();
@@ -36,5 +40,7 @@ public class ShoppingList {
public UUID getId() { return id; }
public Household getHousehold() { return household; }
public WeekPlan getWeekPlan() { return weekPlan; }
public Instant getGeneratedAt() { return generatedAt; }
public void setGeneratedAt(Instant generatedAt) { this.generatedAt = generatedAt; }
public List<ShoppingListItem> getItems() { return items; }
}

View File

@@ -0,0 +1,2 @@
ALTER TABLE shopping_list
ADD COLUMN generated_at timestamptz NOT NULL DEFAULT now();