| | |
| | | } |
| | | |
| | | public Satisfaction scorefaction(SatisfactionCustomerScoreDTO scoreDTO) { |
| | | Optional<Satisfaction> satisfactionOP = getByAppointmentId(scoreDTO.getAppointmentId()); |
| | | Optional<Satisfaction> satisfactionOP = getByAppointmentIdAndType(scoreDTO.getAppointmentId(), SatisfactionTypeEnum.APPOINTMENT); |
| | | Satisfaction satisfaction = satisfactionOP.orElseThrow(SatisfactionNotFoundException::new); |
| | | satisfaction.setScore(scoreDTO.getScore()); |
| | | satisfaction.setStatus(SatisfactionStatusEnum.FILLED); |
| | |
| | | } |
| | | |
| | | public Satisfaction createAppointmentSatisfaction(Appointment appointment) { |
| | | boolean isexist = getByAppointmentId(appointment.getId()).isPresent(); |
| | | boolean isexist = getByAppointmentIdAndType(appointment.getId(), SatisfactionTypeEnum.APPOINTMENT).isPresent(); |
| | | if(isexist) { |
| | | throw new SatisfactionAlreadyExistException(); |
| | | } |
| | |
| | | return satisfactionMapper.toDTO(satisfactionList); |
| | | } |
| | | |
| | | public Optional<Satisfaction> getByAppointmentId(Long appointmentId) { |
| | | return satisfactionRepository.findOneByAppointmentId(appointmentId); |
| | | public Optional<Satisfaction> getByAppointmentIdAndType(Long appointmentId, SatisfactionTypeEnum type) { |
| | | return satisfactionRepository.findOneByAppointmentIdAndType(appointmentId, type); |
| | | } |
| | | |
| | | public List<Satisfaction> getByStatusAndType(SatisfactionStatusEnum status, SatisfactionTypeEnum type) { |