From e64b4e8e9ceec5c0f46ec89c2b81447d5662348b Mon Sep 17 00:00:00 2001
From: EldoPlo <129173853+EldoPlo@users.noreply.github.com>
Date: Sun, 8 Dec 2024 20:03:22 +0100
Subject: [PATCH] [Added adnotations to models]
---
.idea/vcs.xml | 1 +
.../src/main/java/com/pogoda/weather/model/EspAlerts.java | 4 ----
.../main/java/com/pogoda/weather/model/EspMeasureUnits.java | 5 +++++
.../main/java/com/pogoda/weather/model/EspUserSettings.java | 6 +++---
spring/src/main/java/com/pogoda/weather/model/EspUsers.java | 2 +-
5 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
index 35eb1dd..bee36c6 100644
--- a/.idea/vcs.xml
+++ b/.idea/vcs.xml
@@ -2,5 +2,6 @@
+
\ No newline at end of file
diff --git a/spring/src/main/java/com/pogoda/weather/model/EspAlerts.java b/spring/src/main/java/com/pogoda/weather/model/EspAlerts.java
index 9966b22..9374528 100644
--- a/spring/src/main/java/com/pogoda/weather/model/EspAlerts.java
+++ b/spring/src/main/java/com/pogoda/weather/model/EspAlerts.java
@@ -2,10 +2,6 @@
import java.util.List;
-
-
-
-
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
diff --git a/spring/src/main/java/com/pogoda/weather/model/EspMeasureUnits.java b/spring/src/main/java/com/pogoda/weather/model/EspMeasureUnits.java
index c56aa32..b146317 100644
--- a/spring/src/main/java/com/pogoda/weather/model/EspMeasureUnits.java
+++ b/spring/src/main/java/com/pogoda/weather/model/EspMeasureUnits.java
@@ -1,9 +1,11 @@
package com.pogoda.weather.model;
+import java.util.List;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
+import jakarta.persistence.OneToMany;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -21,6 +23,9 @@ public class EspMeasureUnits {
private String unitId;
private String name;
+ @OneToMany(mappedBy = "preferredUnit")
+ private List userSettings;
+
public EspMeasureUnits(String name) {
this.name = name;
}
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 f1d74be..ad9cb91 100644
--- a/spring/src/main/java/com/pogoda/weather/model/EspUserSettings.java
+++ b/spring/src/main/java/com/pogoda/weather/model/EspUserSettings.java
@@ -24,15 +24,15 @@ public class EspUserSettings {
private boolean darkModeOn;
@ManyToOne
- @JoinColumn(name = "lang_id", nullable = false)
+ @JoinColumn(name = "langId", nullable = false)
private EspLanguages language;
@ManyToOne
- @JoinColumn(name = "preferred_unit_id", nullable = false)
+ @JoinColumn(name = "preferredUnitId", nullable = false)
private EspMeasureUnits preferredUnit;
@ManyToOne
- @JoinColumn(name = "user_id", nullable = false)
+ @JoinColumn(name = "userId", nullable = false)
private EspUsers user;
public EspUserSettings(int userId, int preferedUnitId, int lngId, boolean darkModeOn) {
diff --git a/spring/src/main/java/com/pogoda/weather/model/EspUsers.java b/spring/src/main/java/com/pogoda/weather/model/EspUsers.java
index 7923fe1..a99eda2 100644
--- a/spring/src/main/java/com/pogoda/weather/model/EspUsers.java
+++ b/spring/src/main/java/com/pogoda/weather/model/EspUsers.java
@@ -26,7 +26,7 @@ public class EspUsers {
@OneToMany(mappedBy = "userId")
private List alerts;
-
+
@OneToMany(mappedBy = "userId")
private List settings;