- Timestamp:
- 04/19/23 21:19:08 (19 months ago)
- Branches:
- master
- Children:
- 950fa0d
- Parents:
- 9050790
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/edu/gjoko/schedlr/services/BusinessService.java
r9050790 r8bcd64c 3 3 import edu.gjoko.schedlr.entity.Business; 4 4 import edu.gjoko.schedlr.entity.ServiceType; 5 import edu.gjoko.schedlr.entity.Stakeholder; 5 6 import edu.gjoko.schedlr.entity.StakeholderType; 6 7 import edu.gjoko.schedlr.repositories.BusinessRepository; 7 8 import edu.gjoko.schedlr.repositories.ServiceTypeRepository; 8 9 import lombok.AllArgsConstructor; 10 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; 9 11 import org.springframework.stereotype.Service; 10 12 11 13 import java.util.List; 12 14 13 import static edu.gjoko.schedlr.entity.BusinessStatus.ACTIVE;14 15 import static edu.gjoko.schedlr.entity.BusinessStatus.NEW; 15 16 … … 20 21 private final BusinessRepository businessRepository; 21 22 private final ServiceTypeRepository serviceTypeRepository; 23 private BCryptPasswordEncoder bCryptPasswordEncoder; 22 24 23 25 public void saveBusiness(Business business) { 24 26 saveNewServiceTypes(business); 25 27 business.getOwner().setStakeholderType(StakeholderType.BUSINESS_OWNER); 28 business.getOwner().setPassword(bCryptPasswordEncoder.encode(business.getOwner().getPassword())); 26 29 business.setBusinessStatus(NEW); 27 30 businessRepository.save(business); … … 52 55 } 53 56 57 public Business findByOwner(Long ownerId) { 58 var owner = new Stakeholder(); 59 owner.setId(ownerId); 60 return businessRepository.findBusinessByOwner(owner); 61 } 54 62 }
Note:
See TracChangeset
for help on using the changeset viewer.