store routingpreferences for each user in database, get and update via service, create with default for new users
This commit is contained in:
@@ -2,6 +2,7 @@ package SuMoC.backend.user.models;
|
||||
|
||||
import SuMoC.backend.gamification.badges.models.UserBadge;
|
||||
import SuMoC.backend.notification.models.NotificationToken;
|
||||
import SuMoC.backend.routing.models.RoutingPreferences;
|
||||
import SuMoC.backend.trip.models.Trip;
|
||||
import SuMoC.backend.user.enums.RoleName;
|
||||
import SuMoC.backend.user.enums.VisibilityPrivacy;
|
||||
@@ -67,6 +68,10 @@ public class User {
|
||||
@OneToOne(mappedBy = "user", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private StatsList statsList;
|
||||
|
||||
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@JoinColumn(name = "routing_preferences_id", unique = true)
|
||||
private RoutingPreferences routingPreferences;
|
||||
|
||||
public User() {
|
||||
}
|
||||
|
||||
@@ -90,6 +95,7 @@ public class User {
|
||||
this.password = password;
|
||||
this.visibilityPrivacy = VisibilityPrivacy.NONE;
|
||||
this.friendCode = java.util.UUID.randomUUID().toString(); // generate unique friend code
|
||||
this.routingPreferences = RoutingPreferences.getDefaultPreferences(); // Init with default routing preferences
|
||||
this.roles = new HashSet<>();
|
||||
this.roles.add(RoleName.USER);
|
||||
this.statsList = new StatsList(this);
|
||||
@@ -194,4 +200,12 @@ public class User {
|
||||
public void setNotificationToken(NotificationToken notificationToken) {
|
||||
this.notificationToken = notificationToken;
|
||||
}
|
||||
|
||||
public RoutingPreferences getRoutingPreferences() {
|
||||
return routingPreferences;
|
||||
}
|
||||
|
||||
public void setRoutingPreferences(RoutingPreferences routingPreferences) {
|
||||
this.routingPreferences = routingPreferences;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user