-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mateusz Czeladka
committed
Sep 14, 2023
1 parent
3f8fa56
commit a6646da
Showing
13 changed files
with
309 additions
and
124 deletions.
There are no files selected for viewing
10 changes: 7 additions & 3 deletions
10
...n/java/org/cardano/foundation/voting/domain/discord/DiscordStartVerificationResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
package org.cardano.foundation.voting.domain.discord; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import org.cardano.foundation.voting.domain.VerificationStatus; | ||
|
||
@Builder | ||
@Getter | ||
@AllArgsConstructor | ||
public class DiscordStartVerificationResponse { | ||
|
||
String eventId; | ||
String discordIdHash; | ||
VerificationStatus status; | ||
private String eventId; | ||
|
||
private String discordIdHash; | ||
|
||
private VerificationStatus status; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...vice/src/main/java/org/cardano/foundation/voting/jobs/CleanupAllForFinishedEventsJob.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package org.cardano.foundation.voting.jobs; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.cardano.foundation.voting.client.ChainFollowerClient; | ||
import org.cardano.foundation.voting.service.discord.DiscordUserVerificationService; | ||
import org.cardano.foundation.voting.service.sms.SMSUserVerificationService; | ||
import org.springframework.scheduling.annotation.Scheduled; | ||
import org.springframework.stereotype.Service; | ||
|
||
@Service | ||
@Slf4j | ||
@RequiredArgsConstructor | ||
public class CleanupAllForFinishedEventsJob implements Runnable { | ||
|
||
private final ChainFollowerClient chainFollowerClient; | ||
|
||
private final SMSUserVerificationService smsUserVerificationService; | ||
|
||
private final DiscordUserVerificationService discordUserVerificationService; | ||
|
||
@Scheduled(cron = "${finished.verifications.cleanup.job.cron}") | ||
public void run() { | ||
log.info("Cleaning up verified phones for event..."); | ||
|
||
var allEventsE = chainFollowerClient.findAllEvents(); | ||
|
||
if (allEventsE.isEmpty()) { | ||
log.warn("No events found in ledger follower, skipping cleanup job."); | ||
return; | ||
} | ||
|
||
var allEvents = allEventsE.get(); | ||
|
||
allEvents.forEach(eventSummary -> { | ||
if (eventSummary.finished()) { | ||
log.info("Event:{} is finished, removing all sms verifications...", eventSummary.id()); | ||
|
||
smsUserVerificationService.findAllForEvent(eventSummary.id()).forEach(userVerification -> { | ||
log.info("Removing historical user sms verification... since eventId:{} is finished.", eventSummary.id()); | ||
smsUserVerificationService.removeUserVerification(userVerification); | ||
}); | ||
|
||
log.info("Event:{} is finished, removing all discord verifications...", eventSummary.id()); | ||
discordUserVerificationService.findAllForEvent(eventSummary.id()).forEach(userVerification -> { | ||
log.info("Removing historical user discord verification... since eventId:{} is finished.", eventSummary.id()); | ||
discordUserVerificationService.removeUserVerification(userVerification); | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 0 additions & 45 deletions
45
...src/main/java/org/cardano/foundation/voting/jobs/SMSCleanupVerifiedPhonesForEventJob.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.