mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-24 17:11:49 +00:00
refactor: move filetype.rs, util.rs to utils directory
This commit is contained in:
parent
7d5fa12465
commit
4620ed2aeb
18 changed files with 18 additions and 18 deletions
|
|
@ -31,7 +31,7 @@ impl<'r> FromData<'r> for Letter {
|
||||||
|
|
||||||
let data_bytes = data_bytes.into_inner();
|
let data_bytes = data_bytes.into_inner();
|
||||||
|
|
||||||
let is_pdf = portfolio_core::filetype::filetype_is_pdf(&data_bytes);
|
let is_pdf = portfolio_core::utils::filetype::filetype_is_pdf(&data_bytes);
|
||||||
|
|
||||||
if !is_pdf {
|
if !is_pdf {
|
||||||
// TODO: Not PDF
|
// TODO: Not PDF
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ impl<'r> FromData<'r> for Portfolio {
|
||||||
|
|
||||||
let data_bytes = data_bytes.into_inner();
|
let data_bytes = data_bytes.into_inner();
|
||||||
|
|
||||||
let is_zip = portfolio_core::filetype::filetype_is_zip(&data_bytes);
|
let is_zip = portfolio_core::utils::filetype::filetype_is_zip(&data_bytes);
|
||||||
|
|
||||||
if !is_zip {
|
if !is_zip {
|
||||||
// TODO: Not ZIP
|
// TODO: Not ZIP
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ impl sea_orm_rocket::Pool for SeaOrmPool {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
async fn init(_figment: &Figment) -> Result<Self, Self::Error> {
|
async fn init(_figment: &Figment) -> Result<Self, Self::Error> {
|
||||||
let conn = portfolio_core::util::get_memory_sqlite_connection().await;
|
let conn = portfolio_core::utils::db::get_memory_sqlite_connection().await;
|
||||||
crate::test::tests::run_test_migrations(&conn).await;
|
crate::test::tests::run_test_migrations(&conn).await;
|
||||||
return Ok(Self { conn });
|
return Ok(Self { conn });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ impl Mutation {
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::candidate_details::tests::APPLICATION_DETAILS;
|
use crate::candidate_details::tests::APPLICATION_DETAILS;
|
||||||
use crate::candidate_details::{EncryptedApplicationDetails};
|
use crate::candidate_details::{EncryptedApplicationDetails};
|
||||||
use crate::util::get_memory_sqlite_connection;
|
use crate::utils::db::get_memory_sqlite_connection;
|
||||||
use crate::{Mutation, Query};
|
use crate::{Mutation, Query};
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ impl Mutation {
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::candidate_details::tests::APPLICATION_DETAILS;
|
use crate::candidate_details::tests::APPLICATION_DETAILS;
|
||||||
use crate::candidate_details::{EncryptedApplicationDetails};
|
use crate::candidate_details::{EncryptedApplicationDetails};
|
||||||
use crate::util::get_memory_sqlite_connection;
|
use crate::utils::db::get_memory_sqlite_connection;
|
||||||
use crate::{Mutation, Query};
|
use crate::{Mutation, Query};
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ mod tests {
|
||||||
use entity::admin;
|
use entity::admin;
|
||||||
use sea_orm::{ActiveModelTrait, Set};
|
use sea_orm::{ActiveModelTrait, Set};
|
||||||
|
|
||||||
use crate::util::get_memory_sqlite_connection;
|
use crate::utils::db::get_memory_sqlite_connection;
|
||||||
use crate::Query;
|
use crate::Query;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ mod tests {
|
||||||
use entity::candidate;
|
use entity::candidate;
|
||||||
|
|
||||||
use crate::Query;
|
use crate::Query;
|
||||||
use crate::util::get_memory_sqlite_connection;
|
use crate::utils::db::get_memory_sqlite_connection;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_find_candidate_by_id() {
|
async fn test_find_candidate_by_id() {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ mod tests {
|
||||||
use sea_orm::{ActiveModelTrait, Set};
|
use sea_orm::{ActiveModelTrait, Set};
|
||||||
|
|
||||||
use crate::Query;
|
use crate::Query;
|
||||||
use crate::util::get_memory_sqlite_connection;
|
use crate::utils::db::get_memory_sqlite_connection;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_find_parent_by_id() {
|
async fn test_find_parent_by_id() {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ mod tests {
|
||||||
use entity::{session};
|
use entity::{session};
|
||||||
use sea_orm::{prelude::Uuid, ActiveModelTrait, Set};
|
use sea_orm::{prelude::Uuid, ActiveModelTrait, Set};
|
||||||
|
|
||||||
use crate::util::get_memory_sqlite_connection;
|
use crate::utils::db::get_memory_sqlite_connection;
|
||||||
use crate::Query;
|
use crate::Query;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,9 @@ pub use database::query::*;
|
||||||
|
|
||||||
pub mod database;
|
pub mod database;
|
||||||
pub mod crypto;
|
pub mod crypto;
|
||||||
pub mod filetype;
|
|
||||||
pub mod services;
|
pub mod services;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod candidate_details;
|
pub mod candidate_details;
|
||||||
pub mod util;
|
|
||||||
pub mod responses;
|
pub mod responses;
|
||||||
pub mod utils;
|
pub mod utils;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,7 @@ mod admin_tests {
|
||||||
use entity::admin;
|
use entity::admin;
|
||||||
use sea_orm::{Set, ActiveModelTrait};
|
use sea_orm::{Set, ActiveModelTrait};
|
||||||
|
|
||||||
use crate::{util::get_memory_sqlite_connection, error::ServiceError};
|
use crate::{utils::db::get_memory_sqlite_connection, error::ServiceError};
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use entity::{candidate, parent};
|
use entity::{candidate, parent};
|
||||||
use sea_orm::DbConn;
|
use sea_orm::DbConn;
|
||||||
|
|
||||||
use crate::{error::ServiceError, candidate_details::{ApplicationDetails, EncryptedApplicationDetails}, Query, util::get_recipients};
|
use crate::{error::ServiceError, candidate_details::{ApplicationDetails, EncryptedApplicationDetails}, Query, utils::db::get_recipients};
|
||||||
|
|
||||||
use super::{parent_service::ParentService, candidate_service::CandidateService};
|
use super::{parent_service::ParentService, candidate_service::CandidateService};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ use crate::{
|
||||||
candidate_details::{EncryptedApplicationDetails, EncryptedString},
|
candidate_details::{EncryptedApplicationDetails, EncryptedString},
|
||||||
crypto::{self, hash_password},
|
crypto::{self, hash_password},
|
||||||
error::ServiceError,
|
error::ServiceError,
|
||||||
Mutation, Query, responses::{BaseCandidateResponse, CreateCandidateResponse}, util::get_recipients,
|
Mutation, Query, responses::{BaseCandidateResponse, CreateCandidateResponse}, utils::db::get_recipients,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::{session_service::{AdminUser, SessionService}, application_service::ApplicationService, portfolio_service::PortfolioService};
|
use super::{session_service::{AdminUser, SessionService}, application_service::ApplicationService, portfolio_service::PortfolioService};
|
||||||
|
|
@ -255,7 +255,7 @@ pub mod tests {
|
||||||
use sea_orm::{DbConn};
|
use sea_orm::{DbConn};
|
||||||
|
|
||||||
use crate::candidate_details::tests::assert_all_application_details;
|
use crate::candidate_details::tests::assert_all_application_details;
|
||||||
use crate::util::get_memory_sqlite_connection;
|
use crate::utils::db::get_memory_sqlite_connection;
|
||||||
use crate::{crypto, services::candidate_service::CandidateService, Mutation};
|
use crate::{crypto, services::candidate_service::CandidateService, Mutation};
|
||||||
|
|
||||||
use super::EncryptedApplicationDetails;
|
use super::EncryptedApplicationDetails;
|
||||||
|
|
|
||||||
|
|
@ -332,7 +332,7 @@ impl PortfolioService {
|
||||||
mod tests {
|
mod tests {
|
||||||
use serial_test::serial;
|
use serial_test::serial;
|
||||||
|
|
||||||
use crate::{services::{portfolio_service::{PortfolioService, FileType}, candidate_service::{CandidateService, tests::put_user_data}}, util::get_memory_sqlite_connection, crypto};
|
use crate::{services::{portfolio_service::{PortfolioService, FileType}, candidate_service::{CandidateService, tests::put_user_data}}, utils::db::get_memory_sqlite_connection, crypto};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
const APPLICATION_ID: i32 = 103151;
|
const APPLICATION_ID: i32 = 103151;
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ mod tests {
|
||||||
use crate::{
|
use crate::{
|
||||||
crypto,
|
crypto,
|
||||||
services::{application_service::ApplicationService, session_service::SessionService},
|
services::{application_service::ApplicationService, session_service::SessionService},
|
||||||
util::get_memory_sqlite_connection,
|
utils::db::get_memory_sqlite_connection,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
|
|
|
||||||
|
|
@ -1 +1,3 @@
|
||||||
pub mod csv;
|
pub mod csv;
|
||||||
|
pub mod filetype;
|
||||||
|
pub mod db;
|
||||||
Loading…
Reference in a new issue