feat: Adds docker support to start building views.

This commit is contained in:
2025-12-30 13:41:25 -05:00
parent 79ea188e07
commit 2bbff896c9
11 changed files with 174 additions and 10 deletions

View File

@@ -14,7 +14,6 @@ extension SiteRoute.Api {
return try await route.respond(logger: logger)
case .componentLoss(let route):
return try await route.respond(logger: logger)
}
}
}

View File

@@ -17,7 +17,7 @@ struct DependenciesMiddleware: AsyncMiddleware {
init(
database: DatabaseClient,
apiController: ApiController = .liveValue,
viewController: ViewController = .testValue
viewController: ViewController = .liveValue
) {
self.values = withEscapedDependencies { $0 }
self.apiController = apiController

View File

@@ -21,7 +21,7 @@ public func configure(
addMiddleware(to: app, database: databaseClient)
#if DEBUG
// Live reload of the application for development when launched with the `./swift-dev` command
app.lifecycle.use(BrowserSyncHandler())
// app.lifecycle.use(BrowserSyncHandler())
#endif
// Add our route handlers.
addRoutes(to: app)
@@ -72,10 +72,10 @@ private func setupDatabase(
}
private func addRoutes(to app: Application) {
// Redirect the index path to purchase order route.
// app.get { req in
// req.redirect(to: SiteRoute.View.router.path(for: .purchaseOrder(.index)))
// }
// Redirect the index path to project route.
app.get { req in
req.redirect(to: SiteRoute.View.router.path(for: .project(.index)))
}
app.mount(
SiteRoute.router,

View File

@@ -83,7 +83,6 @@ extension ComponentPressureLoss {
.field("createdAt", .datetime)
.field("updatedAt", .datetime)
.field("projectID", .uuid, .required, .references(ProjectModel.schema, "id"))
// .foreignKey("projectID", references: ProjectModel.schema, "id", onDelete: .cascade)
.unique(on: "projectID", "name")
.create()
}

View File

@@ -9,7 +9,7 @@ extension SiteRoute {
public enum View: Equatable, Sendable {
case project(ProjectRoute)
static let router = OneOf {
public static let router = OneOf {
Route(.case(Self.project)) {
SiteRoute.View.ProjectRoute.router
}

View File

@@ -38,6 +38,18 @@ extension ViewController {
}
}
extension ViewController: TestDependencyKey {
extension ViewController: DependencyKey {
public static let testValue = Self()
// FIX: Fix.
public static let liveValue = Self(
view: { _ in
return MainPage {
div {
h1 { "It works!" }
h2 { "Browser sync works!" }
}
}
}
)
}