-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
29 changed files
with
598 additions
and
100 deletions.
There are no files selected for viewing
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
20 changes: 20 additions & 0 deletions
20
src/main/java/org/cardanofoundation/job/common/enumeration/EventType.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,20 @@ | ||
package org.cardanofoundation.job.common.enumeration; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.experimental.FieldDefaults; | ||
|
||
@FieldDefaults(level = AccessLevel.PRIVATE, makeFinal = true) | ||
@RequiredArgsConstructor | ||
@Getter | ||
public enum EventType { | ||
DELEGATION("Delegation"), | ||
DE_REGISTRATION("Deregistration"), | ||
REGISTRATION("Registration"), | ||
REWARDS("Rewards"), | ||
WITHDRAWAL("Withdrawal"), | ||
POOL_UPDATE("Pool Update"), | ||
POOL_SIZE("Pool Size"); | ||
String value; | ||
} |
94 changes: 94 additions & 0 deletions
94
src/main/java/org/cardanofoundation/job/dto/report/pool/InformationReport.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,94 @@ | ||
package org.cardanofoundation.job.dto.report.pool; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Date; | ||
import java.util.List; | ||
|
||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
import org.cardanofoundation.job.util.report.ColumnFieldEnum; | ||
import org.cardanofoundation.job.util.report.ColumnTitleEnum; | ||
import org.cardanofoundation.job.util.report.ExportColumn; | ||
import org.cardanofoundation.job.util.report.ExportColumn.Alignment; | ||
|
||
@Builder | ||
@Data | ||
public class InformationReport { | ||
private Date createdAt; | ||
|
||
private String reportType; | ||
|
||
private String poolId; | ||
|
||
private String stakeAddress; | ||
|
||
private String reportName; | ||
|
||
private String dateRange; | ||
|
||
private String epochRange; | ||
|
||
private String dateTimeFormat; | ||
|
||
private String events; | ||
|
||
private String isADATransfers; | ||
|
||
private String isPoolSize; | ||
|
||
public static List<ExportColumn> buildExportColumn(Boolean isPoolReport) { | ||
List<ExportColumn> columns = new ArrayList<>(); | ||
columns.add( | ||
new ExportColumn( | ||
ColumnFieldEnum.CREATED_AT_COLUMN, ColumnTitleEnum.CREATED_AT_TITLE, Alignment.LEFT)); | ||
columns.add( | ||
new ExportColumn( | ||
ColumnFieldEnum.REPORT_TYPE_COLUMN, ColumnTitleEnum.REPORT_TYPE_TITLE, Alignment.LEFT)); | ||
if (isPoolReport) { | ||
columns.add( | ||
new ExportColumn( | ||
ColumnFieldEnum.POOL_ID_COLUMN, ColumnTitleEnum.POOL_ID_TITLE, Alignment.LEFT)); | ||
} else { | ||
columns.add( | ||
new ExportColumn( | ||
ColumnFieldEnum.STAKE_ADDRESS_COLUMN, | ||
ColumnTitleEnum.STAKE_ADDRESS_TITLE, | ||
Alignment.LEFT)); | ||
} | ||
columns.add( | ||
new ExportColumn( | ||
ColumnFieldEnum.REPORT_NAME_COLUMN, ColumnTitleEnum.REPORT_NAME_TITLE, Alignment.LEFT)); | ||
if (isPoolReport) { | ||
columns.add( | ||
new ExportColumn( | ||
ColumnFieldEnum.EPOCH_RANGE_COLUMN, | ||
ColumnTitleEnum.EPOCH_RANGE_TITLE, | ||
Alignment.LEFT)); | ||
} else { | ||
columns.add( | ||
new ExportColumn( | ||
ColumnFieldEnum.DATE_RANGE_COLUMN, ColumnTitleEnum.DATE_RANGE_TITLE, Alignment.LEFT)); | ||
} | ||
columns.add( | ||
new ExportColumn( | ||
ColumnFieldEnum.DATE_TIME_FORTMAT_COLUMN, | ||
ColumnTitleEnum.DATE_TIME_FORMAT_TITLE, | ||
Alignment.LEFT)); | ||
columns.add( | ||
new ExportColumn( | ||
ColumnFieldEnum.EVENTS_COLUMN, ColumnTitleEnum.EVENTS_TITLE, Alignment.LEFT)); | ||
if (isPoolReport) { | ||
columns.add( | ||
new ExportColumn( | ||
ColumnFieldEnum.POOL_SIZE_COLUMN, ColumnTitleEnum.POOL_SIZE_TITLE, Alignment.LEFT)); | ||
} else { | ||
columns.add( | ||
new ExportColumn( | ||
ColumnFieldEnum.ADA_TRANSFERS_COLUMN, | ||
ColumnTitleEnum.ADA_TRANSFERS_TITLE, | ||
Alignment.LEFT)); | ||
} | ||
return columns; | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,6 @@ public interface LatestVotingProcedureProjection { | |
Vote getVote(); | ||
|
||
Long getPoolId(); | ||
|
||
Long getSlotGov(); | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/java/org/cardanofoundation/job/projection/PoolHashProjection.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 org.cardanofoundation.job.projection; | ||
|
||
public interface PoolHashProjection { | ||
|
||
Long getPoolId(); | ||
|
||
Long getSlot(); | ||
} |
8 changes: 7 additions & 1 deletion
8
src/main/java/org/cardanofoundation/job/projection/PoolInfoProjection.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,12 +1,18 @@ | ||
package org.cardanofoundation.job.projection; | ||
|
||
import java.math.BigInteger; | ||
|
||
public interface PoolInfoProjection { | ||
|
||
Long getId(); | ||
|
||
String getPoolId(); | ||
String getHashRaw(); | ||
|
||
String getPoolView(); | ||
|
||
String getPoolName(); | ||
|
||
BigInteger getActiveStake(); | ||
|
||
Long getPoolId(); | ||
} |
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
19 changes: 19 additions & 0 deletions
19
src/main/java/org/cardanofoundation/job/repository/ledgersync/PoolInfoRepository.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,19 @@ | ||
package org.cardanofoundation.job.repository.ledgersync; | ||
|
||
import java.util.List; | ||
|
||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.Query; | ||
import org.springframework.data.repository.query.Param; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import org.cardanofoundation.explorer.common.entity.ledgersync.PoolInfo; | ||
import org.cardanofoundation.job.projection.PoolInfoProjection; | ||
|
||
@Repository | ||
public interface PoolInfoRepository extends JpaRepository<PoolInfo, Long> { | ||
@Query( | ||
value = | ||
"select pi.poolId as poolId, pi.activeStake as activeStake from PoolInfo pi where pi.fetchedAtEpoch = :epochNo") | ||
List<PoolInfoProjection> findAllByEpochNo(@Param("epochNo") Integer epochNo); | ||
} |
Oops, something went wrong.