Removed utils mod, moved hexing the name to entity library
This commit is contained in:
@ -16,3 +16,4 @@ sqlx = { version = "0.7", features = [
|
||||
"macros",
|
||||
"migrate",
|
||||
], default-features = false }
|
||||
hex = "0.4"
|
||||
|
@ -93,13 +93,14 @@ impl Account {
|
||||
.map(|_| ())
|
||||
}
|
||||
|
||||
/// Gets a name by a hex of a SHA256 hash of the name
|
||||
/// Gets a name by a SHA256 hash of the name
|
||||
#[inline]
|
||||
pub async fn get_name_by_hash(
|
||||
user_id: u64,
|
||||
hash: String,
|
||||
hash: &[u8],
|
||||
pool: &Pool,
|
||||
) -> crate::Result<Option<String>> {
|
||||
let hash = hex::encode(hash);
|
||||
let name = query_as::<_, (String,)>(
|
||||
"SELECT `name` FROM `account` WHERE SHA2(`name`, 256) = ? AND `user_id` = ?;",
|
||||
)
|
||||
|
Reference in New Issue
Block a user