From f9f3612e2f689fad0426fbc188000bff12221d7c Mon Sep 17 00:00:00 2001 From: icanotc <44480394+icanotc@users.noreply.github.com> Date: Fri, 25 Aug 2023 18:00:44 -0400 Subject: [PATCH] pr fixes --- backend/app/api/handlers/v1/v1_ctrl_qrcode.go | 12 ++++++------ backend/app/api/routes.go | 4 ++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/backend/app/api/handlers/v1/v1_ctrl_qrcode.go b/backend/app/api/handlers/v1/v1_ctrl_qrcode.go index 40a5c11..e3c1da9 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_qrcode.go +++ b/backend/app/api/handlers/v1/v1_ctrl_qrcode.go @@ -87,9 +87,9 @@ func (ctrl *V1Controller) HandleGenerateQRCode() errchain.HandlerFunc { // // @Summary Create PDF of QR codes of a location // @Tags Items -// @Produce pdf +// @Produce application/pdf // @Param location_id path string true "UUID of the location" -// @Param page query PageQuery true "query info for how the QR codes are generated" +// @Param page query pageQuery true "query info for how the QR codes are generated" // @Success 200 {string} string "application/pdf" // @Router /v1/qrcode/{location_id} [GET] // @Security Bearer @@ -122,9 +122,9 @@ func (ctrl *V1Controller) HandleGenerateQRCodeForLocations() errchain.HandlerFun var URLs []string - if *data.Nested { - - } + //if *data.Nested { + // + //} if data.PrintType == "items" { for _, thing := range locations.Items { @@ -199,7 +199,7 @@ func (ctrl *V1Controller) HandleGenerateQRCodeForLocations() errchain.HandlerFun // Return the concatenated QR code images as a response w.Header().Set("Content-Type", "application/pdf") - w.Header().Set("Content-Disposition", "inline; filename=qrCodes.pdf") + w.Header().Set("Content-Disposition", "attachment; filename=qrCodes.pdf") fmt.Printf("%v", URLs) //_, err = w.Write([]byte(fmt.Sprintf("%v", URLs))) diff --git a/backend/app/api/routes.go b/backend/app/api/routes.go index 0958341..49b6cdc 100644 --- a/backend/app/api/routes.go +++ b/backend/app/api/routes.go @@ -146,6 +146,10 @@ func (a *app) mountRoutes(r *chi.Mux, chain *errchain.ErrChain, repos *repo.AllR v1Base("/qrcode"), chain.ToHandlerFunc(v1Ctrl.HandleGenerateQRCode(), assetMW...), ) + r.Get( + v1Base("/qrcode/{location_id}"), + chain.ToHandlerFunc(v1Ctrl.HandleGenerateQRCodeForLocations(), assetMW...), + ) r.Get( v1Base("/items/{id}/attachments/{attachment_id}"), chain.ToHandlerFunc(v1Ctrl.HandleItemAttachmentGet(), assetMW...),