I'm building a personal expense tracker that has a desktop and web client. I have a Springboot server for the local client to sync to and from. The desktop client can create and store expenses locally and sync with the server via API on command.
The expenses record class is:
public final class Expense {
private final String id;
private BigDecimal amount;
private boolean isFixed;
private String description;
private String category;
private Priority priority;
private LocalDateTime createdAt;
private LocalDateTime updatedAt;
}
Where Priority is an enum [LOW,MEDIUM,HIGH] and the id is UUID.randomUUID, both equals() and hashCode() check only the ID (primary key in the DB). This record is identical on both the server and desktop and jackson handles them perfectly.
I'm having a hard time designing the detection and resolution flow when the ID is identical and when it's not. How can I implement that flow. Same ID but different contents is worth flagging but different ID and somewhat related contents is also something worth resolving.