Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buckets dont sync across devices #92

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import jakarta.persistence.Id;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.Table;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Immutable;
Expand All @@ -14,13 +15,16 @@
@Entity
@Table(name = "pantry_item_duplicates")
@Immutable
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
public class PantryItemDuplicate {

@Id
@ManyToOne(fetch = FetchType.LAZY)
@EqualsAndHashCode.Include
private PantryItem pantryItem;
@Id
@ManyToOne(fetch = FetchType.LAZY)
@EqualsAndHashCode.Include
private PantryItem duplicate;
private boolean loose;
private float matchRank;
Expand Down
12 changes: 2 additions & 10 deletions src/main/java/com/brennaswitzer/cookbook/domain/PlanBucket.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,25 @@
import java.time.LocalDate;
import java.util.Collection;

@Setter
@Getter
@Entity
@Table(name = "plan_bucket", uniqueConstraints = {
@UniqueConstraint(columnNames = { "plan_id", "name" })
})
public class PlanBucket extends BaseEntity implements Named {

@NotNull
@Getter
@Setter
@ManyToOne(fetch = FetchType.LAZY)
private Plan plan;

@Getter
@Setter
private String name;

@Getter
@Setter
private LocalDate date;

@Getter
@Setter
@OneToMany(mappedBy = "bucket")
private Collection<PlanItem> items;

@Getter
@Setter
@Column(name = "mod_count")
private int modCount;

Expand Down
10 changes: 6 additions & 4 deletions src/main/java/com/brennaswitzer/cookbook/web/PlanController.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,19 @@ public ShareInfo getShareInfoById(
public List<PlanItemInfo> getDescendants(
@PathVariable("id") Long id
) {
return PlanItemInfo.fromPlanItems(planService
.getTreeById(id));
return PlanItemInfo.fromPlanItems(
planService.getTreeById(id));
}

@GetMapping("/{id}/all-since")
public List<PlanItemInfo> getUpdatedSince(
@PathVariable("id") Long id,
@RequestParam Long cutoff
) {
return PlanItemInfo.fromPlanItems(planService
.getTreeDeltasById(id, Instant.ofEpochMilli(cutoff)));
return PlanItemInfo.fromPlanItems(
planService.getTreeDeltasById(
id,
Instant.ofEpochMilli(cutoff)));
}

@PostMapping("/{id}/mutate-tree")
Expand Down
Loading