package com.remy.user.service.impl;

import com.remy.user.dao.UserDAO;
import com.remy.user.entity.User;
import com.remy.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserDAO userDAO;

    @Override
    public User save(User user) {
        return userDAO.save(user);
    }

    @Override
    public List<User> findAll() {
        return userDAO.findAll();
    }

    @Override
    public User findByID(Long userId) {
        return userDAO.findById(userId).get();
    }

    @Override
    public User findByUsername(String username) {
        return userDAO.findUserByUsername(username);
    }
}
