mirror of
https://github.com/Lumither/nocturne.git
synced 2026-10-17 10:26:21 +00:00
feat(backend) cargo fmt & migration to rust 2024
This commit is contained in:
15 files changed
+22
-23
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc, RwLock,
|
||||
atomic::{AtomicBool, Ordering}, Arc,
|
||||
RwLock,
|
||||
},
|
||||
thread,
|
||||
};
|
||||
|
||||
@@ -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>,
|
||||
|
||||
Reference in new issue
Block a user