refactor(backend): replace String with &str in fn params

This commit is contained in:
2026-05-30 00:36:35 +03:00
parent c310d69b11
commit 882b28c883
4 changed files with 54 additions and 56 deletions

View File

@@ -9,7 +9,9 @@ use sqlx::types::uuid;
use tracing::info;
use crate::{
ctx::Ctx, error::LoftError, model::{FileRecord, FileRepository}
ctx::Ctx,
error::LoftError,
model::{FileRecord, FileRepository},
};
pub fn routes_file(file_repository: FileRepository) -> Router {
@@ -82,7 +84,7 @@ async fn delete_file(
async fn list_files(
State(file_repository): State<FileRepository>,
ctx: Ctx
ctx: Ctx,
) -> Result<Json<Vec<FileRecord>>, LoftError> {
info!("handler: list_files");
@@ -146,7 +148,7 @@ mod tests {
async fn create_test_session(user_repository: &UserRepository) -> String {
let user = user_repository
.create_user("testuser".to_string(), "hash".to_string())
.create_user("testuser", "hash")
.await
.unwrap();
let token: String = rand::rng()
@@ -156,7 +158,7 @@ mod tests {
.collect();
let expires_at = chrono::Utc::now() + chrono::Duration::days(1);
user_repository
.create_session(user.id, token.clone(), expires_at)
.create_session(user.id, &token, expires_at)
.await
.unwrap();
token