From b2c1e2e7449537c5ba5ffdbadf50fe38cd2c5beb Mon Sep 17 00:00:00 2001 From: Mika Date: Sun, 22 Sep 2024 12:34:55 +0200 Subject: [PATCH] add Todo and add findByEmail for later use in UserRepository.java --- server/src/main/java/com/mixel/docusphere/entity/User.java | 1 + .../java/com/mixel/docusphere/repository/UserRepository.java | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/server/src/main/java/com/mixel/docusphere/entity/User.java b/server/src/main/java/com/mixel/docusphere/entity/User.java index 3221027..f34cffa 100644 --- a/server/src/main/java/com/mixel/docusphere/entity/User.java +++ b/server/src/main/java/com/mixel/docusphere/entity/User.java @@ -42,6 +42,7 @@ public class User implements UserDetails { @Column(name = "updated_at", nullable = false) private LocalDateTime updatedAt; + // TODO: I think this can be removed since the same logic is already done by @CreationTimestamp annotation @PrePersist protected void onCreate() { createdAt = LocalDateTime.now(); diff --git a/server/src/main/java/com/mixel/docusphere/repository/UserRepository.java b/server/src/main/java/com/mixel/docusphere/repository/UserRepository.java index 456987e..e76317a 100644 --- a/server/src/main/java/com/mixel/docusphere/repository/UserRepository.java +++ b/server/src/main/java/com/mixel/docusphere/repository/UserRepository.java @@ -2,7 +2,11 @@ package com.mixel.docusphere.repository; import com.mixel.docusphere.entity.User; import org.springframework.data.jpa.repository.JpaRepository; + +import java.util.Optional; import java.util.UUID; public interface UserRepository extends JpaRepository { + + Optional findByEmail(String email); } \ No newline at end of file