From e2f57a1de051c03733b728badb2d338d6216a2f4 Mon Sep 17 00:00:00 2001 From: EldoPlo <129173853+EldoPlo@users.noreply.github.com> Date: Sun, 8 Dec 2024 20:49:16 +0100 Subject: [PATCH] Added mapping to models --- .../com/pogoda/weather/model/EspUserSettings.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/spring/src/main/java/com/pogoda/weather/model/EspUserSettings.java b/spring/src/main/java/com/pogoda/weather/model/EspUserSettings.java index ad9cb91..3c4ac52 100644 --- a/spring/src/main/java/com/pogoda/weather/model/EspUserSettings.java +++ b/spring/src/main/java/com/pogoda/weather/model/EspUserSettings.java @@ -1,24 +1,23 @@ package com.pogoda.weather.model; import jakarta.persistence.Entity; - import jakarta.persistence.Id; import jakarta.persistence.JoinColumn; import jakarta.persistence.ManyToOne; +import jakarta.persistence.Column; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @Entity - @NoArgsConstructor @Getter @Setter - public class EspUserSettings { @Id - private int userId; + private int userId; // To jest identyfikator, który w rzeczywistości powinien być zarządzany przez relację @ManyToOne z EspUsers + private int preferedUnitId; private int lngId; private boolean darkModeOn; @@ -32,7 +31,7 @@ public class EspUserSettings { private EspMeasureUnits preferredUnit; @ManyToOne - @JoinColumn(name = "userId", nullable = false) + @JoinColumn(name = "userId", nullable = false, insertable = false, updatable = false) private EspUsers user; public EspUserSettings(int userId, int preferedUnitId, int lngId, boolean darkModeOn) { @@ -41,5 +40,4 @@ public EspUserSettings(int userId, int preferedUnitId, int lngId, boolean darkMo this.lngId = lngId; this.darkModeOn = darkModeOn; } - -} \ No newline at end of file +}