Skip to content

Commit

Permalink
feat(pollux): Added a new column to the table to store the issued cre…
Browse files Browse the repository at this point in the history
…dential

Added a new column to the table to store the issued credential
Co-authored-by: Fabio Pinheiro <[email protected]>
  • Loading branch information
mineme0110 authored Dec 9, 2022
1 parent 17038d3 commit cd416bf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ CREATE TABLE public.issue_credential_records(
"publication_state" VARCHAR(50),
"offer_credential_data" TEXT,
"request_credential_data" TEXT,
"issue_credential_data" TEXT
"issue_credential_data" TEXT,
"issued_credential_raw" TEXT
);

CREATE TABLE public.presentation_records(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ class JdbcCredentialRepository(xa: Transactor[Task]) extends CredentialRepositor
| await_confirmation,
| protocol_state,
| publication_state,
| offer_credential_data
| offer_credential_data,
| request_credential_data,
| issue_credential_data,
| issued_credential_raw
| ) values (
| ${record.id},
| ${record.createdAt},
Expand All @@ -95,7 +98,10 @@ class JdbcCredentialRepository(xa: Transactor[Task]) extends CredentialRepositor
| ${record.awaitConfirmation},
| ${record.protocolState},
| ${record.publicationState},
| ${record.offerCredentialData}
| ${record.offerCredentialData},
| ${record.requestCredentialData},
| ${record.issueCredentialData},
| ${record.issuedCredentialRaw}
| )
""".stripMargin.update

Expand All @@ -120,7 +126,8 @@ class JdbcCredentialRepository(xa: Transactor[Task]) extends CredentialRepositor
| publication_state,
| offer_credential_data,
| request_credential_data,
| issue_credential_data
| issue_credential_data,
| issued_credential_raw
| FROM public.issue_credential_records
""".stripMargin
.query[IssueCredentialRecord]
Expand Down Expand Up @@ -149,7 +156,8 @@ class JdbcCredentialRepository(xa: Transactor[Task]) extends CredentialRepositor
| publication_state,
| offer_credential_data,
| request_credential_data,
| issue_credential_data
| issue_credential_data,
| issued_credential_raw
| FROM public.issue_credential_records
| WHERE protocol_state = ${state.toString}
""".stripMargin
Expand Down Expand Up @@ -177,7 +185,8 @@ class JdbcCredentialRepository(xa: Transactor[Task]) extends CredentialRepositor
| publication_state,
| offer_credential_data,
| request_credential_data,
| issue_credential_data
| issue_credential_data,
| issued_credential_raw
| FROM public.issue_credential_records
| WHERE id = $recordId
""".stripMargin
Expand Down Expand Up @@ -205,7 +214,8 @@ class JdbcCredentialRepository(xa: Transactor[Task]) extends CredentialRepositor
| publication_state,
| offer_credential_data,
| request_credential_data,
| issue_credential_data
| issue_credential_data,
| issued_credential_raw
| FROM public.issue_credential_records
| WHERE thid = $thid
""".stripMargin
Expand Down Expand Up @@ -325,7 +335,7 @@ class JdbcCredentialRepository(xa: Transactor[Task]) extends CredentialRepositor
val cxnIO = sql"""
| SELECT
| id,
| issue_raw_credential
| issued_credential_raw
| FROM public.issue_credential_records
| WHERE
| id IN (${recordId.mkString(",")})
Expand All @@ -348,7 +358,7 @@ class JdbcCredentialRepository(xa: Transactor[Task]) extends CredentialRepositor
| UPDATE public.issue_credential_records
| SET
| issue_credential_data = $issue,
| issued_raw_credential = $issuedRawCredential,
| issued_credential_raw = $issuedRawCredential,
| protocol_state = $protocolState,
| updated_at = ${Instant.now}
| WHERE
Expand Down

0 comments on commit cd416bf

Please sign in to comment.