diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/domain/proof/Proof.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/domain/proof/Proof.java index 065fcefd7..d5765f84d 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/domain/proof/Proof.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/domain/proof/Proof.java @@ -60,6 +60,6 @@ public class Proof extends BaseDomain { /** Proof type. */ @Enumerated(STRING) @Column(name = "PROOF_TYPE", updatable = false) - private ProofType proofType; + private ProofType type; } diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/domain/request/AddProofRequest.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/domain/request/AddProofRequest.java index 38f948c9c..feeb0ae16 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/domain/request/AddProofRequest.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/domain/request/AddProofRequest.java @@ -19,7 +19,7 @@ import static jakarta.persistence.FetchType.EAGER; /** - * Request to add proof to royllo database. + * Request to add a proof to royllo database. */ @Getter @Setter @@ -38,7 +38,7 @@ public class AddProofRequest extends Request { /** Proof type. */ @Enumerated(STRING) @Column(name = "PROOF_TYPE", updatable = false) - private ProofType proofType; + private ProofType type; /** The asset created/updated by this request. */ @ManyToOne(fetch = EAGER) diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/domain/request/Request.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/domain/request/Request.java index 513b37673..7b6d78d13 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/domain/request/Request.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/domain/request/Request.java @@ -35,7 +35,7 @@ @Entity @Table(name = "REQUEST") @Inheritance(strategy = JOINED) -@DiscriminatorColumn(name = "TYPE") +@DiscriminatorColumn(name = "REQUEST_TYPE") public abstract class Request extends BaseDomain { /** Unique identifier. */ diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/domain/user/User.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/domain/user/User.java index f215e8e45..2745d1023 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/domain/user/User.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/domain/user/User.java @@ -42,15 +42,15 @@ public class User extends BaseDomain { @Column(name = "USER_ID", nullable = false, updatable = false) private String userId; - /** Username. */ - @Column(name = "USERNAME", nullable = false) - private String username; - /** User role. */ @Enumerated(STRING) @Column(name = "ROLE", nullable = false) private UserRole role; + /** Username. */ + @Column(name = "USERNAME", nullable = false) + private String username; + /** Profile picture file name. */ @Column(name = "PROFILE_PICTURE_FILE_NAME") private String profilePictureFileName; diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/asset/AssetDTO.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/asset/AssetDTO.java index e818e5d73..05ae49c29 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/asset/AssetDTO.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/asset/AssetDTO.java @@ -36,7 +36,7 @@ public class AssetDTO { public static final int ASSET_ID_ALIAS_MAX_SIZE = 30; /** Maximum size of the readme. */ - public static final int README_MAX_SIZE = 3000; + public static final int README_MAX_SIZE = 3_000; /** Unique identifier. */ Long id; diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/proof/ProofDTO.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/proof/ProofDTO.java index bc6720609..d4a39fc67 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/proof/ProofDTO.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/proof/ProofDTO.java @@ -39,9 +39,8 @@ public class ProofDTO { String proofId; /** Proof type. */ - // TODO Rename to TYPE @NotNull(message = "{validation.proof.proofType.required}") - ProofType proofType; + ProofType type; /** * Returns the proof file name. diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/request/AddProofRequestDTO.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/request/AddProofRequestDTO.java index ea4694e41..dcc1adb7b 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/request/AddProofRequestDTO.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/request/AddProofRequestDTO.java @@ -9,7 +9,7 @@ import org.royllo.explorer.core.util.enums.ProofType; /** - * Request to add proof to royllo database. + * Request to add a proof to royllo database. */ @Getter @SuperBuilder @@ -22,9 +22,8 @@ public class AddProofRequestDTO extends RequestDTO { String proof; /** Proof type. */ - // TODO Change to TYPE @NotNull(message = "{validation.request.type.required}") - ProofType proofType; + ProofType type; /** The asset created/updated by this request. */ AssetDTO asset; @@ -35,7 +34,9 @@ public class AddProofRequestDTO extends RequestDTO { * @param newAsset new asset */ public void setAsset(final AssetDTO newAsset) { - assert asset == null : "You can't update the target asset, it's already set"; + if (asset != null) { + throw new IllegalStateException("You can't update the target asset, it's already set"); + } asset = newAsset; } diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/request/AddUniverseServerRequestDTO.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/request/AddUniverseServerRequestDTO.java index 6fc9cfc36..bc3a402e6 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/request/AddUniverseServerRequestDTO.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/request/AddUniverseServerRequestDTO.java @@ -28,7 +28,9 @@ public class AddUniverseServerRequestDTO extends RequestDTO { * @param newUniverseServer new universe server */ public void setUniverseServer(final UniverseServerDTO newUniverseServer) { - assert universeServer == null : "You can't update the target universe server, it's already set"; + if (universeServer != null) { + throw new IllegalStateException("You can't update the target universe server, it's already set"); + } universeServer = newUniverseServer; } diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/request/ClaimAssetOwnershipRequestDTO.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/request/ClaimAssetOwnershipRequestDTO.java index 55a2e4f77..5a692da0c 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/request/ClaimAssetOwnershipRequestDTO.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/request/ClaimAssetOwnershipRequestDTO.java @@ -19,7 +19,7 @@ public class ClaimAssetOwnershipRequestDTO extends RequestDTO { @Override public final void success() { super.success(); - // For security reasons, we remove the proof with witness from the request once treated. + // For security reasons, we remove the proof from the request once it has been treated. proofWithWitness = null; } diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/request/RequestDTO.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/request/RequestDTO.java index 9bb6f508b..fa13941e4 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/request/RequestDTO.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/request/RequestDTO.java @@ -11,7 +11,7 @@ import static org.royllo.explorer.core.util.enums.RequestStatus.SUCCESS; /** - * User request to update royllo database. + * User request to update royllo data. */ @Getter @SuperBuilder diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/user/UserDTO.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/user/UserDTO.java index fcbafb508..f7d7f6d66 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/user/UserDTO.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/dto/user/UserDTO.java @@ -33,7 +33,7 @@ public class UserDTO { /** Website maximum size. */ private static final int WEBSITE_MAXIMUM_SIZE = 50; - /** Username maximum size - If longer thant this, the username must be shortened. */ + /** Username maximum size. */ public static final int USERNAME_MAXIMUM_SIZE = 20; /** Username preview size - The size of the preview on both ends. */ @@ -46,16 +46,16 @@ public class UserDTO { @NotNull(message = "{validation.user.userId.required}") String userId; + /** User role. */ + @NotNull(message = "{validation.user.role.required}") + UserRole role; + /** Username. */ @Setter @NonFinal @Pattern(regexp = "^[a-zA-Z0-9_]{3,20}$", message = "{validation.user.username.invalid}") String username; - /** User role. */ - @NotNull(message = "{validation.user.role.required}") - UserRole role; - /** Profile picture file name. */ @Setter @NonFinal @@ -86,7 +86,7 @@ public class UserDTO { * @return the shortened username */ public String getShortenedUsername() { - // If username is too long, cut it. + // If username is too long, make a short version. if (username != null && username.length() >= USERNAME_MAXIMUM_SIZE) { return username.substring(0, USERNAME_PREVIEW_SIZE) + "..." diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/provider/mempool/ProviderTransactionServiceImplementation.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/provider/mempool/ProviderTransactionServiceImplementation.java index bd874fb0c..04ff3892f 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/provider/mempool/ProviderTransactionServiceImplementation.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/provider/mempool/ProviderTransactionServiceImplementation.java @@ -39,7 +39,7 @@ private void postConstruct() { @Override @SuppressWarnings("checkstyle:DesignForExtension") public Mono getTransaction(final String txid) { - logger.debug("Calling mempool for transaction {}", txid); + logger.info("Calling mempool for transaction {}", txid); // Consume a token from the token bucket. // If a token is not available this method will block until the refill adds one to the bucket. diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/provider/storage/LocalFileServiceImplementation.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/provider/storage/LocalFileServiceImplementation.java index 098443f4c..251863029 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/provider/storage/LocalFileServiceImplementation.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/provider/storage/LocalFileServiceImplementation.java @@ -9,6 +9,7 @@ import lombok.NonNull; import org.apache.commons.codec.DecoderException; import org.apache.commons.codec.binary.Hex; +import org.royllo.explorer.core.util.base.BaseProviderService; import org.springframework.context.annotation.Profile; import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Service; @@ -25,12 +26,12 @@ /** * Content service - Local file implementation - Used for local development. - * It also includes a web server to serve content and simulate a s3 CDN. + * It also includes a web server to serve content and simulate a S3 CDN. */ @SuppressWarnings("SpellCheckingInspection") @Service @Profile("!s3-storage") -public class LocalFileServiceImplementation implements ContentService { +public class LocalFileServiceImplementation extends BaseProviderService implements ContentService { /** Web server port. */ public static final int WEB_SERVER_PORT = 9093; @@ -84,15 +85,15 @@ public LocalFileServiceImplementation() throws DecoderException, IOException { final String unlimitedRoylloCoin2 = "544150460000000001fd04c55441505000040000000002241f7b079e5bc9aa73cdb388697bab10a79064e540e7507da77c214f589854cd890000000104500000202034a4f2a5fecc95d461212ad94ecb66d0c9ee7ac5fdb43d003100000000000000cf4a3cba30f469954f2fa882aeb881ae88294608a980abddd1595d48f9daf729a77539655f293b19402f697e06cd020000000001011f7b079e5bc9aa73cdb388697bab10a79064e540e7507da77c214f589854cd890100000000ffffffff02e8030000000000002251206f479cbd41e4ffce26c55a28268877fd40b0e64c283c817b875930bed23cea1e2b8216000000000022512078523cac7967c76daecc63e1fce58e7035fa400f8e5516299443dd4b2deebe210140864ccb6887b5dd92e0592b95aa5af1e4c0c82bbb20688a44c1a42a784aab5c5d2d22dbef014b51dfab133c4ea5d24826ddbd857ab8744cf7665492aa3ad45f0f0000000008a205c0f934598d194699c7c789782caabb2442ec4bdd0cba397c9bef4763aab4e3cb925852af91b28490c3f7678303f382a8cd71ede1e12b136779836f78a14e8ddcf5d067675f07d4c4692aa81d552f47e69faa56b63a01d27bc44cb08f8a2036feb5e4fe06516959842e30fa5d75c60a6f5caf8f82ae1d694837f2f587d352471f7b592c21cdb6cf968e27038ad439167cea8d4399a5adc4a6d90797ca27fe6a78190afd0164000100025e1f7b079e5bc9aa73cdb388697bab10a79064e540e7507da77c214f589854cd890000000114756e6c696d69746564526f796c6c6f436f696e3236a5ee53396cf2d45b9f7bfb306ec706bca2e5738d9bbf4cf52e3cd2cf45a31100000000000401000603fd01f50bad01ab01650000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000034201403c027fc40af5c14afedbbd9e08d61017ed36780f0b92d94ac97bb0f81fc8bf63a7c75c65bf37ee41be7a5287e1da049a8ccea15053ac2c11f0ad6a5000bc06590e020000102102ea041c360a308ee44466ca4e2b07c5692c02a8d01f0720982dcd0642366546ff11210349d60c6689bbbb2ffc9b30b45b96a3d6e5fd5fd01c867344c0054f61050482410c9f0004000000000221024b84c791ddceed288f4c832d047e67f8152ce1af352cc18930902d84bc6bf9130374014900010002203eb8c5d0a5cf2a1c3ffbf1ad097e22260c783d2a2d6222a23647ff6791a6a04004220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff022700010002220000ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0d30012e0004000000010221022300be5ca01e926c7bb7f8e59dc06111bf2d13627e8e28c3a581a632a8437e2e0503040101112d0001000228756e6c696d69746564526f796c6c6f436f696e20656d697373696f6e203220627920526f796c6c6f16040026af10175e1f7b079e5bc9aa73cdb388697bab10a79064e540e7507da77c214f589854cd890000000114756e6c696d69746564526f796c6c6f436f696e3236a5ee53396cf2d45b9f7bfb306ec706bca2e5738d9bbf4cf52e3cd2cf45a3110000000000e8d13eb083538735c4bb6a9354741d6187206bdfa196ff9f0534523182753408"; storeFile(unlimitedRoylloCoin2.getBytes(), sha256(unlimitedRoylloCoin2) + PROOF_FILE_NAME_EXTENSION); - // Profile images; + // Adding an existing profile images for straumat. storeFile(new ClassPathResource("static/straumat_profil.jpeg").getContentAsByteArray(), "22222222-2222-2222-2222-222222222222.jpeg"); // Starting a web server to serve content. PathResourceManager resourceManager = new PathResourceManager(fileSystem.getPath(".")); webServer = Undertow.builder() - .addHttpListener(WEB_SERVER_PORT, WEB_SERVER_HOST) // Set port and host - .setHandler(new ResourceHandler(resourceManager)) // Set the handler to serve files + .addHttpListener(WEB_SERVER_PORT, WEB_SERVER_HOST) // Set port and host. + .setHandler(new ResourceHandler(resourceManager)) // Set the handler to serve files. .build(); webServer.start(); } @@ -109,8 +110,10 @@ public void onDestroy() throws Exception { public void storeFile(final byte[] fileContent, @NonNull final String fileName) { try { + logger.info("Storing file {}", fileName); Files.write(fileSystem.getPath(".").resolve(fileName), fileContent); } catch (Exception e) { + logger.error("Error storing file {}: {}", fileName, e.getMessage()); throw new RuntimeException(e); } } @@ -118,15 +121,23 @@ public void storeFile(final byte[] fileContent, @Override @SuppressWarnings("checkstyle:DesignForExtension") public boolean fileExists(@NonNull final String fileName) { - return Files.exists(fileSystem.getPath(".").resolve(fileName)); + boolean fileExists = Files.exists(fileSystem.getPath(".").resolve(fileName)); + if (fileExists) { + logger.info("File {} exists", fileName); + } else { + logger.info("File {} does not exist", fileName); + } + return fileExists; } @Override @SuppressWarnings("checkstyle:DesignForExtension") public void deleteFile(@NonNull final String fileName) { try { + logger.info("Deleting file {}", fileName); Files.delete(fileSystem.getPath(".").resolve(fileName)); } catch (IOException e) { + logger.error("Error deleting file {}: {}", fileName, e.getMessage()); throw new RuntimeException(e); } } diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/provider/storage/S3ServiceImplementation.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/provider/storage/S3ServiceImplementation.java index fd075afdf..ada310c11 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/provider/storage/S3ServiceImplementation.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/provider/storage/S3ServiceImplementation.java @@ -64,8 +64,10 @@ public void storeFile(final byte[] fileContent, @NonNull final String fileName) .object(fileName).stream(new ByteArrayInputStream(fileContent), fileContent.length, -1) .contentType(new Tika().detect(fileContent)) .build()); + logger.info("File {} stored in S3", fileName); } catch (Exception e) { logger.error("Error while storing file {} in S3: {}", fileName, e.getMessage()); + throw new RuntimeException(e.getMessage()); } } @@ -76,8 +78,10 @@ public boolean fileExists(@NonNull final String fileName) { .bucket(s3Parameters.getBucketName()) .object(fileName) .build()); + logger.info("File {} exists in S3", fileName); return true; } catch (ErrorResponseException e) { + logger.info("File {} does not exist in S3", fileName); return false; } catch (Exception e) { logger.error("Error checking if file exists {} in S3: {}", fileName, e.getMessage()); @@ -93,6 +97,7 @@ public void deleteFile(@NonNull final String fileName) { .bucket(s3Parameters.getBucketName()) .object(fileName) .build()); + logger.info("File {} deleted from S3", fileName); } catch (Exception e) { logger.error("Error deleting file {} in S3: {}", fileName, e.getMessage()); throw new RuntimeException(e.getMessage()); diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/provider/tapd/TapdServiceImplementation.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/provider/tapd/TapdServiceImplementation.java index 4166d833f..83f031477 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/provider/tapd/TapdServiceImplementation.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/provider/tapd/TapdServiceImplementation.java @@ -11,7 +11,6 @@ import org.royllo.explorer.core.util.enums.ProofType; import org.royllo.explorer.core.util.parameters.OutgoingRateLimitsParameters; import org.royllo.explorer.core.util.parameters.TAPDParameters; -import org.springframework.http.MediaType; import org.springframework.http.client.reactive.ReactorClientHttpConnector; import org.springframework.stereotype.Service; import org.springframework.web.reactive.function.BodyInserters; @@ -21,6 +20,8 @@ import javax.net.ssl.SSLException; +import static org.springframework.http.MediaType.APPLICATION_JSON; + /** * TAPD service implementation. */ @@ -100,7 +101,7 @@ public final Mono decode(final String proof, final long pr .post() .uri("/v1/taproot-assets/proofs/decode") .header("Grpc-Metadata-macaroon", tapdParameters.getApi().getMacaroon()) - .contentType(MediaType.APPLICATION_JSON) + .contentType(APPLICATION_JSON) .body(BodyInserters.fromValue(DecodedProofRequest.builder() .rawProof(proof) .proofAtDepth(proofAtDepth) @@ -109,6 +110,9 @@ public final Mono decode(final String proof, final long pr .build() )) .exchangeToFlux(response -> response.bodyToFlux(DecodedProofResponse.class)) + .doOnError(throwable -> logger.error("Error calling decode for proof from tapd at {} depth: {}", + proofAtDepth, + throwable.getMessage())) .next(); } @@ -135,6 +139,9 @@ public final Mono getUniverseRoots(final String serverAdd .get() .uri("/v1/taproot-assets/universe/roots?offset=" + offset + "&limit=" + limit) .exchangeToFlux(response -> response.bodyToFlux(UniverseRootsResponse.class)) + .doOnError(throwable -> logger.error("Error getting universe roots from tapd server {}: {}", + serverAddress, + throwable.getMessage())) .next(); } @@ -161,6 +168,9 @@ public final Mono getUniverseLeaves(final String serverA .get() .uri("/v1/taproot-assets/universe/leaves/asset-id/" + assetId + "?proof_type=" + proofType) .exchangeToFlux(response -> response.bodyToFlux(UniverseLeavesResponse.class)) + .doOnError(throwable -> logger.error("Error getting universe leaves from tapd for asset {}: {}", + assetId, + throwable.getMessage())) .next(); } @@ -185,12 +195,15 @@ public final Mono verifyOwnership(final String proofWit .post() .uri("/v1/taproot-assets/wallet/ownership/verify") .header("Grpc-Metadata-macaroon", tapdParameters.getApi().getMacaroon()) - .contentType(MediaType.APPLICATION_JSON) + .contentType(APPLICATION_JSON) .body(BodyInserters.fromValue(OwnershipVerifyRequest.builder() .proofWithWitness(proofWithWitness) .build() )) .exchangeToFlux(response -> response.bodyToFlux(OwnershipVerifyResponse.class)) + .doOnError(throwable -> logger.error("Error verifying asset ownership with the proof {}: {}", + proofWithWitness, + throwable.getMessage())) .next(); } diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/service/proof/ProofServiceImplementation.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/service/proof/ProofServiceImplementation.java index 074fb4848..5c9a672b1 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/service/proof/ProofServiceImplementation.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/service/proof/ProofServiceImplementation.java @@ -73,7 +73,7 @@ public ProofDTO addProof(@NonNull final String proof, .proofId(sha256(proof)) .creator(ANONYMOUS_USER) .asset(asset.get()) - .proofType(proofType) + .type(proofType) .build()); final ProofDTO proofDTO = PROOF_MAPPER.mapToProofDTO(proofToCreate); logger.info("Proof '{}' with id {}", getProofAbstract(proof), proofDTO.getId()); diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/service/request/RequestServiceImplementation.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/service/request/RequestServiceImplementation.java index c9391719e..db24ad733 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/service/request/RequestServiceImplementation.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/service/request/RequestServiceImplementation.java @@ -115,7 +115,7 @@ public AddProofRequestDTO createAddProofRequest(final String proof, .creator(ANONYMOUS_USER) .status(OPENED) .proof(proof) - .proofType(proofType) + .type(proofType) .build(); AddProofRequestDTO savedRequest = REQUEST_MAPPER.mapToAddAssetRequestDTO(requestRepository.save(request)); diff --git a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/util/mapper/UserMapper.java b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/util/mapper/UserMapper.java index e1b6f90a2..6092f3107 100644 --- a/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/util/mapper/UserMapper.java +++ b/backend/explorer-core/autoconfigure/src/main/java/org/royllo/explorer/core/util/mapper/UserMapper.java @@ -11,6 +11,7 @@ */ @Mapper(nullValuePropertyMappingStrategy = IGNORE) public interface UserMapper { + // TODO: specify fields. User mapToUser(UserDTO source); diff --git a/backend/explorer-core/autoconfigure/src/main/resources/db/changelog/1.0.0/table/table-application_user.xml b/backend/explorer-core/autoconfigure/src/main/resources/db/changelog/1.0.0/table/table-application_user.xml index 1450174b6..9b8fbf77b 100644 --- a/backend/explorer-core/autoconfigure/src/main/resources/db/changelog/1.0.0/table/table-application_user.xml +++ b/backend/explorer-core/autoconfigure/src/main/resources/db/changelog/1.0.0/table/table-application_user.xml @@ -18,14 +18,14 @@ remarks="User UUID"> - - - + + + diff --git a/backend/explorer-core/autoconfigure/src/main/resources/db/changelog/1.0.0/table/table-request.xml b/backend/explorer-core/autoconfigure/src/main/resources/db/changelog/1.0.0/table/table-request.xml index 044d8cdfd..c36ac6096 100644 --- a/backend/explorer-core/autoconfigure/src/main/resources/db/changelog/1.0.0/table/table-request.xml +++ b/backend/explorer-core/autoconfigure/src/main/resources/db/changelog/1.0.0/table/table-request.xml @@ -24,7 +24,7 @@ remarks="Request UUID"> - diff --git a/backend/explorer-core/autoconfigure/src/test/java/org/royllo/explorer/core/test/core/service/proof/ProofServiceTest.java b/backend/explorer-core/autoconfigure/src/test/java/org/royllo/explorer/core/test/core/service/proof/ProofServiceTest.java index f34dd74bc..ab25dfd5b 100644 --- a/backend/explorer-core/autoconfigure/src/test/java/org/royllo/explorer/core/test/core/service/proof/ProofServiceTest.java +++ b/backend/explorer-core/autoconfigure/src/test/java/org/royllo/explorer/core/test/core/service/proof/ProofServiceTest.java @@ -81,7 +81,7 @@ public void addProof() { assertEquals(UNKNOWN_ROYLLO_COIN_RAW_PROOF, getProofFromContentService(proofAdded.getProofFileName())); assertEquals(UNKNOWN_ROYLLO_COIN_ASSET_ID, proofAdded.getAsset().getAssetId()); assertEquals(ANONYMOUS_ID, proofAdded.getCreator().getId()); - assertEquals(PROOF_TYPE_UNSPECIFIED, proofAdded.getProofType()); + assertEquals(PROOF_TYPE_UNSPECIFIED, proofAdded.getType()); // We add again our proof as it's already in our database --> an error must occur. e = assertThrows(ProofCreationException.class, () -> proofService.addProof(UNKNOWN_ROYLLO_COIN_RAW_PROOF, PROOF_TYPE_UNSPECIFIED, unknownRoylloCoinDecodedProof)); diff --git a/backend/explorer-core/autoconfigure/src/test/java/org/royllo/explorer/core/test/core/service/request/RequestServiceTest.java b/backend/explorer-core/autoconfigure/src/test/java/org/royllo/explorer/core/test/core/service/request/RequestServiceTest.java index 63e754e3f..eb9489c19 100644 --- a/backend/explorer-core/autoconfigure/src/test/java/org/royllo/explorer/core/test/core/service/request/RequestServiceTest.java +++ b/backend/explorer-core/autoconfigure/src/test/java/org/royllo/explorer/core/test/core/service/request/RequestServiceTest.java @@ -127,7 +127,7 @@ public void addRequests() { assertEquals(OPENED, request1Casted.getStatus()); assertNull(request1Casted.getErrorMessage()); assertEquals("proof1", request1Casted.getProof()); - assertEquals(PROOF_TYPE_UNSPECIFIED, request1Casted.getProofType()); + assertEquals(PROOF_TYPE_UNSPECIFIED, request1Casted.getType()); // ============================================================================================================= // Request 2 (addAssetMetaData). @@ -172,7 +172,7 @@ public void addRequests() { assertEquals(OPENED, request3Casted.getStatus()); assertNull(request3Casted.getErrorMessage()); assertEquals("proof2", request3Casted.getProof()); - assertEquals(PROOF_TYPE_UNSPECIFIED, request3Casted.getProofType()); + assertEquals(PROOF_TYPE_UNSPECIFIED, request3Casted.getType()); // ============================================================================================================= // Request 4 (AddUniverseServerRequest). @@ -199,11 +199,11 @@ public void addRequests() { // Testing createAddProofRequest(String proof, ProofType proofType). AddProofRequestDTO request5DTO = requestService.createAddProofRequest("proof", PROOF_TYPE_ISSUANCE); assertNotNull(request5DTO.getId()); - assertEquals(PROOF_TYPE_ISSUANCE, request5DTO.getProofType()); + assertEquals(PROOF_TYPE_ISSUANCE, request5DTO.getType()); AddProofRequestDTO request6DTO = requestService.createAddProofRequest("proof", PROOF_TYPE_TRANSFER); assertNotNull(request6DTO.getId()); - assertEquals(PROOF_TYPE_TRANSFER, request6DTO.getProofType()); + assertEquals(PROOF_TYPE_TRANSFER, request6DTO.getType()); // ============================================================================================================= // Request 7 (ClaimAssetOwnershipRequest). diff --git a/backend/explorer-core/autoconfigure/src/test/resources/db/test/test-data-request.xml b/backend/explorer-core/autoconfigure/src/test/resources/db/test/test-data-request.xml index af5b4edc5..f51e03d47 100644 --- a/backend/explorer-core/autoconfigure/src/test/resources/db/test/test-data-request.xml +++ b/backend/explorer-core/autoconfigure/src/test/resources/db/test/test-data-request.xml @@ -8,7 +8,7 @@ - + @@ -22,7 +22,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -49,7 +49,7 @@ - + diff --git a/backend/servers/explorer-api/src/main/resources/db/dev/dev-data-request.xml b/backend/servers/explorer-api/src/main/resources/db/dev/dev-data-request.xml index af5b4edc5..f51e03d47 100644 --- a/backend/servers/explorer-api/src/main/resources/db/dev/dev-data-request.xml +++ b/backend/servers/explorer-api/src/main/resources/db/dev/dev-data-request.xml @@ -8,7 +8,7 @@ - + @@ -22,7 +22,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -49,7 +49,7 @@ - + diff --git a/backend/servers/explorer-api/src/test/resources/db/test/api-test-data-request.xml b/backend/servers/explorer-api/src/test/resources/db/test/api-test-data-request.xml index af5b4edc5..f51e03d47 100644 --- a/backend/servers/explorer-api/src/test/resources/db/test/api-test-data-request.xml +++ b/backend/servers/explorer-api/src/test/resources/db/test/api-test-data-request.xml @@ -8,7 +8,7 @@ - + @@ -22,7 +22,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -49,7 +49,7 @@ - + diff --git a/backend/servers/explorer-batch/src/main/java/org/royllo/explorer/batch/batch/request/AddProofBatch.java b/backend/servers/explorer-batch/src/main/java/org/royllo/explorer/batch/batch/request/AddProofBatch.java index 053d7eaff..652743245 100644 --- a/backend/servers/explorer-batch/src/main/java/org/royllo/explorer/batch/batch/request/AddProofBatch.java +++ b/backend/servers/explorer-batch/src/main/java/org/royllo/explorer/batch/batch/request/AddProofBatch.java @@ -134,7 +134,7 @@ public void processRequests() { // If not already added, we add the proof. if (!proofAdded) { - proofService.addProof(request.getProof(), request.getProofType(), response); + proofService.addProof(request.getProof(), request.getType(), response); request.setAsset(assetStateCreated.get().getAsset()); proofAdded = true; } diff --git a/backend/servers/explorer-batch/src/main/resources/db/dev/test-data-request.xml b/backend/servers/explorer-batch/src/main/resources/db/dev/test-data-request.xml index 36cc08354..5b060c72c 100644 --- a/backend/servers/explorer-batch/src/main/resources/db/dev/test-data-request.xml +++ b/backend/servers/explorer-batch/src/main/resources/db/dev/test-data-request.xml @@ -8,7 +8,7 @@ - + @@ -22,7 +22,7 @@ - + @@ -36,7 +36,7 @@ - + @@ -49,7 +49,7 @@ - + diff --git a/backend/servers/explorer-web/src/main/resources/db/dev/dev-data-request.xml b/backend/servers/explorer-web/src/main/resources/db/dev/dev-data-request.xml index 45cd46ac9..51b3e30e8 100644 --- a/backend/servers/explorer-web/src/main/resources/db/dev/dev-data-request.xml +++ b/backend/servers/explorer-web/src/main/resources/db/dev/dev-data-request.xml @@ -8,7 +8,7 @@ - + @@ -22,7 +22,7 @@ - + @@ -37,7 +37,7 @@ - + @@ -50,7 +50,7 @@ - + diff --git a/backend/servers/explorer-web/src/test/resources/db/test/web-test-data-request.xml b/backend/servers/explorer-web/src/test/resources/db/test/web-test-data-request.xml index cad10218e..a92e3d381 100644 --- a/backend/servers/explorer-web/src/test/resources/db/test/web-test-data-request.xml +++ b/backend/servers/explorer-web/src/test/resources/db/test/web-test-data-request.xml @@ -8,7 +8,7 @@ - + @@ -22,7 +22,7 @@ - + @@ -37,7 +37,7 @@ - + @@ -50,7 +50,7 @@ - + @@ -65,7 +65,7 @@ - + @@ -78,7 +78,7 @@ - + @@ -92,7 +92,7 @@ - +