|
|
|
@@ -6,6 +6,7 @@ |
|
|
|
// |
|
|
|
|
|
|
|
import Vapor |
|
|
|
import FluentKit |
|
|
|
|
|
|
|
struct FuelEntryV2Controller: RouteCollection { |
|
|
|
func boot(routes: RoutesBuilder) throws { |
|
|
|
@@ -19,8 +20,8 @@ struct FuelEntryV2Controller: RouteCollection { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func index(req: Request) async throws -> [FuelEntry] { |
|
|
|
try await FuelEntry.query(on: req.db).all() |
|
|
|
func index(req: Request) async throws -> Page<FuelEntry> { |
|
|
|
try await FuelEntry.query(on: req.db).paginate(for: req) |
|
|
|
} |
|
|
|
|
|
|
|
// func getAllEntriesWithImages(req: Request) async throws -> [FuelEntry] { |
|
|
|
@@ -109,6 +110,17 @@ struct FuelEntryV2Controller: RouteCollection { |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
struct PageRequest: Content { |
|
|
|
var page: Int |
|
|
|
var size: Int |
|
|
|
// Add any other properties needed for pagination |
|
|
|
|
|
|
|
init(page: Int, size: Int) { |
|
|
|
self.page = page |
|
|
|
self.size = size |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|