feat: Initial csv parsing for uploading rooms for a project. Need to style the upload form.
All checks were successful
CI / Linux Tests (push) Successful in 5m41s

This commit is contained in:
2026-02-05 16:39:40 -05:00
parent b2b5e32535
commit 57766c990e
16 changed files with 226 additions and 117 deletions

View File

@@ -188,6 +188,7 @@ extension SiteRoute.View.ProjectRoute {
}
public enum RoomRoute: Equatable, Sendable {
case csv(Room.CSV)
case delete(id: Room.ID)
case index
case submit(Room.Create)
@@ -197,6 +198,23 @@ extension SiteRoute.View.ProjectRoute {
static let rootPath = "rooms"
public static let router = OneOf {
Route(.case(Self.csv)) {
Path {
rootPath
"csv"
}
Headers {
Field("Content-Type") { "multipart/form-data" }
}
Method.post
Body().map(.memberwise(Room.CSV.init))
// Body {
// FormData {
//
// }
// .map(.memberwise(Room.CSV.init))
// }
}
Route(.case(Self.delete)) {
Path {
rootPath
@@ -215,7 +233,7 @@ extension SiteRoute.View.ProjectRoute {
Method.post
Body {
FormData {
Field("projectID") { Project.ID.parser() }
// Field("projectID") { Project.ID.parser() }
Field("name", .string)
Field("heatingLoad") { Double.parser() }
Optionally {