enhance crud jenis pengadaan

This commit is contained in:
dirgantarasiahaan
2023-05-25 00:46:50 +07:00
parent 28f17d5b54
commit f96c8d2f17
12 changed files with 340 additions and 53 deletions

View File

@@ -0,0 +1,26 @@
package com.iconplus.smartproc.service.jenispengadaan;
import com.iconplus.smartproc.exception.BusinessException;
import com.iconplus.smartproc.helper.model.EmptyResponse;
import com.iconplus.smartproc.helper.service.BaseService;
import com.iconplus.smartproc.model.request.JenisPengadaanRequest;
import com.iconplus.smartproc.repository.JenisPengadaanRepository;
import org.springframework.stereotype.Service;
@Service
public class DeleteJenisPengadaanService implements BaseService<JenisPengadaanRequest, EmptyResponse> {
private JenisPengadaanRepository jenisPengadaanRepository;
public DeleteJenisPengadaanService(JenisPengadaanRepository jenisPengadaanRepository) {
this.jenisPengadaanRepository = jenisPengadaanRepository;
}
@Override
public EmptyResponse execute(JenisPengadaanRequest input) {
var jenisPengadaan = jenisPengadaanRepository.findByIdAndIsDeleteFalse(input.getId())
.orElseThrow(() -> new BusinessException("err", "err", "err"));
jenisPengadaan.setIsDelete(true);
jenisPengadaanRepository.save(jenisPengadaan);
return new EmptyResponse();
}
}