|
|
|
|
@ -131,25 +131,17 @@ async def get_all(
|
|
|
|
|
|
|
|
|
|
results.append(res)
|
|
|
|
|
|
|
|
|
|
# Pagination parameters
|
|
|
|
|
page = common.get("page", 1)
|
|
|
|
|
items_per_page = common.get("items_per_page", 10)
|
|
|
|
|
# # Pagination parameters
|
|
|
|
|
# page = common.get("page", 1)
|
|
|
|
|
# items_per_page = common.get("items_per_page", 10)
|
|
|
|
|
|
|
|
|
|
# Sort by overhaul_cost descending
|
|
|
|
|
results.sort(key=lambda x: x.overhaul_cost, reverse=True)
|
|
|
|
|
|
|
|
|
|
# Apply pagination
|
|
|
|
|
start_index = (page - 1) * items_per_page
|
|
|
|
|
end_index = start_index + items_per_page
|
|
|
|
|
paginated_results = results[start_index:end_index]
|
|
|
|
|
|
|
|
|
|
# Build response data
|
|
|
|
|
data = {
|
|
|
|
|
"items": paginated_results,
|
|
|
|
|
"itemsPerPage": items_per_page,
|
|
|
|
|
"page": page,
|
|
|
|
|
"items": results,
|
|
|
|
|
"total": len(results),
|
|
|
|
|
"totalPages": (len(results) + items_per_page - 1) // items_per_page,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return data
|
|
|
|
|
|