-
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.
Merge pull request #52 from Staketab/dev
add logic for update domain metadata
- Loading branch information
Showing
21 changed files
with
267 additions
and
129 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
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
import lombok.NoArgsConstructor; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
@Data | ||
@Builder | ||
|
20 changes: 20 additions & 0 deletions
20
src/main/java/com/staketab/minanames/dto/IpfsZkCloudWorkerTransactionDataResponse.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 com.staketab.minanames.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class IpfsZkCloudWorkerTransactionDataResponse { | ||
private String operation; | ||
private String name; | ||
private String address; | ||
private long expiry; | ||
private String newDomain; | ||
private String oldDomain; | ||
private String metadata; | ||
} |
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
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/com/staketab/minanames/dto/OldMetadataDTO.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 com.staketab.minanames.dto; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
public class OldMetadataDTO { | ||
private String domainMetadata; | ||
private String ipfsImg; | ||
private String website; | ||
private String email; | ||
private String discord; | ||
private String github; | ||
private String xTwitter; | ||
private String telegram; | ||
private String description; | ||
} |
3 changes: 0 additions & 3 deletions
3
src/main/java/com/staketab/minanames/dto/ZkCloudWorkerTransactionMetadata.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
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
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
4 changes: 2 additions & 2 deletions
4
...nanames/repository/LogInfoRepository.java → ...anames/repository/ActivityRepository.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,10 +1,10 @@ | ||
package com.staketab.minanames.repository; | ||
|
||
import com.staketab.minanames.entity.LogInfoEntity; | ||
import com.staketab.minanames.entity.ActivityEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface LogInfoRepository extends JpaRepository<LogInfoEntity, String> { | ||
public interface ActivityRepository extends JpaRepository<ActivityEntity, String> { | ||
|
||
} |
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
13 changes: 13 additions & 0 deletions
13
src/main/java/com/staketab/minanames/service/ActivityService.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,13 @@ | ||
package com.staketab.minanames.service; | ||
|
||
import com.staketab.minanames.entity.DomainEntity; | ||
import com.staketab.minanames.entity.ActivityStatus; | ||
|
||
import java.util.List; | ||
|
||
public interface ActivityService { | ||
|
||
void saveActivity(DomainEntity domainEntity, ActivityStatus status); | ||
|
||
void saveAllActivities(List<DomainEntity> domainEntities, ActivityStatus status); | ||
} |
13 changes: 0 additions & 13 deletions
13
src/main/java/com/staketab/minanames/service/LogInfoService.java
This file was deleted.
Oops, something went wrong.
44 changes: 44 additions & 0 deletions
44
src/main/java/com/staketab/minanames/service/impl/ActivityServiceImpl.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,44 @@ | ||
package com.staketab.minanames.service.impl; | ||
|
||
import com.staketab.minanames.entity.DomainEntity; | ||
import com.staketab.minanames.entity.ActivityEntity; | ||
import com.staketab.minanames.entity.ActivityStatus; | ||
import com.staketab.minanames.repository.ActivityRepository; | ||
import com.staketab.minanames.service.ActivityService; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
|
||
import java.util.List; | ||
|
||
@Slf4j | ||
@Service | ||
@RequiredArgsConstructor | ||
public class ActivityServiceImpl implements ActivityService { | ||
|
||
private final ActivityRepository activityRepository; | ||
|
||
@Override | ||
public void saveActivity(DomainEntity domainEntity, ActivityStatus status) { | ||
activityRepository.save(buildActivityEntity(domainEntity, status)); | ||
} | ||
|
||
@Override | ||
public void saveAllActivities(List<DomainEntity> domainEntities, ActivityStatus status) { | ||
List<ActivityEntity> activityEntities = domainEntities | ||
.stream() | ||
.map(domainEntity -> buildActivityEntity(domainEntity, status)) | ||
.toList(); | ||
activityRepository.saveAll(activityEntities); | ||
} | ||
|
||
private ActivityEntity buildActivityEntity(DomainEntity domainEntity, ActivityStatus status) { | ||
return ActivityEntity.builder() | ||
.status(status.name()) | ||
.txHash(domainEntity.getTransaction().getTxHash()) | ||
.domainName(domainEntity.getDomainName()) | ||
.amount(domainEntity.getAmount()) | ||
.ownerAddress(domainEntity.getOwnerAddress()) | ||
.build(); | ||
} | ||
} |
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.