- Timestamp:
- 01/06/21 18:21:03 (4 years ago)
- Branches:
- master
- Children:
- 721cb87
- Parents:
- 7edede9
- Location:
- src/main/java/it/finki/tinki
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/it/finki/tinki/repository/TeamRepository.java
r7edede9 r504c3ef 5 5 import org.springframework.stereotype.Repository; 6 6 7 import java.util.Optional; 8 7 9 @Repository 8 10 public interface TeamRepository extends JpaRepository<Team, Long> { 9 11 Team findByEmailAndPassword(String email, String password); 12 Optional<Team> findByEmail(String email); 10 13 } -
src/main/java/it/finki/tinki/service/impl/AccountServiceImpl.java
r7edede9 r504c3ef 67 67 return this.userRepository.save(u); 68 68 } 69 70 public Account registerTeam(String email, String password, String name, int members){ 71 if(email==null || email.isEmpty() || password==null || password.isEmpty() || name==null || name.isEmpty()){ 72 throw new InvalidArgumentsException(); 73 } 74 75 if(this.teamRepository.findByEmail(email).isPresent()){ 76 throw new UserExistsException(); 77 } 78 79 Team t = new Team(email, password, name, AccountType.TEAM, members); 80 return this.teamRepository.save(t); 81 } 69 82 }
Note:
See TracChangeset
for help on using the changeset viewer.