feat: Begins integrating url routing.

This commit is contained in:
2025-12-29 09:23:08 -05:00
parent 861ff3bfd6
commit 6bc6a7d7fa
7 changed files with 71 additions and 4 deletions

View File

@@ -1,5 +1,5 @@
{ {
"originHash" : "426df0aee89a834f20c1c804ecbfbed0bc19ef629c2a1fd2e6260702b97b6f31", "originHash" : "6db0ff1757d16de886ae50dadf070f0d2ada4d31b5765536ba4266e399ed7a67",
"pins" : [ "pins" : [
{ {
"identity" : "combine-schedulers", "identity" : "combine-schedulers",
@@ -19,6 +19,15 @@
"version" : "0.14.0" "version" : "0.14.0"
} }
}, },
{
"identity" : "swift-case-paths",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-case-paths.git",
"state" : {
"revision" : "6989976265be3f8d2b5802c722f9ba168e227c71",
"version" : "1.7.2"
}
},
{ {
"identity" : "swift-clocks", "identity" : "swift-clocks",
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
@@ -28,6 +37,15 @@
"version" : "1.0.6" "version" : "1.0.6"
} }
}, },
{
"identity" : "swift-collections",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-collections",
"state" : {
"revision" : "7b847a3b7008b2dc2f47ca3110d8c782fb2e5c7e",
"version" : "1.3.0"
}
},
{ {
"identity" : "swift-concurrency-extras", "identity" : "swift-concurrency-extras",
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
@@ -46,6 +64,15 @@
"version" : "1.10.0" "version" : "1.10.0"
} }
}, },
{
"identity" : "swift-parsing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-parsing",
"state" : {
"revision" : "3432cb81164dd3d69a75d0d63205be5fbae2c34b",
"version" : "0.14.1"
}
},
{ {
"identity" : "swift-syntax", "identity" : "swift-syntax",
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
@@ -55,6 +82,15 @@
"version" : "602.0.0" "version" : "602.0.0"
} }
}, },
{
"identity" : "swift-url-routing",
"kind" : "remoteSourceControl",
"location" : "https://github.com/pointfreeco/swift-url-routing.git",
"state" : {
"revision" : "1cfd564259ecb1d324bb718a8f03e513dab738d2",
"version" : "0.6.2"
}
},
{ {
"identity" : "xctest-dynamic-overlay", "identity" : "xctest-dynamic-overlay",
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",

View File

@@ -10,14 +10,21 @@ let package = Package(
.library(name: "ManualDClient", targets: ["ManualDClient"]), .library(name: "ManualDClient", targets: ["ManualDClient"]),
], ],
dependencies: [ dependencies: [
.package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.0.0") .package(url: "https://github.com/pointfreeco/swift-dependencies", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/swift-url-routing.git", from: "0.6.2"),
.package(url: "https://github.com/pointfreeco/swift-case-paths.git", from: "1.6.0"),
], ],
targets: [ targets: [
.target( .target(
name: "swift-manual-d" name: "swift-manual-d"
), ),
.target( .target(
name: "ManualDCore" name: "ManualDCore",
dependencies: [
.product(name: "Dependencies", package: "swift-dependencies"),
.product(name: "URLRouting", package: "swift-url-routing"),
.product(name: "CasePaths", package: "swift-case-paths"),
]
), ),
.target( .target(
name: "ManualDClient", name: "ManualDClient",

View File

@@ -38,6 +38,7 @@ extension ManualDClient: DependencyKey {
}, },
equivalentRectangularDuct: { request in equivalentRectangularDuct: { request in
let width = (Double.pi * (pow(Double(request.roundSize) / 2.0, 2.0))) / Double(request.height) let width = (Double.pi * (pow(Double(request.roundSize) / 2.0, 2.0))) / Double(request.height)
// Round the width up or fail (really should never fail since we know the input is a number).
guard let widthStr = numberFormatter.string(for: width), guard let widthStr = numberFormatter.string(for: width),
let widthInt = Int(widthStr) let widthInt = Int(widthStr)
else { else {

View File

@@ -1,6 +1,6 @@
import Foundation import Foundation
public struct EquipmentInfo: Codable, Equatable { public struct EquipmentInfo: Codable, Equatable, Sendable {
public let staticPressure: Double public let staticPressure: Double
public let heatingCFM: Int public let heatingCFM: Int
public let coolingCFM: Int public let coolingCFM: Int

View File

@@ -0,0 +1,17 @@
import CasePathsCore
import Foundation
@preconcurrency import URLRouting
extension SiteRoute {
/// Represents api routes.
///
/// The routes return json as opposed to view routes that return html.
public enum Api {
public static let rootPath = Path {
"api"
"v1"
}
}
}

View File

@@ -0,0 +1,6 @@
import CasePathsCore
import Foundation
@preconcurrency import URLRouting
public enum SiteRoute {
}