remove follow
This commit is contained in:
@@ -43,11 +43,18 @@ public class MyBatisUserRepository implements UserRepository {
|
||||
|
||||
@Override
|
||||
public void saveRelation(FollowRelation followRelation) {
|
||||
userMapper.saveRelation(followRelation);
|
||||
if (!findRelation(followRelation.getUserId(), followRelation.getTargetId()).isPresent()) {
|
||||
userMapper.saveRelation(followRelation);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<FollowRelation> findRelation(String userId, String targetId) {
|
||||
return Optional.ofNullable(userMapper.findRelation(userId, targetId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeRelation(FollowRelation followRelation) {
|
||||
userMapper.deleteRelation(followRelation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,4 +21,6 @@ public interface UserMapper {
|
||||
FollowRelation findRelation(@Param("userId") String userId, @Param("targetId") String targetId);
|
||||
|
||||
void saveRelation(@Param("followRelation") FollowRelation followRelation);
|
||||
|
||||
void deleteRelation(@Param("followRelation") FollowRelation followRelation);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user