feat: Adds reset password api route, needs associated view route.
This commit is contained in:
@@ -121,6 +121,7 @@ public extension SiteRoute {
|
||||
case create(User.Create)
|
||||
case get(id: User.ID)
|
||||
case index
|
||||
case resetPassword(id: User.ID, request: User.ResetPassword)
|
||||
case update(id: User.ID, updates: User.Update)
|
||||
|
||||
static let rootPath = "users"
|
||||
@@ -143,6 +144,11 @@ public extension SiteRoute {
|
||||
Path { rootPath }
|
||||
Method.get
|
||||
}
|
||||
Route(.case(Self.resetPassword(id:request:))) {
|
||||
Path { rootPath; User.ID.parser(); "reset-password" }
|
||||
Method.patch
|
||||
Body(.json(User.ResetPassword.self))
|
||||
}
|
||||
Route(.case(Self.update(id:updates:))) {
|
||||
Path { rootPath; User.ID.parser() }
|
||||
Method.patch
|
||||
|
||||
@@ -61,6 +61,19 @@ public extension User {
|
||||
}
|
||||
}
|
||||
|
||||
struct ResetPassword: Codable, Equatable, Sendable {
|
||||
public let password: String
|
||||
public let confirmPassword: String
|
||||
|
||||
public init(
|
||||
password: String,
|
||||
confirmPassword: String
|
||||
) {
|
||||
self.password = password
|
||||
self.confirmPassword = confirmPassword
|
||||
}
|
||||
}
|
||||
|
||||
struct Token: Codable, Equatable, Identifiable, Sendable {
|
||||
public let id: UUID
|
||||
public let userID: User.ID
|
||||
|
||||
Reference in New Issue
Block a user