chore: clean up imports
parent
32e27978ec
commit
48f2d00c94
|
@ -32,5 +32,6 @@ features = [
|
|||
"sqlx-postgres",
|
||||
"runtime-tokio-rustls",
|
||||
"macros",
|
||||
"with-chrono"
|
||||
"with-chrono",
|
||||
"debug-print"
|
||||
]
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
mod pagination;
|
||||
|
||||
use axum::extract::{Path, Query, State};
|
||||
use axum::routing::get;
|
||||
use axum::Json;
|
||||
use axum::Router;
|
||||
|
||||
use crate::db;
|
||||
use pagination::PaginatedResponse;
|
||||
|
||||
use crate::db;
|
||||
use axum::{
|
||||
extract::{Path, Query, State},
|
||||
routing::get,
|
||||
Json, Router,
|
||||
};
|
||||
|
||||
pub fn router() -> Router<crate::Global> {
|
||||
Router::new()
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
use crate::repo::MetaRepoMgr;
|
||||
use crate::{Config, Global};
|
||||
use crate::{repo::MetaRepoMgr, Config, Global};
|
||||
|
||||
use axum::extract::FromRef;
|
||||
use axum::Router;
|
||||
use axum::{extract::FromRef, Router};
|
||||
use clap::Parser;
|
||||
use sea_orm_migration::MigratorTrait;
|
||||
use std::io;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::{io, path::PathBuf, sync::Arc};
|
||||
use tokio::sync::RwLock;
|
||||
use tower_http::trace::TraceLayer;
|
||||
use tracing::debug;
|
||||
|
@ -40,7 +36,7 @@ pub struct Cli {
|
|||
#[arg(
|
||||
long,
|
||||
value_name = "LOG_LEVEL",
|
||||
default_value = "tower_http=debug,rieterd=debug",
|
||||
default_value = "tower_http=debug,rieterd=debug,sea_orm=debug",
|
||||
env = "RIETER_LOG"
|
||||
)]
|
||||
pub log: String,
|
||||
|
@ -67,7 +63,7 @@ impl Cli {
|
|||
url.clone()
|
||||
} else {
|
||||
format!(
|
||||
"sqlite://{}",
|
||||
"sqlite://{}?mode=rwc",
|
||||
self.data_dir.join("rieter.sqlite").to_string_lossy()
|
||||
)
|
||||
};
|
||||
|
@ -80,6 +76,8 @@ impl Cli {
|
|||
let db = sea_orm::Database::connect(options).await?;
|
||||
crate::db::Migrator::up(&db, None).await?;
|
||||
|
||||
debug!("Successfully applied migrations");
|
||||
|
||||
let config = Config {
|
||||
data_dir: self.data_dir.clone(),
|
||||
};
|
||||
|
|
|
@ -2,13 +2,12 @@ pub mod entities;
|
|||
mod migrator;
|
||||
pub mod query;
|
||||
|
||||
use sea_orm::{DeriveActiveEnum, EnumIter};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub use entities::{prelude::*, *};
|
||||
pub use migrator::Migrator;
|
||||
|
||||
use sea_orm::{DeriveActiveEnum, EnumIter};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
type Result<T> = std::result::Result<T, sea_orm::DbErr>;
|
||||
|
||||
#[derive(EnumIter, DeriveActiveEnum, Serialize, Deserialize, PartialEq, Eq, Clone, Debug)]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use crate::db::*;
|
||||
|
||||
use sea_orm::{sea_query::IntoCondition, *};
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::db::*;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Filter {
|
||||
repo: Option<i32>,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use sea_orm::{sea_query::IntoCondition, *};
|
||||
|
||||
use crate::db::*;
|
||||
|
||||
use sea_orm::{sea_query::IntoCondition, *};
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Filter {
|
||||
name: Option<String>,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use std::error::Error;
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
use std::{error::Error, fmt, io};
|
||||
|
||||
use axum::http::StatusCode;
|
||||
use axum::response::{IntoResponse, Response};
|
||||
use axum::{
|
||||
http::StatusCode,
|
||||
response::{IntoResponse, Response},
|
||||
};
|
||||
|
||||
pub type Result<T> = std::result::Result<T, ServerError>;
|
||||
|
||||
|
|
|
@ -4,11 +4,11 @@ pub mod db;
|
|||
mod error;
|
||||
mod repo;
|
||||
|
||||
use clap::Parser;
|
||||
pub use error::{Result, ServerError};
|
||||
use repo::MetaRepoMgr;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
|
||||
use clap::Parser;
|
||||
use std::{path::PathBuf, sync::Arc};
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::{
|
||||
io,
|
||||
path::{Path, PathBuf},
|
||||
sync::{Arc, Mutex},
|
||||
};
|
||||
|
||||
use libarchive::write::{Builder, FileWriter, WriteEntry};
|
||||
use libarchive::{Entry, WriteFilter, WriteFormat};
|
||||
use libarchive::{
|
||||
write::{Builder, FileWriter, WriteEntry},
|
||||
Entry, WriteFilter, WriteFormat,
|
||||
};
|
||||
|
||||
/// Struct to abstract away the intrinsics of writing entries to an archive file
|
||||
pub struct RepoArchiveWriter {
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
use super::{archive, package};
|
||||
use crate::{db, error::Result};
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use sea_orm::{ColumnTrait, DbConn, ModelTrait, QueryFilter, QuerySelect};
|
||||
use uuid::Uuid;
|
||||
|
||||
use futures::StreamExt;
|
||||
use sea_orm::{ColumnTrait, DbConn, ModelTrait, QueryFilter, QuerySelect};
|
||||
use tokio::io::AsyncRead;
|
||||
|
||||
use super::archive;
|
||||
use super::package;
|
||||
use crate::db;
|
||||
use crate::error::Result;
|
||||
use uuid::Uuid;
|
||||
|
||||
pub const ANY_ARCH: &'static str = "any";
|
||||
|
||||
|
|
|
@ -4,19 +4,19 @@ mod manager_new;
|
|||
pub mod package;
|
||||
|
||||
pub use manager_new::MetaRepoMgr;
|
||||
use tokio_util::io::StreamReader;
|
||||
|
||||
use axum::body::Body;
|
||||
use axum::extract::{Path, State};
|
||||
use axum::http::Request;
|
||||
use axum::http::StatusCode;
|
||||
use axum::response::IntoResponse;
|
||||
use axum::routing::{delete, post};
|
||||
use axum::Router;
|
||||
use axum::{
|
||||
body::Body,
|
||||
extract::{Path, State},
|
||||
http::{Request, StatusCode},
|
||||
response::IntoResponse,
|
||||
routing::{delete, post},
|
||||
Router,
|
||||
};
|
||||
use futures::TryStreamExt;
|
||||
use tokio_util::io::StreamReader;
|
||||
use tower::util::ServiceExt;
|
||||
use tower_http::services::ServeFile;
|
||||
use tower_http::validate_request::ValidateRequestHeaderLayer;
|
||||
use tower_http::{services::ServeFile, validate_request::ValidateRequestHeaderLayer};
|
||||
|
||||
pub fn router(api_key: &str) -> Router<crate::Global> {
|
||||
Router::new()
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
use crate::db::{self, entities::package, PackageRelatedEnum};
|
||||
|
||||
use std::{
|
||||
fmt, fs,
|
||||
io::{self, BufRead, BufReader, BufWriter, Read, Write},
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use chrono::NaiveDateTime;
|
||||
use futures::StreamExt;
|
||||
use libarchive::read::{Archive, Builder};
|
||||
use libarchive::{Entry, ReadFilter};
|
||||
use libarchive::{
|
||||
read::{Archive, Builder},
|
||||
Entry, ReadFilter,
|
||||
};
|
||||
use sea_orm::{ActiveValue::Set, ColumnTrait, DbConn, ModelTrait, QueryFilter, QuerySelect};
|
||||
use std::fmt;
|
||||
use std::fs;
|
||||
use std::io::{self, BufRead, BufReader, BufWriter, Read, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use tokio::io::{AsyncWrite, AsyncWriteExt};
|
||||
|
||||
use crate::db::{self, entities::package, PackageRelatedEnum};
|
||||
|
||||
const IGNORED_FILES: [&str; 5] = [".BUILDINFO", ".INSTALL", ".MTREE", ".PKGINFO", ".CHANGELOG"];
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
Loading…
Reference in New Issue