package com.viettel.campaign.service;

import com.viettel.campaign.model.ProcessConfig;
import com.viettel.campaign.repository.ProcessConfigRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author hanv_itsol
 * @project campaign
 */

@Service
@Transactional
public class ProcessConfigService {

    @Autowired
    private ProcessConfigRepository processConfigRepository;

    @Transactional(readOnly = true)
    public List<ProcessConfig> findAll(){
        return processConfigRepository.findAll();
    }


    @Transactional(readOnly = true)
    public List<ProcessConfig> findAllByCode(String configCode){
        return processConfigRepository.findAllByConfigCode(configCode);
    }

    public void update(ProcessConfig pc){
        processConfigRepository.save(pc);
    }

}
