Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use signed URL when persisting FHIR media #433

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading