access modifiers and constructors fix
This commit is contained in:
@ -9,12 +9,11 @@ import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
//if result could be null, should we wrapped in optional
|
||||
@Repository
|
||||
public interface UserRepository extends JpaRepository<User, Long> {
|
||||
@Query("FROM User WHERE email = ?1")
|
||||
Optional<User> getByAuthority(@Param("authority") String authority);
|
||||
|
||||
@Query("FROM User WHERE token = ?1")
|
||||
User getByToken(@Param("token") String token);
|
||||
Optional<User> getByToken(@Param("token") String token);
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.plannaplan.services;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.plannaplan.entities.User;
|
||||
@ -38,7 +39,7 @@ public class UserService {
|
||||
|
||||
}
|
||||
|
||||
public User getByToken(String token) {
|
||||
public Optional<User> getByToken(String token) {
|
||||
return this.repo.getByToken(token);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user