@Override public GameRoom create(final GameRoomDto.Create createDto) throws JsonProcessingException { final GameRoom gameRoom = modelMapper.map(createDto, GameRoom.class); if (gameRoomRepository.findOneByOwnerAndEnabled(createDto.getOwner(), Enabled.TRUE) != null) { log.error( "owner duplicated exception. {} : {}", createDto.getOwner().getId(), createDto.getOwner().getNickname()); throw new OwnerDuplicatedException("[" + createDto.getOwner().getEmail() + "] 중복된 방장 입니다."); } fillInitData(gameRoom); return gameRoomRepository.save(gameRoom); }
@Override public List<GameRoom> getAllByEnabled(Enabled enabled) { return gameRoomRepository.findAllByEnabled(enabled); }
@Override public GameRoom getByIdAndEnabled(Long id, Enabled enabled) { return gameRoomRepository.findOneByIdAndEnabled(id, enabled); }
@Override public GameRoom update(GameRoom gameRoom) { return gameRoomRepository.save(gameRoom); }
@Override public Page<GameRoom> getAllByEnabled(Enabled enabled, Pageable pageable) { return gameRoomRepository.findAllByEnabled(enabled, pageable); }