save follow
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package io.spring.infrastructure.user;
|
||||
|
||||
import io.spring.core.user.FollowRelation;
|
||||
import io.spring.core.user.User;
|
||||
import io.spring.core.user.UserRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -39,4 +40,14 @@ public class MyBatisUserRepository implements UserRepository {
|
||||
public Optional<User> findByEmail(String email) {
|
||||
return Optional.ofNullable(userMapper.findByEmail(email));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveRelation(FollowRelation followRelation) {
|
||||
userMapper.saveRelation(followRelation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<FollowRelation> findRelation(String userId, String targetId) {
|
||||
return Optional.ofNullable(userMapper.findRelation(userId, targetId));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.spring.infrastructure.user;
|
||||
|
||||
import io.spring.core.user.FollowRelation;
|
||||
import io.spring.core.user.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -16,4 +17,8 @@ public interface UserMapper {
|
||||
User findById(@Param("id") String id);
|
||||
|
||||
void update(@Param("user") User user);
|
||||
|
||||
FollowRelation findRelation(@Param("userId") String userId, @Param("targetId") String targetId);
|
||||
|
||||
void saveRelation(@Param("followRelation") FollowRelation followRelation);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user