Update routes.swift
This commit is contained in:
parent
aa5ee6ee70
commit
75f40e9c9e
@ -2,18 +2,26 @@ import Routing
|
||||
import Vapor
|
||||
import SQLite
|
||||
|
||||
private let fm = FileManager.default
|
||||
// MARK: Paths
|
||||
|
||||
private let baseFolder = URL(fileURLWithPath: "/caps")
|
||||
|
||||
private let imageFolder = URL(fileURLWithPath: "/caps/Public/images")
|
||||
private let publicFolder = baseFolder.appendingPathComponent("Public")
|
||||
|
||||
private let dbFile = "/caps/db.sqlite3"
|
||||
private let imageFolder = publicFolder.appendingPathComponent("images")
|
||||
|
||||
private let tempImageFile = imageFolder.appendingPathComponent("temp.jpg")
|
||||
private let dbFile = publicFolder.appendingPathComponent("db.sqlite3").path
|
||||
|
||||
private let tempImageFile = publicFolder.appendingPathComponent("temp.jpg")
|
||||
|
||||
// MARK: Variables
|
||||
|
||||
private let fm = FileManager.default
|
||||
|
||||
private var db: Connection!
|
||||
|
||||
// MARK: SQLite
|
||||
|
||||
private let id = Expression<Int>("id")
|
||||
|
||||
private let name = Expression<String>("name")
|
||||
@ -24,6 +32,8 @@ func loadDatabase() throws {
|
||||
db = try Connection(dbFile)
|
||||
}
|
||||
|
||||
// MARK: Helper
|
||||
|
||||
private func select(_ cap: Int) -> Table {
|
||||
table.filter(id == cap)
|
||||
}
|
||||
@ -48,6 +58,8 @@ private func count(of cap: Int) throws -> Int {
|
||||
return try countImages(in: f)
|
||||
}
|
||||
|
||||
// MARK: Routes
|
||||
|
||||
/// Register your application's routes here.
|
||||
///
|
||||
/// [Learn More →](https://docs.vapor.codes/3.0/getting-started/structure/#routesswift)
|
||||
|
Loading…
Reference in New Issue
Block a user