Ignore:
Timestamp:
05/24/23 23:18:47 (18 months ago)
Author:
Gjoko Kostadinov <gjoko.kostadinov@…>
Branches:
master
Children:
77205be
Parents:
8bcd64c
Message:

Periodic update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/edu/gjoko/schedlr/services/BusinessService.java

    r8bcd64c r950fa0d  
    11package edu.gjoko.schedlr.services;
    22
    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;
     3import edu.gjoko.schedlr.entity.*;
    74import edu.gjoko.schedlr.repositories.BusinessRepository;
     5import edu.gjoko.schedlr.repositories.ServiceRepository;
    86import edu.gjoko.schedlr.repositories.ServiceTypeRepository;
     7import edu.gjoko.schedlr.repositories.StakeholderRepository;
    98import lombok.AllArgsConstructor;
    109import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
     
    1312import java.util.List;
    1413
     14import static edu.gjoko.schedlr.entity.BusinessStatus.ACTIVE;
    1515import static edu.gjoko.schedlr.entity.BusinessStatus.NEW;
    1616
     
    2121    private final BusinessRepository businessRepository;
    2222    private final ServiceTypeRepository serviceTypeRepository;
     23    private final ServiceRepository serviceRepository;
     24
     25    private final StakeholderRepository stakeholderRepository;
    2326    private BCryptPasswordEncoder bCryptPasswordEncoder;
    2427
     
    5154                .stream()
    5255                .forEach(business -> {
     56                    stakeholderRepository.save(business.getOwner());
     57                    serviceRepository.saveAll(business.getServices());
    5358                    businessRepository.save(business);
    5459                });
     
    6065        return businessRepository.findBusinessByOwner(owner);
    6166    }
     67
     68    public List<Business> findByBusinessTypeAndActiveStatus(BusinessType businessType) {
     69        return businessRepository.findBusinessesByBusinessTypeAndBusinessStatus(businessType, ACTIVE);
     70    }
    6271}
Note: See TracChangeset for help on using the changeset viewer.