Skip to content

Commit

Permalink
Added mapping to models
Browse files Browse the repository at this point in the history
  • Loading branch information
EldoPlo committed Dec 8, 2024
1 parent e64b4e8 commit e2f57a1
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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) {
Expand All @@ -41,5 +40,4 @@ public EspUserSettings(int userId, int preferedUnitId, int lngId, boolean darkMo
this.lngId = lngId;
this.darkModeOn = darkModeOn;
}

}
}

0 comments on commit e2f57a1

Please sign in to comment.