small cahnges
This commit is contained in:
parent
c853c4cd4e
commit
d8bea0015b
10 changed files with 26 additions and 30 deletions
|
@ -18,6 +18,8 @@ public class RoomController {
|
|||
|
||||
@Autowired private UserRepository userRepository;
|
||||
|
||||
@Autowired private DeviceRepository deviceRepository;
|
||||
|
||||
@GetMapping
|
||||
public Iterable<Room> findAll() {
|
||||
return roomRepository.findAll();
|
||||
|
@ -55,4 +57,14 @@ public class RoomController {
|
|||
public void deleteById(@PathVariable("id") long id) {
|
||||
roomRepository.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a List<Device> of all Devices that are present in a given room (identified by its
|
||||
* id).
|
||||
*/
|
||||
@GetMapping(path = "/room/{roomid}/devices")
|
||||
@ResponseBody
|
||||
public List<Device> getDevices(@PathVariable("roomid") long roomid) {
|
||||
return deviceRepository.findByRoomId(roomid);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
public interface ButtonDimmerRepository extends CrudRepository<ButtonDimmer, Long> {}
|
||||
public interface ButtonDimmerRepository extends DeviceRepository<ButtonDimmer> {}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
public interface DimmableLightRepository extends CrudRepository<DimmableLight, Long> {}
|
||||
public interface DimmableLightRepository extends DeviceRepository<DimmableLight> {}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
public interface KnobDimmerRepository extends CrudRepository<KnobDimmer, Long> {}
|
||||
public interface KnobDimmerRepository extends DeviceRepository<KnobDimmer> {}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
public interface MotionSensorRepository extends CrudRepository<MotionSensor, Long> {}
|
||||
public interface MotionSensorRepository extends DeviceRepository<MotionSensor> {}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
public interface RegularLightRepository extends CrudRepository<RegularLight, Long> {}
|
||||
public interface RegularLightRepository extends DeviceRepository<RegularLight> {}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
public interface SensorRepository extends CrudRepository<Sensor, Long> {}
|
||||
public interface SensorRepository extends DeviceRepository<Sensor> {}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
public interface SmartPlugRepository extends CrudRepository<SmartPlug, Long> {}
|
||||
public interface SmartPlugRepository extends DeviceRepository<SmartPlug> {}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
||||
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
public interface SwitchRepository extends CrudRepository<Switch, Long> {}
|
||||
public interface SwitchRepository extends DeviceRepository<Switch> {}
|
||||
|
|
|
@ -2,11 +2,7 @@ package ch.usi.inf.sa4.sanmarinoes.smarthut.models;
|
|||
|
||||
import java.util.Set;
|
||||
import javax.persistence.*;
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/** A user of the Smarthut application */
|
||||
@Entity(name = "smarthutuser")
|
||||
|
@ -33,7 +29,11 @@ public class User {
|
|||
@NotNull
|
||||
@Column(nullable = false)
|
||||
@NotEmpty(message = "Please provide a password")
|
||||
@Min(value = 6, message = "Your password should be at least 6 characters long")
|
||||
@Size(
|
||||
min = 6,
|
||||
max = 255,
|
||||
message =
|
||||
"Your password should be at least 6 characters long and at most 255 chars long")
|
||||
private String password;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue