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

@@ -10,14 +10,14 @@ extension DatabaseClient.Rooms: TestDependencyKey {
public static func live(database: any Database) -> Self {
.init(
create: { request in
let model = try request.toModel()
create: { projectID, request in
let model = try request.toModel(projectID: projectID)
try await model.validateAndSave(on: database)
return try model.toDTO()
},
createMany: { rooms in
createMany: { projectID, rooms in
try await rooms.asyncMap { request in
let model = try request.toModel()
let model = try request.toModel(projectID: projectID)
try await model.validateAndSave(on: database)
return try model.toDTO()
}
@@ -83,7 +83,7 @@ extension DatabaseClient.Rooms: TestDependencyKey {
extension Room.Create {
func toModel() throws -> RoomModel {
func toModel(projectID: Project.ID) throws -> RoomModel {
return .init(
name: name,
heatingLoad: heatingLoad,