feat(shopping): add generated_at column to shopping_list
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ package com.recipeapp.shopping.entity;
|
|||||||
import com.recipeapp.household.entity.Household;
|
import com.recipeapp.household.entity.Household;
|
||||||
import com.recipeapp.planning.entity.WeekPlan;
|
import com.recipeapp.planning.entity.WeekPlan;
|
||||||
import jakarta.persistence.*;
|
import jakarta.persistence.*;
|
||||||
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@@ -23,6 +24,9 @@ public class ShoppingList {
|
|||||||
@JoinColumn(name = "week_plan_id", nullable = false)
|
@JoinColumn(name = "week_plan_id", nullable = false)
|
||||||
private WeekPlan weekPlan;
|
private WeekPlan weekPlan;
|
||||||
|
|
||||||
|
@Column(name = "generated_at", nullable = false)
|
||||||
|
private Instant generatedAt = Instant.now();
|
||||||
|
|
||||||
@OneToMany(mappedBy = "shoppingList", cascade = CascadeType.ALL, orphanRemoval = true)
|
@OneToMany(mappedBy = "shoppingList", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||||
private List<ShoppingListItem> items = new ArrayList<>();
|
private List<ShoppingListItem> items = new ArrayList<>();
|
||||||
|
|
||||||
@@ -36,5 +40,7 @@ public class ShoppingList {
|
|||||||
public UUID getId() { return id; }
|
public UUID getId() { return id; }
|
||||||
public Household getHousehold() { return household; }
|
public Household getHousehold() { return household; }
|
||||||
public WeekPlan getWeekPlan() { return weekPlan; }
|
public WeekPlan getWeekPlan() { return weekPlan; }
|
||||||
|
public Instant getGeneratedAt() { return generatedAt; }
|
||||||
|
public void setGeneratedAt(Instant generatedAt) { this.generatedAt = generatedAt; }
|
||||||
public List<ShoppingListItem> getItems() { return items; }
|
public List<ShoppingListItem> getItems() { return items; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE shopping_list
|
||||||
|
ADD COLUMN generated_at timestamptz NOT NULL DEFAULT now();
|
||||||
Reference in New Issue
Block a user