-
Notifications
You must be signed in to change notification settings - Fork 0
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
Marc Gorzala
committed
Mar 29, 2024
1 parent
375ca11
commit 97515d3
Showing
5 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
15 changes: 14 additions & 1 deletion
15
src/main/java/net/dancier/kikeriki/adapter/out/infomail/InfomailAdapter.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,19 +1,32 @@ | ||
package net.dancier.kikeriki.adapter.out.infomail; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import net.dancier.kikeriki.application.port.ScheduleInfomailCheckPort; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.Objects; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class InfomailAdapter implements ScheduleInfomailCheckPort { | ||
|
||
Logger log = LoggerFactory.getLogger(InfomailAdapter.class); | ||
private final static Logger log = LoggerFactory.getLogger(InfomailAdapter.class); | ||
|
||
private final ScheduledInfoMailCheckJpaRepository scheduledInfoMailCheckJpaRepository; | ||
|
||
@Override | ||
public void schedule(LocalDateTime when, String dancerId) { | ||
Objects.requireNonNull(when); | ||
Objects.requireNonNull(dancerId); | ||
log.info("Scheduling check!!!"); | ||
|
||
ScheduledInfoMailCheckJpaEntity scheduledInfoMailCheckJpaEntity = new ScheduledInfoMailCheckJpaEntity(); | ||
scheduledInfoMailCheckJpaEntity.setStatus(ScheduledInfoMailCheckJpaEntity.STATUS.NEW); | ||
scheduledInfoMailCheckJpaEntity.setDancerId(dancerId); | ||
scheduledInfoMailCheckJpaEntity.setCheckAt(when); | ||
scheduledInfoMailCheckJpaRepository.save(scheduledInfoMailCheckJpaEntity); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
src/main/java/net/dancier/kikeriki/adapter/out/infomail/ScheduledInfoMailCheckJpaEntity.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,37 @@ | ||
package net.dancier.kikeriki.adapter.out.infomail; | ||
|
||
import jakarta.persistence.*; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.UUID; | ||
|
||
@Data | ||
@Entity | ||
@Table(name = "scheduled_at") | ||
@NoArgsConstructor | ||
public class ScheduledInfoMailCheckJpaEntity { | ||
|
||
@Id | ||
@GeneratedValue | ||
private UUID id; | ||
|
||
@NotNull | ||
@Enumerated(EnumType.STRING) | ||
private STATUS status; | ||
|
||
@NotNull | ||
private String dancerId; | ||
|
||
@NotNull | ||
private LocalDateTime checkAt; | ||
|
||
public static enum STATUS { | ||
NEW, | ||
TEMPORARY_FAILED, | ||
FINALLY_FAILED, | ||
DONE | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...n/java/net/dancier/kikeriki/adapter/out/infomail/ScheduledInfoMailCheckJpaRepository.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,8 @@ | ||
package net.dancier.kikeriki.adapter.out.infomail; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
|
||
import java.util.UUID; | ||
|
||
public interface ScheduledInfoMailCheckJpaRepository extends JpaRepository<ScheduledInfoMailCheckJpaEntity, UUID> { | ||
} |
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