- Timestamp:
- 01/06/21 20:48:58 (4 years ago)
- Branches:
- master
- Children:
- 4a15c9c
- Parents:
- 504c3ef
- Location:
- src/main/java/it/finki/tinki
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/it/finki/tinki/repository/CompanyRepository.java
r504c3ef r721cb87 5 5 import org.springframework.stereotype.Repository; 6 6 7 import java.util.Optional; 8 7 9 @Repository 8 10 public interface CompanyRepository extends JpaRepository<Company, Long> { 9 11 Company findByEmailAndPassword(String email, String password); 12 Optional<Object> findByEmail(String email); 10 13 } -
src/main/java/it/finki/tinki/service/AccountService.java
r504c3ef r721cb87 1 1 package it.finki.tinki.service; 2 2 3 import it.finki.tinki.model.Skill; 3 4 import it.finki.tinki.model.Users.Account; 4 5 import it.finki.tinki.model.enumerator.AccountType; 5 6 7 import java.util.List; 6 8 import java.util.Map; 7 9 8 10 public interface AccountService { 9 11 Account findUser(String email, String password, AccountType type); 12 Account registerUser(String email, String password, String name, String surname, List<Skill> retainedSkills, List<Skill> skillsToLearn); 13 Account registerTeam(String email, String password, String name, int members); 14 Account registerCompany(String email, String password, String name, String country, String city, String street); 10 15 } -
src/main/java/it/finki/tinki/service/impl/AccountServiceImpl.java
r504c3ef r721cb87 80 80 return this.teamRepository.save(t); 81 81 } 82 83 public Account registerCompany(String email, String password, String name, String country, String city, String street){ 84 if(email==null || email.isEmpty() || password==null || password.isEmpty() || name==null || name.isEmpty() 85 || country==null || country.isEmpty() || city==null || city.isEmpty() || street==null || street.isEmpty()){ 86 throw new InvalidArgumentsException(); 87 } 88 89 if(this.companyRepository.findByEmail(email).isPresent()){ 90 throw new UserExistsException(); 91 } 92 93 Address a = new Address(country, city, street); 94 this.addressRepository.save(a); 95 Company c = new Company(email, password, name, AccountType.COMPANY, a); 96 return this.companyRepository.save(c); 97 } 82 98 }
Note:
See TracChangeset
for help on using the changeset viewer.