diff --git a/.gitignore b/.gitignore index 1b1a367..ee01dda 100644 --- a/.gitignore +++ b/.gitignore @@ -136,3 +136,6 @@ gradle-app.setting # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 # gradle/wrapper/gradle-wrapper.properties + +# IntelliJ +*.iml \ No newline at end of file diff --git a/backend.iml b/backend.iml deleted file mode 100644 index 1eae0df..0000000 --- a/backend.iml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Device.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Device.java index 7aa65e8..e8a621b 100644 --- a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Device.java +++ b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Device.java @@ -30,7 +30,7 @@ public abstract class Device { * The room this device belongs in, as a foreign key id. To use when updating and inserting from * a REST call. */ - @Column(name = "room_id", nullable = false) + @Column(name = "room_id", nullable = false, unique = true) @NotNull private Long roomId; diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Room.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Room.java index c5b196a..e54b462 100644 --- a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Room.java +++ b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/Room.java @@ -111,7 +111,7 @@ public class Room { @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "id", updatable = false, nullable = false) + @Column(name = "id", updatable = false, nullable = false, unique = true) @ApiModelProperty(hidden = true) private Long id; @@ -133,7 +133,7 @@ public class Room { * inserting from a REST call. */ @NotNull - @Column(name = "user_id", nullable = false) + @Column(name = "user_id", nullable = false, unique = true) private Long userId; /** The user given name of this room (e.g. 'Master bedroom') */ diff --git a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/User.java b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/User.java index ba86712..f1b88ca 100644 --- a/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/User.java +++ b/src/main/java/ch/usi/inf/sa4/sanmarinoes/smarthut/models/User.java @@ -9,7 +9,7 @@ public class User { @Id @GeneratedValue(strategy = GenerationType.AUTO) - @Column(name = "id", updatable = false, nullable = false) + @Column(name = "id", updatable = false, nullable = false, unique = true) @ApiModelProperty(hidden = true) private Long id; @@ -17,8 +17,8 @@ public class User { @Column(nullable = false) private String name; - /** The full name of the user */ - @Column(nullable = false) + /** The full username of the user */ + @Column(nullable = false, unique = true) private String username; /** A properly salted way to store the password */