Skip to content

Commit

Permalink
Merge pull request #892 from pastelnetwork/PSL-1206_fixGetRegistratio…
Browse files Browse the repository at this point in the history
…nDetail

[PSL-1206] fix reg detail endpoint to return volume info by base-file-id
  • Loading branch information
j-rafique authored Jul 4, 2024
2 parents 57af543 + b4006fa commit 9f6e7d4
Show file tree
Hide file tree
Showing 14 changed files with 44 additions and 49 deletions.
10 changes: 5 additions & 5 deletions walletnode/api/design/cascade.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ var _ = Service("cascade", func() {
Result(FileRegistrationDetailResult)

HTTP(func() {
GET("/registration_details/{file_id}")
GET("/registration_details/{base_file_id}")
Params(func() {
Param("file_id", String)
Param("base_file_id", String)
})

// Define error HTTP statuses.
Expand Down Expand Up @@ -332,13 +332,13 @@ var StartCascadeProcessingPayload = Type("StartCascadeProcessingPayload", func()
// FileRegistrationDetailPayload - Payload for registration detail
var FileRegistrationDetailPayload = Type("FileRegistrationDetailPayload", func() {
Description("File registration details")
Attribute("file_id", String, func() {
Description("file ID")
Attribute("base_file_id", String, func() {
Description("Base file ID")
MaxLength(8)
Example("VK7mpAqZ")
})

Required("file_id")
Required("base_file_id")
})

// FileRegistrationDetailResult is registration detail result.
Expand Down
4 changes: 2 additions & 2 deletions walletnode/api/gen/cascade/service.go

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

12 changes: 6 additions & 6 deletions walletnode/api/gen/http/cascade/client/cli.go

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

6 changes: 3 additions & 3 deletions walletnode/api/gen/http/cascade/client/encode_decode.go

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

4 changes: 2 additions & 2 deletions walletnode/api/gen/http/cascade/client/paths.go

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

12 changes: 6 additions & 6 deletions walletnode/api/gen/http/cascade/server/encode_decode.go

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

4 changes: 2 additions & 2 deletions walletnode/api/gen/http/cascade/server/paths.go

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

8 changes: 4 additions & 4 deletions walletnode/api/gen/http/cascade/server/server.go

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

4 changes: 2 additions & 2 deletions walletnode/api/gen/http/cascade/server/types.go

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

2 changes: 1 addition & 1 deletion walletnode/api/gen/http/openapi.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions walletnode/api/gen/http/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -927,17 +927,17 @@ paths:
- http
security:
- api_key_header_Authorization: []
/openapi/cascade/registration_details/{file_id}:
/openapi/cascade/registration_details/{base_file_id}:
get:
tags:
- cascade
summary: Get the file registration details
description: Get the file registration details
operationId: cascade#registrationDetails
parameters:
- name: file_id
- name: base_file_id
in: path
description: file ID
description: Base file ID
required: true
type: string
maxLength: 8
Expand Down
2 changes: 1 addition & 1 deletion walletnode/api/gen/http/openapi3.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions walletnode/api/gen/http/openapi3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1961,21 +1961,21 @@ paths:
$ref: '#/components/schemas/Error'
security:
- api_key_header_Authorization: []
/openapi/cascade/registration_details/{file_id}:
/openapi/cascade/registration_details/{base_file_id}:
get:
tags:
- cascade
summary: Get the file registration details
description: Get the file registration details
operationId: cascade#registrationDetails
parameters:
- name: file_id
- name: base_file_id
in: path
description: file ID
description: Base file ID
required: true
schema:
type: string
description: file ID
description: Base file ID
example: VK7mpAqZ
maxLength: 8
example: VK7mpAqZ
Expand Down
11 changes: 3 additions & 8 deletions walletnode/api/services/cascade.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,15 +398,10 @@ func (service *CascadeAPIHandler) GetTaskHistory(ctx context.Context, p *cascade
}

func (service *CascadeAPIHandler) RegistrationDetails(ctx context.Context, rdp *cascade.RegistrationDetailsPayload) (registrationDetail *cascade.Registration, err error) {
log.WithContext(ctx).WithField("file_id", rdp.FileID).Info("Registration detail api invoked")
defer log.WithContext(ctx).WithField("file_id", rdp.FileID).Info("Finished registration details")
log.WithContext(ctx).WithField("base_file_id", rdp.BaseFileID).Info("Registration detail api invoked")
defer log.WithContext(ctx).WithField("base_file_id", rdp.BaseFileID).Info("Finished registration details")

baseFile, err := service.register.GetFile(rdp.FileID)
if err != nil {
return nil, cascade.MakeInternalServerError(err)
}

relatedFiles, err := service.register.GetFilesByBaseFileID(baseFile.FileID)
relatedFiles, err := service.register.GetFilesByBaseFileID(rdp.BaseFileID)
if err != nil {
return nil, cascade.MakeInternalServerError(err)
}
Expand Down

0 comments on commit 9f6e7d4

Please sign in to comment.