WIP: Begins rooms table.

This commit is contained in:
2025-12-31 10:01:39 -05:00
parent 231f1b8de6
commit c29e1acffe
7 changed files with 192 additions and 15 deletions

View File

@@ -1,3 +1,4 @@
import Dependencies
import Foundation
public struct Room: Codable, Equatable, Identifiable, Sendable {
@@ -59,3 +60,42 @@ extension Room {
}
}
}
#if DEBUG
extension Room {
public static let mocks = [
Room(
id: UUID(0),
projectID: UUID(0),
name: "Test",
heatingLoad: 12345,
coolingLoad: .init(total: 12345, sensible: 12345),
registerCount: 2,
createdAt: Date(),
updatedAt: Date()
),
Room(
id: UUID(1),
projectID: UUID(1),
name: "Test",
heatingLoad: 12345,
coolingLoad: .init(total: 12345, sensible: 12345),
registerCount: 2,
createdAt: Date(),
updatedAt: Date()
),
Room(
id: UUID(2),
projectID: UUID(2),
name: "Test",
heatingLoad: 12345,
coolingLoad: .init(total: 12345, sensible: 12345),
registerCount: 2,
createdAt: Date(),
updatedAt: Date()
),
]
}
#endif

View File

@@ -8,11 +8,15 @@ extension SiteRoute {
/// The routes return html.
public enum View: Equatable, Sendable {
case project(ProjectRoute)
case room(RoomRoute)
public static let router = OneOf {
Route(.case(Self.project)) {
SiteRoute.View.ProjectRoute.router
}
Route(.case(Self.room)) {
SiteRoute.View.RoomRoute.router
}
}
}
}
@@ -54,3 +58,18 @@ extension SiteRoute.View {
}
}
}
extension SiteRoute.View {
public enum RoomRoute: Equatable, Sendable {
case form
static let rootPath = "rooms"
public static let router = OneOf {
Route(.case(Self.form)) {
Path { rootPath }
Method.get
}
}
}
}