package org.lym.pom.service.impl;

import org.lym.pom.notify.publisher.EventPublisher;
import org.lym.pom.repository.FeedRepository;
import org.lym.pom.repository.mongo.Feed;
import org.lym.pom.service.FeedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 订阅推送服务
 *
 * @author lym
 */
@Service
public class FeedServiceImpl implements FeedService {

    @Autowired
    private EventPublisher eventPublisher;

    @Autowired
    private MongoTemplate mongoTemplate;

    @Autowired
    private FeedRepository repository;

    @Override public List<Feed> queryByUserId(String userId, String relatedCreator) {
        return repository.findByUserIdAndRelatedCreator(userId, relatedCreator);
    }

    @Override public void addFeedList(List<Feed> postFeedList) {
        repository.saveAll(postFeedList);
    }
}
