-
Notifications
You must be signed in to change notification settings - Fork 1
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
Adds the endpoint to obtain a product list report of the chosen products by id #460
base: master
Are you sure you want to change the base?
Conversation
SonarCloud Quality Gate failed. |
The sonar analysis is failed, no test coverage 😞 |
@@ -139,6 +143,18 @@ public void getListaDePrecios( | |||
} | |||
} | |||
|
|||
@GetMapping("/productos/reporte") | |||
public ResponseEntity<byte[]> getListaProductosSeleccionados( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The response should be sent by email
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The use case doesn't require the response to be send by email, the requirement is obtain a report of the chosen products the same way that others like Factura and Pedidos do, the email one it's beacause usualy whitout a product selection the list is to big and the request take to long
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the user selects X (a very big number) products and sends the request? It's gonna crush. We need to cover all possible scenarios
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happens that the access to the business email account it's only to very few people, and the new feature it's to vendedor use as "Presupuesto". Now I notice a problem, to use this as a vendedor we have to let it access to the product administration list, then the real solution it's to have a real "Presupuesto" report, this do not solve the original problem and carry a new one.
@GetMapping("/productos/reporte") | ||
public ResponseEntity<byte[]> getListaProductosSeleccionados( | ||
@RequestParam long[] idProducto) { | ||
HttpHeaders headers = new HttpHeaders(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use "var" instead
headers.setContentType(MediaType.APPLICATION_PDF); | ||
headers.add("content-disposition", "inline; filename=ProductList.pdf"); | ||
headers.setCacheControl("must-revalidate, post-check=0, pre-check=0"); | ||
byte[] reportePDF = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use "var" instead, and all in one line
public byte[] getListaDePreciosEnPdf(long[] idProductos) { | ||
var productos = new ArrayList<Producto>(); | ||
for (long idProducto : idProductos) { | ||
productos.add(this.getProductoNoEliminadoPorId(idProducto)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very inefficient. The query should be something like SELECT xxxx FROM xxxx WHERE IN .....
Kudos, SonarCloud Quality Gate passed!
|
No description provided.