source: phonelux-backend/src/main/java/finki/it/phoneluxbackend/repositories/ConfirmationTokenRepository.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: 844 bytes
Line 
1package finki.it.phoneluxbackend.repositories;
2
3import finki.it.phoneluxbackend.entities.ConfirmationToken;
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
10import java.time.LocalDateTime;
11import java.util.Optional;
12
13@Repository
14public interface ConfirmationTokenRepository extends JpaRepository<ConfirmationToken,Long> {
15 Optional<ConfirmationToken> findByToken(String token);
16
17 @Transactional
18 @Modifying
19 @Query("UPDATE ConfirmationToken c " +
20 "SET c.confirmedAt = ?2 " +
21 "WHERE c.token = ?1")
22 int updateConfirmedAt(String token, LocalDateTime confirmedAt);
23}
Note: See TracBrowser for help on using the repository browser.