feat: Cleans up some file names, adds generate admin user command.

This commit is contained in:
2025-01-19 17:07:08 -05:00
parent 185ebbbc15
commit 81f0e03549
10 changed files with 159 additions and 110 deletions

View File

@@ -1,56 +0,0 @@
import CasePathsCore
import DatabaseClientLive
import Dependencies
import Elementary
import ElementaryHTMX
import Fluent
import SharedModels
import Vapor
import VaporElementary
@preconcurrency import VaporRouting
func routes(_ app: Application) throws {
app.mount(
SiteRoute.router,
middleware: { route in
switch route {
case let .api(route):
return route.middleware
case .health:
return nil
case let .view(route):
return route.middleware
}
},
use: siteHandler
)
app.get { _ in
HTMLResponse {
MainPage(displayNav: false, route: .purchaseOrders) {
div(.class("container")) {
h1 { "iT WORKS" }
}
}
}
}
}
private struct LoginContext: Content {
let next: String?
}
@Sendable
func siteHandler(
request: Request,
route: SiteRoute
) async throws -> any AsyncResponseEncodable {
switch route {
case let .api(route):
return try await route.handle(request: request)
case .health:
return HTTPStatus.ok
case let .view(route):
return try await route.handle(request: request)
}
}