WIP: Begins rooms table.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user