fix prod api
This commit is contained in:
parent
9633983dec
commit
bd46d5ae52
@ -496,19 +496,18 @@ object ProductCtrl {
|
||||
?: throw NotFoundResponse("Product not found for $id")
|
||||
ctx.json(product).status(HttpStatus.OK)
|
||||
}
|
||||
|
||||
data class PF(val common: CommonFilters, val productFilters: ProductFilters)
|
||||
fun getAll(ctx: Context) {
|
||||
val productList = database.find(Product::class.java)
|
||||
.findList()
|
||||
.sortedBy { it.name }
|
||||
val filters = ctx.bodyAsClass<PF>()
|
||||
val prods = searchProducts(filters.common, filters.productFilters)
|
||||
val excel = ctx.queryParam("excel")
|
||||
if(excel != null){
|
||||
exportProds(productList)
|
||||
exportProds(prods)
|
||||
val inputStream = FileInputStream("./excel/Products.xls")
|
||||
ctx.result(inputStream).status(HttpStatus.OK)
|
||||
|
||||
}else{
|
||||
ctx.json(productList).status(HttpStatus.OK)
|
||||
ctx.json(prods).status(HttpStatus.OK)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user