mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-22 09:35:10 +00:00
cambios en sintaxis para validar ABM de vacunas
This commit is contained in:
parent
5008a13609
commit
54faad550f
4 changed files with 10 additions and 9 deletions
|
|
@ -33,7 +33,7 @@ type Receta struct {
|
||||||
|
|
||||||
type Vacuna struct {
|
type Vacuna struct {
|
||||||
ID string `json:"id"` // identificador único para el ledger
|
ID string `json:"id"` // identificador único para el ledger
|
||||||
Identificador string `json:"identificador"`
|
Identifier string `json:"identifier"`
|
||||||
Status string `json:"status"` // podés validarlo con enums si querés
|
Status string `json:"status"` // podés validarlo con enums si querés
|
||||||
StatusChange string `json:"statusChange"` // como string (ISO8601)
|
StatusChange string `json:"statusChange"` // como string (ISO8601)
|
||||||
StatusReason string `json:"statusReason"`
|
StatusReason string `json:"statusReason"`
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ public class VacunaController {
|
||||||
// Log antes de intentar registrar la vacuna
|
// Log antes de intentar registrar la vacuna
|
||||||
System.out.println("Intentando registrar la vacuna...");
|
System.out.println("Intentando registrar la vacuna...");
|
||||||
|
|
||||||
vacunaService.registrarVacuna(vacuna);
|
vacunaService.cargarVacuna(vacuna);
|
||||||
|
|
||||||
// Log después de que la vacuna fue registrada
|
// Log después de que la vacuna fue registrada
|
||||||
System.out.println("Vacuna registrada correctamente.");
|
System.out.println("Vacuna registrada correctamente.");
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import lombok.NoArgsConstructor;
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class Vacuna {
|
public class Vacuna {
|
||||||
private String id;
|
private String id;
|
||||||
private String identificador;
|
private String identifier;
|
||||||
private String status;
|
private String status;
|
||||||
private String statusChange;
|
private String statusChange;
|
||||||
private String statusReason;
|
private String statusReason;
|
||||||
|
|
|
||||||
|
|
@ -9,18 +9,20 @@ import io.grpc.Grpc;
|
||||||
import io.grpc.ManagedChannel;
|
import io.grpc.ManagedChannel;
|
||||||
import io.grpc.TlsChannelCredentials;
|
import io.grpc.TlsChannelCredentials;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
|
import main.java.com.code.hyperledger.models.VacunaDto;
|
||||||
|
|
||||||
import org.hyperledger.fabric.client.*;
|
import org.hyperledger.fabric.client.*;
|
||||||
import org.hyperledger.fabric.client.identity.*;
|
import org.hyperledger.fabric.client.identity.*;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.hyperledger.fabric.client.identity.Identity;
|
|
||||||
import org.hyperledger.fabric.client.identity.Signer;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.security.Identity;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
|
import java.security.Signer;
|
||||||
import java.security.cert.CertificateException;
|
import java.security.cert.CertificateException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -98,12 +100,12 @@ public class VacunaService {
|
||||||
contract = network.getContract(CHAINCODE_NAME);
|
contract = network.getContract(CHAINCODE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registrarVacuna(Vacuna vacuna)
|
public void cargarVacuna(Vacuna vacuna)
|
||||||
throws CommitStatusException, EndorseException, CommitException, SubmitException {
|
throws CommitStatusException, EndorseException, CommitException, SubmitException {
|
||||||
contract.submitTransaction(
|
contract.submitTransaction(
|
||||||
"CreateVacuna",
|
"CreateVacuna",
|
||||||
vacuna.getId(),
|
vacuna.getId(),
|
||||||
vacuna.getIdentificador(),
|
vacuna.getIdentifier(),
|
||||||
vacuna.getStatus(),
|
vacuna.getStatus(),
|
||||||
vacuna.getStatusChange(),
|
vacuna.getStatusChange(),
|
||||||
vacuna.getStatusReason(),
|
vacuna.getStatusReason(),
|
||||||
|
|
@ -113,8 +115,7 @@ public class VacunaService {
|
||||||
vacuna.getLotNumber(),
|
vacuna.getLotNumber(),
|
||||||
vacuna.getExpirationDate(),
|
vacuna.getExpirationDate(),
|
||||||
vacuna.getPatientDocumentNumber(),
|
vacuna.getPatientDocumentNumber(),
|
||||||
vacuna.getReactions()
|
vacuna.getReactions());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vacuna obtenerVacuna(String vacunaId) throws GatewayException, IOException {
|
public Vacuna obtenerVacuna(String vacunaId) throws GatewayException, IOException {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue