Skip to content

Commit

Permalink
feat: credential issuance history: remove profile version from URL
Browse files Browse the repository at this point in the history
Signed-off-by: Mykhailo Sizov <[email protected]>
  • Loading branch information
mishasizov-SK committed Oct 16, 2023
1 parent 398b8a9 commit 07b9519
Show file tree
Hide file tree
Showing 9 changed files with 156 additions and 174 deletions.
86 changes: 43 additions & 43 deletions api/spec/openapi.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions docs/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,20 +81,14 @@ paths:
description: Returns openid-config.
tags:
- issuer
'/issuer/profiles/{profileID}/{profileVersion}/issued-credentials':
'/issuer/profiles/{profileID}/issued-credentials':
parameters:
- schema:
type: string
name: profileID
in: path
required: true
description: Profile ID
- schema:
type: string
name: profileVersion
in: path
required: true
description: Profile Version
get:
summary: Request Credential Issuance history.
responses:
Expand Down
7 changes: 3 additions & 4 deletions pkg/restapi/v1/issuer/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ type credentialIssuanceHistoryStore interface {
GetIssuedCredentialsMetadata(
ctx context.Context,
profileID string,
profileVersion string,
) ([]*credentialstatus.CredentialMetadata, error)
}

Expand Down Expand Up @@ -690,10 +689,10 @@ func (c *Controller) PrepareCredential(e echo.Context) error {
}

// CredentialIssuanceHistory returns Credential Issuance history.
// GET /issuer/profiles/{profileID}/{profileVersion}/issued-credentials.
func (c *Controller) CredentialIssuanceHistory(e echo.Context, profileID string, profileVersion string) error {
// GET /issuer/profiles/{profileID}/issued-credentials.
func (c *Controller) CredentialIssuanceHistory(e echo.Context, profileID string) error {
credentialMetadata, err := c.credentialIssuanceHistoryStore.
GetIssuedCredentialsMetadata(e.Request().Context(), profileID, profileVersion)
GetIssuedCredentialsMetadata(e.Request().Context(), profileID)
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/restapi/v1/issuer/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1634,7 +1634,7 @@ func TestCredentialIssuanceHistory(t *testing.T) {
}

credentialIssuanceStore.EXPECT().
GetIssuedCredentialsMetadata(gomock.Any(), profileID, profileVersion).
GetIssuedCredentialsMetadata(gomock.Any(), profileID).
Times(1).
Return([]*credentialstatus.CredentialMetadata{credentialMetadata}, nil)

Expand All @@ -1646,7 +1646,7 @@ func TestCredentialIssuanceHistory(t *testing.T) {

echoCtx := echoContext(withRecorder(recorder))

err := c.CredentialIssuanceHistory(echoCtx, profileID, profileVersion)
err := c.CredentialIssuanceHistory(echoCtx, profileID)
assert.NoError(t, err)

var gotResponse []CredentialIssuanceHistoryData
Expand All @@ -1669,7 +1669,7 @@ func TestCredentialIssuanceHistory(t *testing.T) {

t.Run("credentialIssuanceHistoryStore error", func(t *testing.T) {
credentialIssuanceStore.EXPECT().
GetIssuedCredentialsMetadata(gomock.Any(), profileID, profileVersion).
GetIssuedCredentialsMetadata(gomock.Any(), profileID).
Times(1).
Return(nil, errors.New("some error"))

Expand All @@ -1681,7 +1681,7 @@ func TestCredentialIssuanceHistory(t *testing.T) {

echoCtx := echoContext(withRecorder(recorder))

err := c.CredentialIssuanceHistory(echoCtx, profileID, profileVersion)
err := c.CredentialIssuanceHistory(echoCtx, profileID)
assert.Error(t, err)
})
}
Expand Down
Loading

0 comments on commit 07b9519

Please sign in to comment.