feat(backend) cargo fmt & migration to rust 2024

This commit is contained in:
lumither committed 2025-02-23 17:39:36 -08:00
1 parent ca86dd236e
commit 0c6325d5f2
15 files changed
+22 -23

No files matched your search

+1 -1
View File
@@ -1,7 +1,7 @@
[package]
name = "server"
version = "0.1.0"
edition = "2021"
edition = "2024"
[dependencies]
macros = { path = "../macros" }
+2 -2
View File
@@ -8,8 +8,8 @@ use dirs::home_dir;
use tracing::info;
use tracing_appender::{non_blocking, non_blocking::WorkerGuard, rolling};
use tracing_subscriber::{
filter::LevelFilter, fmt, fmt::format::Writer, fmt::time::FormatTime, fmt::MakeWriter,
layer::SubscriberExt, Layer, Registry,
Layer, Registry, filter::LevelFilter, fmt, fmt::MakeWriter, fmt::format::Writer,
fmt::time::FormatTime, layer::SubscriberExt,
};
struct LocalTimer;
+1 -1
View File
@@ -4,7 +4,7 @@ mod misc;
use std::{env, panic};
use crate::modules::{blog::Blog, ModuleTree};
use crate::modules::{ModuleTree, blog::Blog};
use macros::error_panic;
use tracing::info;
@@ -1,8 +1,8 @@
use crate::constants::blog::PAGE_SIZE;
use axum::{extract::State, Json};
use serde_json::{json, Value};
use sqlx::{query, PgPool, Row};
use axum::{Json, extract::State};
use serde_json::{Value, json};
use sqlx::{PgPool, Row, query};
use tracing::error;
const GET_PAGE_COUNT_QUERY: &str = include_str!("post_page_count.sql");
@@ -2,8 +2,8 @@ use macros::dev_consume;
use axum::response::IntoResponse;
use axum::{
extract::{Path, State},
Json,
extract::{Path, State},
};
use serde_json::json;
use sqlx::PgPool;
@@ -15,14 +15,14 @@ use crate::{
use macros::panic_with_log;
use git2::{Delta, Repository};
use sqlx::{Pool, Postgres};
use sqlx::{PgPool, Pool, Postgres};
use tracing::{error, info, warn, Level};
mod error;
mod index;
mod utils;
pub fn task(db_connection: &Pool<Postgres>) {
pub fn task(db_connection: &PgPool) {
// init
let git_work_dir = {
let path = if let Ok(default_log_path) = env::var(var_name::WORK_DIR) {
+2 -2
View File
@@ -3,6 +3,7 @@ mod cron;
use crate::{
modules::{
Module,
blog::{
api::{
get_page_count,
@@ -11,12 +12,11 @@ use crate::{
},
// cron::check_update,
},
Module,
},
scheduler::tasks::CronTask,
};
use axum::{routing::get, Router};
use axum::{Router, routing::get};
use sqlx::PgPool;
const MOUNT_POINT: &str = "/blog";
+1 -1
View File
@@ -5,7 +5,7 @@ use std::num::ParseIntError;
use crate::{
constants::config::server::{default_value, var_name},
scheduler::{tasks::CronTask, Scheduler},
scheduler::{Scheduler, tasks::CronTask},
};
use macros::error_panic;
+2 -2
View File
@@ -1,8 +1,8 @@
use std::{
collections::HashMap,
sync::{
atomic::{AtomicBool, Ordering},
Arc, RwLock,
atomic::{AtomicBool, Ordering}, Arc,
RwLock,
},
thread,
};
+1 -2
View File
@@ -3,12 +3,11 @@
/// https://github.com/rust-lang/git2-rs/commit/f3b87baed1e33d6c2d94fe1fa6aa6503a071d837
///
use git2::{
build, AnnotatedCommit, AutotagOption, Delta, FetchOptions, Reference, Remote, Repository,
AnnotatedCommit, AutotagOption, Delta, FetchOptions, Reference, Remote, Repository, build,
};
use std::path::PathBuf;
use tracing::{error, warn};
#[derive(Debug, Eq, PartialEq)]
pub struct FileDelta {
pub old_path: Option<PathBuf>,