From a05788c53ba9fc6788d4b64e40f58ee7d50b6c95 Mon Sep 17 00:00:00 2001 From: jzitnik-dev Date: Mon, 30 Dec 2024 13:14:16 +0100 Subject: [PATCH] feat: Interaction memory --- .../java/cz/jzitnik/chronos/entities/Interaction.java | 8 +++++++- .../src/main/java/cz/jzitnik/chronos/entities/Player.java | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/cz/jzitnik/chronos/entities/Interaction.java b/backend/src/main/java/cz/jzitnik/chronos/entities/Interaction.java index d2ba7fd..8036079 100644 --- a/backend/src/main/java/cz/jzitnik/chronos/entities/Interaction.java +++ b/backend/src/main/java/cz/jzitnik/chronos/entities/Interaction.java @@ -2,7 +2,6 @@ package cz.jzitnik.chronos.entities; import com.fasterxml.jackson.annotation.JsonIgnore; import jakarta.persistence.*; -import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @@ -31,4 +30,11 @@ public class Interaction { this.interactedWithText = interactedWithText; this.character = character; } + + @JsonIgnore + private String memory; + + @ManyToOne + @JsonIgnore + private Player player; } diff --git a/backend/src/main/java/cz/jzitnik/chronos/entities/Player.java b/backend/src/main/java/cz/jzitnik/chronos/entities/Player.java index b727c63..2d812bf 100644 --- a/backend/src/main/java/cz/jzitnik/chronos/entities/Player.java +++ b/backend/src/main/java/cz/jzitnik/chronos/entities/Player.java @@ -55,6 +55,10 @@ public class Player { @JsonIgnore private List seenCharacters = new ArrayList<>(); + @OneToMany(mappedBy = "player", cascade = CascadeType.ALL) + @JsonIgnore + private List interactions = new ArrayList<>(); + public Player(String name) { this.name = name; }