Merge branch 'scene-guest-fix' into 'dev'
Scene guest fix See merge request sa4-2020/the-sanmarinoes/backend!113
This commit is contained in:
commit
5649ca9c29
2 changed files with 3 additions and 2 deletions
|
@ -70,7 +70,7 @@ public class SceneController {
|
|||
Utils.returnIfGuest(userRepository, null, hostId, principal);
|
||||
return sceneService.applyAsGuest(
|
||||
sceneRepository
|
||||
.findByIdAndUserId(id, hostId)
|
||||
.findByIdAndUserIdAndGuestAccessEnabled(id, hostId, true)
|
||||
.orElseThrow(NotFoundException::new),
|
||||
principal.getName(),
|
||||
hostId);
|
||||
|
|
|
@ -23,5 +23,6 @@ public interface SceneRepository extends CrudRepository<Scene, Long> {
|
|||
@Query("SELECT s FROM Scene s JOIN s.user u WHERE u.id = ?1 AND s.guestAccessEnabled = true")
|
||||
List<Scene> findByHostId(Long hostId);
|
||||
|
||||
Optional<Scene> findByIdAndUserId(Long id, Long userId);
|
||||
Optional<Scene> findByIdAndUserIdAndGuestAccessEnabled(
|
||||
Long id, Long userId, boolean guestAccessEnabled);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue