Skip to content

Instantly share code, notes, and snippets.

@justiandre
Last active June 10, 2019 18:47
Show Gist options
  • Save justiandre/f1feeb17be7e083794faa61659cae7a7 to your computer and use it in GitHub Desktop.
Save justiandre/f1feeb17be7e083794faa61659cae7a7 to your computer and use it in GitHub Desktop.
func (h *httpHandler) PostByPrinterType(w http.ResponseWriter, r *http.Request) {
     printerType := server.URLParam(r, "printertype")
     if err := h.validatePrinterType(printerType, r); err == nil {
          if printerRequest, err := h.validatePost(r); err == nil {
               if err = h.service.PrintByWorkstation(r.Context(), printerRequest, printerType); err == nil {
                    logger.Info(endpointLog).Log("PrintByWorkstation Succeeded",
                         "shipment_id", printerRequest.ShipmentID, "workstation_id", printerRequest.WorkstationID,
                         "warehouse_id", printerRequest.WarehouseID, "status", http.StatusOK)
                    w.WriteHeader(http.StatusOK)
               } else {
                    render.Render(w, r, err)
               }
          } else {
               render.Render(w, r, err)
          }
     } else {
          render.Render(w, r, err)
     }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment