Skip to content

Commit

Permalink
TMI2-606/support team sns email logs (#201)
Browse files Browse the repository at this point in the history
* added endpoint to get failed export count

* added new endpoint to get remaining grant exports for batch

* Logs for new endpoints

* removed duplicate endpoints
  • Loading branch information
rachelswart authored Feb 20, 2024
1 parent 510243c commit dbe1447
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,8 @@ public ResponseEntity getFailedExportsCount(@PathVariable UUID exportId) {
content = @Content(mediaType = "application/json")) })
@LambdasHeaderValidator
public ResponseEntity getRemainingExportsCount(@PathVariable UUID exportId) {

Long count = exportService.getRemainingExportsCount(exportId);

final Long count = exportService.getRemainingExportsCount(exportId);
return ResponseEntity.ok(new OutstandingExportCountDTO(count));

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
import gov.cabinetoffice.gap.adminbackend.mappers.GrantExportMapper;
import gov.cabinetoffice.gap.adminbackend.repositories.GrantExportRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
@RequiredArgsConstructor
@Slf4j
public class GrantExportService {

private final GrantExportRepository exportRepository;
Expand All @@ -29,10 +31,12 @@ public GrantExportListDTO getGrantExportsByIdAndStatus(UUID exportId, GrantExpor
}

public Long getFailedExportsCount(UUID exportId) {
log.info(String.format("Getting failed export count from grant_export table for exportId: %s", exportId));
return exportRepository.countByIdExportBatchIdAndStatus(exportId, GrantExportStatus.FAILED);
}

public Long getRemainingExportsCount(UUID exportId) {
log.info(String.format("Getting remaining export count from grant_export table for exportId: %s", exportId));
return exportRepository.countByIdExportBatchIdAndStatusIsNotIn(exportId,
List.of(GrantExportStatus.COMPLETE, GrantExportStatus.FAILED));
}
Expand Down

0 comments on commit dbe1447

Please sign in to comment.