source: phonelux-backend/src/main/java/finki/it/phoneluxbackend/repositories/UserRepository.java

Last change on this file was f25d07e, checked in by Marko <Marko@…>, 2 years ago

Edited registration and login services

  • Property mode set to 100644
File size: 727 bytes
Line 
1package finki.it.phoneluxbackend.repositories;
2
3import finki.it.phoneluxbackend.entities.User;
4import org.springframework.data.jpa.repository.JpaRepository;
5import org.springframework.data.jpa.repository.Modifying;
6import org.springframework.data.jpa.repository.Query;
7import org.springframework.stereotype.Repository;
8import org.springframework.transaction.annotation.Transactional;
9
10
11import java.util.Optional;
12
13@Repository
14@Transactional(readOnly = true)
15public interface UserRepository extends JpaRepository<User,Long> {
16 Optional<User> findByEmail(String email);
17
18 @Transactional
19 @Modifying
20 @Query("UPDATE User a " +
21 "SET a.enabled = TRUE WHERE a.email = ?1")
22 int enableUser(String email);
23}
Note: See TracBrowser for help on using the repository browser.