LandingPageStepConfigService.java 1.1 KB
// landingpage/service/LandingPageStepConfigService.java
package com.aigeo.landingpage.service;

import com.aigeo.landingpage.entity.LandingPageStepConfig;
import com.aigeo.landingpage.repository.LandingPageStepConfigRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class LandingPageStepConfigService {
    
    @Autowired
    private LandingPageStepConfigRepository landingPageStepConfigRepository;
    
    public Optional<LandingPageStepConfig> getConfigByProjectId(Integer projectId) {
        return landingPageStepConfigRepository.findByProjectId(projectId);
    }
    
    public Optional<LandingPageStepConfig> getConfigById(Integer id) {
        return landingPageStepConfigRepository.findById(id);
    }
    
    public LandingPageStepConfig saveConfig(LandingPageStepConfig config) {
        return landingPageStepConfigRepository.save(config);
    }
    
    public void deleteConfig(Integer id) {
        landingPageStepConfigRepository.deleteById(id);
    }
}