You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
autoflow-server-mgmt/src/main/java/kr/re/etri/autoflow/service/KubeflowRunService.java

39 lines
1.4 KiB

package kr.re.etri.autoflow.service;
import kr.re.etri.autoflow.entity.KubeflowRunEntity;
import kr.re.etri.autoflow.payload.request.KubeflowRunSearchRequest;
import kr.re.etri.autoflow.repository.KubeflowRunRepository;
import kr.re.etri.autoflow.specification.KubeflowRunSpecification;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.*;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@RequiredArgsConstructor
public class KubeflowRunService {
private final KubeflowRunRepository runRepository;
private final KubeflowRunSpecification runSpecification;
@Transactional(readOnly = true)
public Page<KubeflowRunEntity> search(KubeflowRunSearchRequest request) {
int pageIndex = request.getPage() > 0 ? request.getPage() - 1 : 0;
Pageable pageable = PageRequest.of(
pageIndex,
request.getSize(),
Sort.by(Sort.Direction.fromString(request.getSortDirection()), request.getSortField())
);
Specification<KubeflowRunEntity> spec = runSpecification.searchByConditions(
request.getExperimentId(), // experimentId는 필수
request.getSearchType(),
request.getKeyword()
);
return runRepository.findAll(spec, pageable);
}
}