This commit is contained in:
icanotc 2023-08-25 18:00:44 -04:00
parent 3e2588da59
commit f9f3612e2f
2 changed files with 10 additions and 6 deletions

View file

@ -87,9 +87,9 @@ func (ctrl *V1Controller) HandleGenerateQRCode() errchain.HandlerFunc {
// //
// @Summary Create PDF of QR codes of a location // @Summary Create PDF of QR codes of a location
// @Tags Items // @Tags Items
// @Produce pdf // @Produce application/pdf
// @Param location_id path string true "UUID of the location" // @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" // @Success 200 {string} string "application/pdf"
// @Router /v1/qrcode/{location_id} [GET] // @Router /v1/qrcode/{location_id} [GET]
// @Security Bearer // @Security Bearer
@ -122,9 +122,9 @@ func (ctrl *V1Controller) HandleGenerateQRCodeForLocations() errchain.HandlerFun
var URLs []string var URLs []string
if *data.Nested { //if *data.Nested {
//
} //}
if data.PrintType == "items" { if data.PrintType == "items" {
for _, thing := range locations.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 // Return the concatenated QR code images as a response
w.Header().Set("Content-Type", "application/pdf") 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) fmt.Printf("%v", URLs)
//_, err = w.Write([]byte(fmt.Sprintf("%v", URLs))) //_, err = w.Write([]byte(fmt.Sprintf("%v", URLs)))

View file

@ -146,6 +146,10 @@ func (a *app) mountRoutes(r *chi.Mux, chain *errchain.ErrChain, repos *repo.AllR
v1Base("/qrcode"), v1Base("/qrcode"),
chain.ToHandlerFunc(v1Ctrl.HandleGenerateQRCode(), assetMW...), chain.ToHandlerFunc(v1Ctrl.HandleGenerateQRCode(), assetMW...),
) )
r.Get(
v1Base("/qrcode/{location_id}"),
chain.ToHandlerFunc(v1Ctrl.HandleGenerateQRCodeForLocations(), assetMW...),
)
r.Get( r.Get(
v1Base("/items/{id}/attachments/{attachment_id}"), v1Base("/items/{id}/attachments/{attachment_id}"),
chain.ToHandlerFunc(v1Ctrl.HandleItemAttachmentGet(), assetMW...), chain.ToHandlerFunc(v1Ctrl.HandleItemAttachmentGet(), assetMW...),