feat: Adds attic ventilation calculation.
This commit is contained in:
@@ -23,6 +23,7 @@ public extension SiteRoute {
|
||||
|
||||
enum Api: Equatable, Sendable {
|
||||
|
||||
case calculateAtticVentilation(AtticVentilation.Request)
|
||||
case calculateCapacitor(Capacitor.Request)
|
||||
case calculateDehumidifierSize(DehumidifierSize.Request)
|
||||
case calculateHVACSystemPerformance(HVACSystemPerformance.Request)
|
||||
@@ -32,6 +33,11 @@ public extension SiteRoute {
|
||||
static let rootPath = Path { "api"; "v1" }
|
||||
|
||||
public static let router = OneOf {
|
||||
Route(.case(Self.calculateAtticVentilation)) {
|
||||
Path { "api"; "v1"; "calculateAtticPressure" }
|
||||
Method.post
|
||||
Body(.json(AtticVentilation.Request.self))
|
||||
}
|
||||
Route(.case(Self.calculateCapacitor)) {
|
||||
Path { "api"; "v1"; "calculateRoomPressure" }
|
||||
Method.post
|
||||
@@ -75,6 +81,7 @@ public extension SiteRoute {
|
||||
enum View: Equatable, Sendable {
|
||||
|
||||
case index
|
||||
case atticVentilation(AtticVentilation)
|
||||
case capacitor(Capacitor)
|
||||
case dehumidifierSize(DehumidifierSize)
|
||||
case hvacSystemPerformance(HVACSystemPerformance)
|
||||
@@ -85,6 +92,9 @@ public extension SiteRoute {
|
||||
Route(.case(Self.index)) {
|
||||
Method.get
|
||||
}
|
||||
Route(.case(Self.atticVentilation)) {
|
||||
AtticVentilation.router
|
||||
}
|
||||
Route(.case(Self.capacitor)) {
|
||||
Capacitor.router
|
||||
}
|
||||
@@ -102,6 +112,37 @@ public extension SiteRoute {
|
||||
}
|
||||
}
|
||||
|
||||
public enum AtticVentilation: Equatable, Sendable {
|
||||
case index
|
||||
case submit(Routes.AtticVentilation.Request)
|
||||
|
||||
static let rootPath = "attic-ventilation"
|
||||
|
||||
public static let router = OneOf {
|
||||
Route(.case(Self.index)) {
|
||||
Path { rootPath }
|
||||
Method.get
|
||||
}
|
||||
Route(.case(Self.submit)) {
|
||||
Path { rootPath }
|
||||
Method.post
|
||||
Body {
|
||||
FormData {
|
||||
Field("pressureDifferential") { Double.parser() }
|
||||
Field("outdoorTemperature") { Double.parser() }
|
||||
Field("outdoorDewpoint") { Double.parser() }
|
||||
Field("atticTemperature") { Double.parser() }
|
||||
Field("atticDewpoint") { Double.parser() }
|
||||
Field("atticFloorArea") { Double.parser() }
|
||||
Optionally { Field("existingIntakeArea") { Double.parser() } }
|
||||
Optionally { Field("existingExhaustArea") { Double.parser() } }
|
||||
}
|
||||
.map(.memberwise(Routes.AtticVentilation.Request.init))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum Capacitor: Equatable, Sendable {
|
||||
case index(mode: Routes.Capacitor.Mode? = nil)
|
||||
case submit(Routes.Capacitor.Request)
|
||||
|
||||
Reference in New Issue
Block a user