feat: Working on route and id helpers for views.

This commit is contained in:
2025-01-17 23:50:04 -05:00
parent 531a385dba
commit d8328314ed
21 changed files with 585 additions and 255 deletions

View File

@@ -13,6 +13,7 @@ func routes(_ app: Application) throws {
try app.register(collection: VendorViewController())
try app.register(collection: EmployeeViewController())
try app.register(collection: PurchaseOrderViewController())
try app.register(collection: PurchaseOrderSearchViewController())
try app.register(collection: UtilsViewController())
app.get { _ in
@@ -56,18 +57,6 @@ func routes(_ app: Application) throws {
}
}
}
let protected = app.grouped(UserPasswordAuthenticator(), UserSessionAuthenticator())
protected.get("me") { req in
let user = try req.auth.require(User.self)
return HTMLResponse {
MainPage(displayNav: false, route: .purchaseOrders) {
h1 { "You are logged in as: \(user.username)" }
}
}
}
}
private struct LoginContext: Content {