hopefully fixed invited relationship

This commit is contained in:
Tommaso Rodolfo Masera 2020-04-18 14:11:21 +02:00
parent 6e36d7d306
commit d2aaa45a8b
2 changed files with 5 additions and 5 deletions

View file

@ -1,6 +1,5 @@
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
import java.util.Set;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
@ -8,10 +7,6 @@ import javax.validation.constraints.NotNull;
@Entity
public class Invited {
/** A host user who can invite guests to their smart house */
@OneToMany(mappedBy = "host")
private Set<User> host;
/** Guests that have been invited to the host's house */
@ManyToOne
@JoinColumn(name = "guests")

View file

@ -3,6 +3,7 @@ package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
import ch.usi.inf.sa4.sanmarinoes.smarthut.config.GsonExclude;
import io.swagger.annotations.ApiModelProperty;
import java.util.Objects;
import java.util.Set;
import javax.persistence.*;
/** A user of the Smarthut application */
@ -35,6 +36,10 @@ public class User {
@Column(nullable = false, unique = true)
private String email;
/** A host user who can invite guests to their smart house */
@OneToMany(mappedBy = "host")
private Set<Invited> guests;
@Column(nullable = false)
@GsonExclude
private Boolean isEnabled = false;