- Timestamp:
- 05/24/23 23:18:47 (18 months ago)
- Branches:
- master
- Children:
- 77205be
- Parents:
- 8bcd64c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/edu/gjoko/schedlr/services/BusinessService.java
r8bcd64c r950fa0d 1 1 package edu.gjoko.schedlr.services; 2 2 3 import edu.gjoko.schedlr.entity.Business; 4 import edu.gjoko.schedlr.entity.ServiceType; 5 import edu.gjoko.schedlr.entity.Stakeholder; 6 import edu.gjoko.schedlr.entity.StakeholderType; 3 import edu.gjoko.schedlr.entity.*; 7 4 import edu.gjoko.schedlr.repositories.BusinessRepository; 5 import edu.gjoko.schedlr.repositories.ServiceRepository; 8 6 import edu.gjoko.schedlr.repositories.ServiceTypeRepository; 7 import edu.gjoko.schedlr.repositories.StakeholderRepository; 9 8 import lombok.AllArgsConstructor; 10 9 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; … … 13 12 import java.util.List; 14 13 14 import static edu.gjoko.schedlr.entity.BusinessStatus.ACTIVE; 15 15 import static edu.gjoko.schedlr.entity.BusinessStatus.NEW; 16 16 … … 21 21 private final BusinessRepository businessRepository; 22 22 private final ServiceTypeRepository serviceTypeRepository; 23 private final ServiceRepository serviceRepository; 24 25 private final StakeholderRepository stakeholderRepository; 23 26 private BCryptPasswordEncoder bCryptPasswordEncoder; 24 27 … … 51 54 .stream() 52 55 .forEach(business -> { 56 stakeholderRepository.save(business.getOwner()); 57 serviceRepository.saveAll(business.getServices()); 53 58 businessRepository.save(business); 54 59 }); … … 60 65 return businessRepository.findBusinessByOwner(owner); 61 66 } 67 68 public List<Business> findByBusinessTypeAndActiveStatus(BusinessType businessType) { 69 return businessRepository.findBusinessesByBusinessTypeAndBusinessStatus(businessType, ACTIVE); 70 } 62 71 }
Note:
See TracChangeset
for help on using the changeset viewer.