feat: Working on adding updates to project form, it's currently not loading an existing project.

This commit is contained in:
2026-01-05 17:04:25 -05:00
parent 4c8a23be94
commit fc12e47b5c
9 changed files with 178 additions and 35 deletions

View File

@@ -35,9 +35,10 @@ extension SiteRoute.View {
case create(Project.Create)
case delete(id: Project.ID)
case detail(Project.ID, DetailRoute)
case form(dismiss: Bool = false)
case form(id: Project.ID? = nil, dismiss: Bool = false)
case index
case page(PageRequest)
case update(Project.Update)
public static func page(page: Int, per limit: Int) -> Self {
.page(.init(page: page, per: limit))
@@ -81,6 +82,9 @@ extension SiteRoute.View {
}
Method.get
Query {
Optionally {
Field("id", default: nil) { Project.ID.parser() }
}
Field("dismiss", default: false) { Bool.parser() }
}
}
@@ -100,6 +104,31 @@ extension SiteRoute.View {
}
.map(.memberwise(PageRequest.init))
}
Route(.case(Self.update)) {
Path { rootPath }
Method.patch
Body {
FormData {
Field("id") { Project.ID.parser() }
Optionally {
Field("name", .string)
}
Optionally {
Field("streetAddress", .string)
}
Optionally {
Field("city", .string)
}
Optionally {
Field("state", .string)
}
Optionally {
Field("zipCode", .string)
}
}
.map(.memberwise(Project.Update.init))
}
}
}
}
}