feat: Working on layout / css.
This commit is contained in:
@@ -66,6 +66,23 @@ public extension DatabaseClient.Users {
|
||||
}
|
||||
|
||||
return try token.toDTO()
|
||||
} update: { id, updates in
|
||||
guard let user = try await UserModel.find(id, on: database) else {
|
||||
throw Abort(.notFound)
|
||||
}
|
||||
var hasChanges = false
|
||||
if let username = updates.username {
|
||||
hasChanges = true
|
||||
user.username = username
|
||||
}
|
||||
if let email = updates.email {
|
||||
hasChanges = true
|
||||
user.email = email
|
||||
}
|
||||
|
||||
guard hasChanges else { return try user.toDTO() }
|
||||
try await user.save(on: database)
|
||||
return try user.toDTO()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user