WIP: Changes main page to not include sidebar, that moves to project view.
This commit is contained in:
28
Sources/ViewController/Extensions/DatabaseExtensions.swift
Normal file
28
Sources/ViewController/Extensions/DatabaseExtensions.swift
Normal file
@@ -0,0 +1,28 @@
|
||||
import DatabaseClient
|
||||
import Fluent
|
||||
import ManualDCore
|
||||
import Vapor
|
||||
|
||||
extension DatabaseClient.Projects {
|
||||
|
||||
func fetchPage(
|
||||
userID: User.ID,
|
||||
page: Int = 1,
|
||||
limit: Int = 25
|
||||
) async throws -> Page<Project> {
|
||||
try await fetch(userID, .init(page: page, per: limit))
|
||||
}
|
||||
|
||||
func fetchPage(
|
||||
userID: User.ID,
|
||||
page: PageRequest
|
||||
) async throws -> Page<Project> {
|
||||
try await fetch(userID, page)
|
||||
}
|
||||
}
|
||||
|
||||
extension PageRequest {
|
||||
static func next<T>(_ currentPage: Page<T>) -> Self {
|
||||
.init(page: currentPage.metadata.page + 1, per: currentPage.metadata.per)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user