package com.saha.service;

import com.saha.annotations.TestProfile;
import com.saha.model.User;
import com.saha.persistence.entity.TweetEntity;
import com.saha.persistence.entity.UserEntity;
import com.saha.persistence.repository.UserRepository;
import org.dozer.DozerBeanMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

@Service
@TestProfile
public class TweetService {

    @Autowired
    private UserRepository userRepository;

    @Autowired
    private DozerBeanMapper mapper;

    public Collection<TweetEntity> tweets() {

        return null;
    }

    public User users(Long id) {
        return null;
    }

    public Iterable<TweetEntity> save(TweetEntity tweet, Long userId) {
        UserEntity userEntity = userRepository.findOne(userId);

        userEntity.getTweets().add(tweet);
        tweet.setUserEntity(userEntity);

        userEntity = userRepository.save(userEntity);

        return userEntity.getTweets();
    }

    public Boolean delete(Long id) {
        return null;
    }

    public User update(Long id, User user) {
        return null;
    }
}

@@ -24,49 +24,8 @@
 e;%0A%0A
-import com.saha.annotations.TestProfile;%0A
 impo
@@ -364,92 +364,28 @@
 til.
-ArrayList;%0Aimport java.util.Collection;%0Aimport java.util.List;%0A%0A@Service%0A@TestProfil
+Collection;%0A%0A@Servic
 e%0Apu

test profile removed from tweet service