Skip to content

Commit

Permalink
fix: delete subject id from presentation record (#1314)
Browse files Browse the repository at this point in the history
Signed-off-by: mineme0110 <shailesh.patil@iohk.io>
  • Loading branch information
mineme0110 authored Aug 30, 2024
1 parent f2313f2 commit b73b806
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
InvitationGenerated,
_,
_,
Expand All @@ -124,15 +123,15 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_
) =>
ZIO.unit
case PresentationRecord(_, _, _, _, _, _, _, _, InvitationExpired, _, _, _, _, _, _, _, _, _, _, _, _, _, _) =>
case PresentationRecord(_, _, _, _, _, _, _, InvitationExpired, _, _, _, _, _, _, _, _, _, _, _, _, _, _) =>
ZIO.unit
case PresentationRecord(id, _, _, _, _, _, _, _, ProposalPending, _, _, _, _, _, _, _, _, _, _, _, _, _, _) =>
case PresentationRecord(id, _, _, _, _, _, _, ProposalPending, _, _, _, _, _, _, _, _, _, _, _, _, _, _) =>
ZIO.fail(NotImplemented)
case PresentationRecord(id, _, _, _, _, _, _, _, ProposalSent, _, _, _, _, _, _, _, _, _, _, _, _, _, _) =>
case PresentationRecord(id, _, _, _, _, _, _, ProposalSent, _, _, _, _, _, _, _, _, _, _, _, _, _, _) =>
ZIO.fail(NotImplemented)
case PresentationRecord(id, _, _, _, _, _, _, _, ProposalReceived, _, _, _, _, _, _, _, _, _, _, _, _, _, _) =>
case PresentationRecord(id, _, _, _, _, _, _, ProposalReceived, _, _, _, _, _, _, _, _, _, _, _, _, _, _) =>
ZIO.fail(NotImplemented)
case PresentationRecord(id, _, _, _, _, _, _, _, ProposalRejected, _, _, _, _, _, _, _, _, _, _, _, _, _, _) =>
case PresentationRecord(id, _, _, _, _, _, _, ProposalRejected, _, _, _, _, _, _, _, _, _, _, _, _, _, _) =>
ZIO.fail(NotImplemented)
case PresentationRecord(
id,
Expand All @@ -142,7 +141,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
RequestPending,
_,
_,
Expand All @@ -168,7 +166,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
RequestPending,
_,
_,
Expand All @@ -194,7 +191,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
RequestSent,
_,
_,
Expand All @@ -220,7 +216,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
RequestReceived,
_,
_,
Expand All @@ -246,7 +241,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
RequestRejected,
_,
_,
Expand All @@ -272,7 +266,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
ProblemReportPending,
_,
_,
Expand All @@ -290,7 +283,7 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_
) =>
ZIO.fail(NotImplemented)
case PresentationRecord(id, _, _, _, _, _, _, _, ProblemReportSent, _, _, _, _, _, _, _, _, _, _, _, _, _, _) =>
case PresentationRecord(id, _, _, _, _, _, _, ProblemReportSent, _, _, _, _, _, _, _, _, _, _, _, _, _, _) =>
ZIO.fail(NotImplemented)
case PresentationRecord(
id,
Expand All @@ -300,7 +293,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
ProblemReportReceived,
_,
_,
Expand All @@ -326,7 +318,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
PresentationPending,
_,
_,
Expand All @@ -353,7 +344,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
PresentationPending,
credentialFormat,
_,
Expand Down Expand Up @@ -386,7 +376,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
PresentationGenerated,
_,
_,
Expand All @@ -413,7 +402,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
PresentationGenerated,
_,
_,
Expand All @@ -433,7 +421,7 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
ZIO.logDebug("PresentationRecord: PresentationGenerated") *> ZIO.unit
Prover.handlePresentationGenerated(id, presentation)

case PresentationRecord(id, _, _, _, _, _, _, _, PresentationSent, _, _, _, _, _, _, _, _, _, _, _, _, _, _) =>
case PresentationRecord(id, _, _, _, _, _, _, PresentationSent, _, _, _, _, _, _, _, _, _, _, _, _, _, _) =>
ZIO.logDebug("PresentationRecord: PresentationSent") *> ZIO.unit
case PresentationRecord(
id,
Expand All @@ -443,7 +431,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
PresentationReceived,
_,
_,
Expand All @@ -469,7 +456,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
PresentationReceived,
_,
_,
Expand All @@ -495,7 +481,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
PresentationReceived,
credentialFormat,
invitation,
Expand Down Expand Up @@ -523,7 +508,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
PresentationVerificationFailed,
_,
_,
Expand All @@ -549,7 +533,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
PresentationAccepted,
_,
_,
Expand All @@ -575,7 +558,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
PresentationVerified,
_,
_,
Expand All @@ -601,7 +583,6 @@ object PresentBackgroundJobs extends BackgroundJobsHelper {
_,
_,
_,
_,
PresentationRejected,
_,
_,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.hyperledger.identus.pollux.core.model

import org.hyperledger.identus.mercury.model.DidId
import org.hyperledger.identus.mercury.protocol.invitation.v2.Invitation
import org.hyperledger.identus.mercury.protocol.presentproof.{Presentation, ProposePresentation, RequestPresentation}
import org.hyperledger.identus.shared.models.{Failure, WalletAccessContext, WalletId}
Expand All @@ -20,7 +19,6 @@ final case class PresentationRecord(
schemaId: Option[String],
connectionId: Option[String],
role: PresentationRecord.Role,
subjectId: DidId, // TODO Remove
protocolState: PresentationRecord.ProtocolState,
credentialFormat: CredentialFormat,
invitation: Option[Invitation],
Expand Down Expand Up @@ -55,7 +53,6 @@ object PresentationRecord {
schemaId: Option[String],
connectionId: Option[String],
role: Role,
subjectId: DidId,
protocolState: ProtocolState,
credentialFormat: CredentialFormat,
invitation: Option[Invitation],
Expand All @@ -80,7 +77,6 @@ object PresentationRecord {
schemaId,
connectionId,
role,
subjectId,
protocolState,
credentialFormat,
invitation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,6 @@ private class PresentationServiceImpl(
connectionId = connectionId,
schemaId = None, // TODO REMOVE from DB
role = PresentationRecord.Role.Verifier,
subjectId = pairwiseProverDID.getOrElse(DidId("TODO REMOVE")), // TODO REMOVE from DB
protocolState = invitation.fold(PresentationRecord.ProtocolState.RequestPending)(_ =>
PresentationRecord.ProtocolState.InvitationGenerated
),
Expand Down Expand Up @@ -499,8 +498,6 @@ private class PresentationServiceImpl(
connectionId = connectionId,
schemaId = None,
role = Role.Prover,
subjectId =
request.to.getOrElse(throw RuntimeException(s"RequestPresentation from field is missing")), // TODO REMOVE
protocolState = PresentationRecord.ProtocolState.RequestReceived,
credentialFormat = format,
invitation = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ object PresentationRepositorySpecSuite {
schemaId = None,
connectionId = None,
role = PresentationRecord.Role.Verifier,
subjectId = DidId("did:prism:aaa"),
protocolState = PresentationRecord.ProtocolState.RequestPending,
credentialFormat = CredentialFormat.JWT,
invitation = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ object PresentationServiceNotifierSpec extends ZIOSpecDefault with PresentationS
None,
None,
PresentationRecord.Role.Verifier,
DidId(""),
ProtocolState.RequestPending,
CredentialFormat.JWT,
None,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-- presentation_records
-- Remove subject_id column
ALTER TABLE public.presentation_records
DROP COLUMN "subject_id";
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ class JdbcPresentationRepository(
| connection_id,
| schema_id,
| role,
| subject_id,
| protocol_state,
| credential_format,
| invitation,
Expand All @@ -206,7 +205,6 @@ class JdbcPresentationRepository(
| ${record.connectionId},
| ${record.schemaId},
| ${record.role},
| ${record.subjectId},
| ${record.protocolState},
| ${record.credentialFormat},
| ${record.invitation},
Expand Down Expand Up @@ -244,7 +242,6 @@ class JdbcPresentationRepository(
| schema_id,
| connection_id,
| role,
| subject_id,
| protocol_state,
| credential_format,
| invitation,
Expand Down Expand Up @@ -297,7 +294,6 @@ class JdbcPresentationRepository(
| schema_id,
| connection_id,
| role,
| subject_id,
| protocol_state,
| credential_format,
| invitation,
Expand Down Expand Up @@ -347,7 +343,6 @@ class JdbcPresentationRepository(
| schema_id,
| connection_id,
| role,
| subject_id,
| protocol_state,
| credential_format,
| invitation,
Expand Down Expand Up @@ -386,7 +381,6 @@ class JdbcPresentationRepository(
| schema_id,
| connection_id,
| role,
| subject_id,
| protocol_state,
| credential_format,
| invitation,
Expand Down Expand Up @@ -423,7 +417,6 @@ class JdbcPresentationRepository(
| schema_id,
| connection_id,
| role,
| subject_id,
| protocol_state,
| credential_format,
| invitation,
Expand Down

0 comments on commit b73b806

Please sign in to comment.