source: phonelux-backend/src/main/java/finki/it/phoneluxbackend/services/ConfirmationTokenService.java

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

Registration logic with confirmation token implemented

  • Property mode set to 100644
File size: 881 bytes
Line 
1package finki.it.phoneluxbackend.services;
2
3import finki.it.phoneluxbackend.repositories.ConfirmationTokenRepository;
4import finki.it.phoneluxbackend.entities.ConfirmationToken;
5import lombok.AllArgsConstructor;
6import org.springframework.stereotype.Service;
7
8import java.time.LocalDateTime;
9import java.util.Optional;
10
11@Service
12@AllArgsConstructor
13public class ConfirmationTokenService {
14 private final ConfirmationTokenRepository confirmationTokenRepository;
15
16 public void saveConfirmationToken(ConfirmationToken token) {
17 confirmationTokenRepository.save(token);
18 }
19
20 public Optional<ConfirmationToken> getToken(String token) {
21 return confirmationTokenRepository.findByToken(token);
22 }
23
24 public int setConfirmedAt(String token) {
25 return confirmationTokenRepository.updateConfirmedAt(
26 token, LocalDateTime.now());
27 }
28}
Note: See TracBrowser for help on using the repository browser.