|
- import Vapor
-
- func routes(_ app: Application) throws {
- let fuelEntryController = FuelEntryController()
-
- app.get("fuel-entries") { req in
- try await fuelEntryController.index(req: req)
- }
-
- app.post("fuel-entries") { req in
- try await fuelEntryController.create(req: req)
- }
-
- app.delete("fuel-entries", ":fuelEntryID") { req in
- try await fuelEntryController.delete(req: req)
- }
-
- // V2 API routes with image upload
- let v2Routes = app.group("api", "v2") { v2 in
- let fuelEntryV2Controller = FuelEntryV2Controller()
-
- v2.get("fuel-entries") {req in
- try await fuelEntryV2Controller.index(req: req)
- }
-
- // v2.get("fuel-entries", "with-images") {req in
- // try await fuelEntryV2Controller.getAllEntriesWithImages(req: req)
- // }
-
- v2.post("fuel-entries") {req in
- try await fuelEntryV2Controller.create(req: req)
- }
-
- // v2.post("fuel-entries", ":id", "upload-image") { req -> FuelEntry in
- // return try await fuelEntryV2Controller.uploadImage(req: req)
- // }
-
- v2.delete("fuel-entries", ":fuelEntryID") { req in
- try await fuelEntryV2Controller.delete(req: req)
- }
- }
- }
-
|