Skip to content

Commit

Permalink
[Added adnotations to models]
Browse files Browse the repository at this point in the history
  • Loading branch information
EldoPlo committed Dec 8, 2024
1 parent 33dbc1b commit e64b4e8
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions spring/src/main/java/com/pogoda/weather/model/EspAlerts.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

import java.util.List;





import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -21,6 +23,9 @@ public class EspMeasureUnits {
private String unitId;
private String name;

@OneToMany(mappedBy = "preferredUnit")
private List<EspUserSettings> userSettings;

public EspMeasureUnits(String name) {
this.name = name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class EspUsers {

@OneToMany(mappedBy = "userId")
private List<EspUsersAlert> alerts;

@OneToMany(mappedBy = "userId")
private List<EspUserSettings> settings;

Expand Down

0 comments on commit e64b4e8

Please sign in to comment.