add crud jabatan
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.iconplus.smartproc.service.jabatan;
|
||||
|
||||
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.JabatanRequest;
|
||||
import com.iconplus.smartproc.repository.JabatanRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class DeleteJabatanService implements BaseService<JabatanRequest, EmptyResponse> {
|
||||
|
||||
private JabatanRepository jabatanRepository;
|
||||
public DeleteJabatanService(JabatanRepository jabatanRepository) {
|
||||
this.jabatanRepository = jabatanRepository;
|
||||
}
|
||||
@Override
|
||||
public EmptyResponse execute(JabatanRequest input) {
|
||||
var jabatan = jabatanRepository.findByIdAndIsDeleteFalse(input.getId())
|
||||
.orElseThrow(() -> new BusinessException("err", "err", "err"));
|
||||
jabatan.setIsDelete(true);
|
||||
jabatanRepository.save(jabatan);
|
||||
return new EmptyResponse();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user