Skip to content

Commit

Permalink
chore: use signed URL when persisting FHIR media
Browse files Browse the repository at this point in the history
Signed-off-by: Kathurima Kimathi <[email protected]>
  • Loading branch information
KathurimaKimathi committed Apr 16, 2024
1 parent 419a7fd commit cc20dd5
Show file tree
Hide file tree
Showing 7 changed files with 179 additions and 3 deletions.
6 changes: 6 additions & 0 deletions pkg/clinical/application/dto/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"mime/multipart"
"time"

"github.com/99designs/gqlgen/graphql"
"github.com/go-playground/validator"
"github.com/savannahghi/scalarutils"
)
Expand Down Expand Up @@ -286,3 +287,8 @@ func (r ReferralInput) Validate() error {

return err
}

type MediaFileInput struct {
EncounterID string `json:"encounterID"`
File graphql.Upload
}
2 changes: 2 additions & 0 deletions pkg/clinical/presentation/graph/clinical.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,6 @@ extend type Mutation {
referPatient(input: ReferralInput!): ServiceRequest!

shareReferralForm(serviceRequestID: ID!, workstationID: String!): Boolean!

uploadMedia(input: MediaFileInput!): Boolean!
}
6 changes: 6 additions & 0 deletions pkg/clinical/presentation/graph/clinical.resolvers.go

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

2 changes: 1 addition & 1 deletion pkg/clinical/presentation/graph/external.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ scalar UnsignedInt
scalar URI
scalar UUID
scalar XHTML

scalar Upload
159 changes: 158 additions & 1 deletion pkg/clinical/presentation/graph/generated/generated.go

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

5 changes: 5 additions & 0 deletions pkg/clinical/presentation/graph/inputs.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,9 @@ input FacilityInput {
name: String!
county: String!
contact: String
}

input MediaFileInput {
encounterID: String!
file: Upload!
}
2 changes: 1 addition & 1 deletion pkg/clinical/usecases/clinical/media.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func (c *UseCasesClinicalImpl) UploadMedia(ctx context.Context, encounterID stri
},
Content: &domain.FHIRAttachmentInput{
ContentType: (*scalarutils.Code)(&mediaUploadOutput.ContentType),
URL: (*scalarutils.URL)(&mediaUploadOutput.MediaLink),
URL: (*scalarutils.URL)(&mediaUploadOutput.SignedURL),
Title: &mediaUploadOutput.Name,
},
Issued: &now,
Expand Down

0 comments on commit cc20dd5

Please sign in to comment.