Skip to content

Commit

Permalink
Update campaignValidators.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ashish-egov authored Jun 13, 2024
1 parent 3d5c0dd commit db09fbe
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -954,15 +954,12 @@ async function validateChangeDatesRequest(request: any) {
}
}
const today: any = Date.now();
if (exsistingStartDate >= today) {
logger.info("Existing start date is greater than or equal to current date");
logger.info("Now only endDate can be updated")
if (exsistingStartDate <= today) {
if (exsistingStartDate != newStartDate) {
throwError("COMMON", 400, "VALIDATION_ERROR", "StartDate cannot be updated as campaign is started or completed.");
throwError("COMMON", 400, "VALIDATION_ERROR", "StartDate cannot be updated for ongoing or completed campaign.");
}
}
if (exsistingEndDate > today) {
logger.info("Existing end date is greater than or equal to current date");
if (exsistingEndDate < today) {
if (exsistingEndDate != newEndDate) {
throwError("COMMON", 400, "VALIDATION_ERROR", "EndDate cannot be updated as campaign is completed.");
}
Expand Down

0 comments on commit db09fbe

Please sign in to comment.