Skip to content

Commit

Permalink
chore: format referral report file name
Browse files Browse the repository at this point in the history
  • Loading branch information
Salaton committed Apr 8, 2024
1 parent 87c40ec commit 74397e0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/clinical/usecases/clinical/referral_report.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (c *UseCasesClinicalImpl) GenerateReferralReportPDF(ctx context.Context, se
}

data := TemplateData{
Date: time.Now().Format("Monday Jan 2 2023"),
Date: time.Now().Format("Monday, Jan 2, 2006"),
Time: time.Now().Format("15:04"),
Patient: patientData,
NextOfKin: NextOfKin{},
Expand Down Expand Up @@ -194,7 +194,10 @@ func (c *UseCasesClinicalImpl) GenerateReferralReportPDF(ctx context.Context, se

pdfBytes := pdfg.Bytes()

_, err = c.infrastructure.Upload.UploadMedia(ctx, "referral_report_1", bytes.NewReader(pdfBytes), "")
currentTime := time.Now().Format("20060102T150405")
filename := fmt.Sprintf("%s_%s.pdf", patientData.Name, currentTime)

_, err = c.infrastructure.Upload.UploadMedia(ctx, filename, bytes.NewReader(pdfBytes), "")
if err != nil {
utils.ReportErrorToSentry(err)
return nil, err
Expand Down

0 comments on commit 74397e0

Please sign in to comment.