Skip to content

Commit

Permalink
Update campaignValidators.ts (#647)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashish-egov authored May 21, 2024
1 parent 87340d3 commit 2188066
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -606,12 +606,12 @@ async function validateResources(resources: any, request: any) {
const req: any = replicateRequest(request, searchBody);
const res: any = await searchDataService(req);
if (res?.[0]) {
if (!(res?.ResourceDetails?.[0]?.status == resourceDataStatuses.completed && res?.ResourceDetails?.[0]?.action == "validate")) {
if (!(res?.[0]?.status == resourceDataStatuses.completed && res?.[0]?.action == "validate")) {
logger.error(`Error during validation of type ${resource.type}, validation is not successful or not completed. Resource id : ${resource?.resourceId}`);
throwError("COMMON", 400, "VALIDATION_ERROR", `Error during validation of type ${resource.type}, validation is not successful or not completed.`);
}
if (res?.ResourceDetails?.[0]?.fileStoreId != resource?.filestoreId) {
logger.error(`fileStoreId doesn't match for resource with Id ${resource?.resourceId}. Expected fileStoreId ${resource?.filestoreId} but received ${res?.ResourceDetails?.[0]?.fileStoreId}`);
if (res?.[0]?.fileStoreId != resource?.filestoreId) {
logger.error(`fileStoreId doesn't match for resource with Id ${resource?.resourceId}. Expected fileStoreId ${resource?.filestoreId} but received ${res?.[0]?.fileStoreId}`);
throwError("COMMON", 400, "VALIDATION_ERROR", `Uploaded file doesn't match for resource of type ${resource.type}.`)
}
}
Expand Down

0 comments on commit 2188066

Please sign in to comment.