mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-03 17:08:13 +00:00
refactor- almost done
This commit is contained in:
1 parent
20a6839eaf
commit
598e99d2da
14 files changed
+11
-43
No files matched your search
File renamed without changes.
@@ -0,0 +1 @@
|
||||
pub mod list_ip_bans;
|
||||
@@ -5,6 +5,7 @@ mod builders;
|
||||
pub mod api_tokens;
|
||||
pub mod column_types;
|
||||
pub mod helpers;
|
||||
pub mod ip_bans;
|
||||
pub mod model_categories;
|
||||
pub mod tokens;
|
||||
pub mod tts;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
pub mod get_user_profile_by_username;
|
||||
pub mod list_users_query_builder;
|
||||
pub mod user_badges;
|
||||
pub mod user_roles;
|
||||
pub mod user_roles;
|
||||
pub mod user_sessions;
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
use anyhow::anyhow;
|
||||
use crate::AnyhowResult;
|
||||
use database_queries::tokens::Tokens;
|
||||
use container_common::anyhow_result::AnyhowResult;
|
||||
use crate::tokens::Tokens;
|
||||
use log::{info, warn};
|
||||
use sqlx::MySqlPool;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
pub mod create_session;
|
||||
@@ -1,2 +1 @@
|
||||
pub mod mediators;
|
||||
pub mod queries;
|
||||
pub mod mediators;
|
||||
@@ -1,29 +0,0 @@
|
||||
use sqlx::MySqlPool;
|
||||
use crate::AnyhowResult;
|
||||
|
||||
pub struct NewBadge {
|
||||
pub slug: String,
|
||||
pub title: String,
|
||||
pub description: String,
|
||||
pub image_url: String,
|
||||
}
|
||||
|
||||
impl NewBadge {
|
||||
pub async fn insert(&self, pool: &MySqlPool) -> AnyhowResult<u64> {
|
||||
let record_id = sqlx::query!(
|
||||
r#"
|
||||
INSERT INTO badges ( slug, title, description, image_url )
|
||||
VALUES ( ?, ?, ?, ? )
|
||||
"#,
|
||||
self.slug,
|
||||
self.title,
|
||||
self.description,
|
||||
self.image_url,
|
||||
)
|
||||
.execute(pool)
|
||||
.await?
|
||||
.last_insert_id();
|
||||
|
||||
Ok(record_id)
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
pub mod badges;
|
||||
pub mod create_session;
|
||||
pub mod list_ip_bans;
|
||||
@@ -5,7 +5,6 @@ use actix_web::cookie::Cookie;
|
||||
use actix_web::error::ResponseError;
|
||||
use actix_web::http::StatusCode;
|
||||
use actix_web::{Responder, web, HttpResponse, error, HttpRequest};
|
||||
use crate::database::queries::create_session::create_session_for_user;
|
||||
use crate::http_server::endpoints::users::create_account::CreateAccountErrorType::{BadInput, ServerError, UsernameTaken, EmailTaken};
|
||||
use crate::http_server::web_utils::ip_address::get_request_ip;
|
||||
use crate::http_server::web_utils::response_error_helpers::to_simple_json_error;
|
||||
@@ -16,7 +15,7 @@ use crate::validations::passwords::validate_passwords;
|
||||
use crate::validations::username::validate_username;
|
||||
use crate::validations::username_reservations::is_reserved_username;
|
||||
use database_queries::tokens::Tokens;
|
||||
use derive_more::{Display, Error};
|
||||
use database_queries::users::user_sessions::create_session::create_session_for_user;
|
||||
use log::{info, warn, log};
|
||||
use regex::Regex;
|
||||
use sqlx::error::DatabaseError;
|
||||
|
||||
@@ -6,7 +6,6 @@ use actix_web::error::ResponseError;
|
||||
use actix_web::http::StatusCode;
|
||||
use actix_web::web::Path;
|
||||
use actix_web::{Responder, web, HttpResponse, error, HttpRequest};
|
||||
use crate::database::queries::create_session::create_session_for_user;
|
||||
use crate::http_server::web_utils::ip_address::get_request_ip;
|
||||
use crate::http_server::web_utils::response_error_helpers::to_simple_json_error;
|
||||
use crate::server_state::ServerState;
|
||||
|
||||
-1
@@ -8,7 +8,6 @@ use actix_web::web::{Path, Query};
|
||||
use actix_web::{Responder, web, HttpResponse, error, HttpRequest, HttpMessage};
|
||||
use chrono::{DateTime, Utc};
|
||||
use crate::AnyhowResult;
|
||||
use crate::database::queries::create_session::create_session_for_user;
|
||||
use crate::http_server::web_utils::ip_address::get_request_ip;
|
||||
use crate::http_server::web_utils::response_error_helpers::to_simple_json_error;
|
||||
use crate::server_state::ServerState;
|
||||
|
||||
@@ -6,12 +6,12 @@ use actix_web::error::ResponseError;
|
||||
use actix_web::http::StatusCode;
|
||||
use actix_web::{Responder, web, HttpResponse, error, HttpRequest};
|
||||
use crate::AnyhowResult;
|
||||
use crate::database::queries::create_session::create_session_for_user;
|
||||
use crate::http_server::web_utils::ip_address::get_request_ip;
|
||||
use crate::http_server::web_utils::response_error_helpers::to_simple_json_error;
|
||||
use crate::http_server::web_utils::serialize_as_json_error::serialize_as_json_error;
|
||||
use crate::server_state::ServerState;
|
||||
use database_queries::helpers::boolean_converters::i8_to_bool;
|
||||
use database_queries::users::user_sessions::create_session::create_session_for_user;
|
||||
use log::{info, warn, log};
|
||||
use regex::Regex;
|
||||
use sqlx::MySqlPool;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use anyhow::Error;
|
||||
use crate::database::queries::list_ip_bans::list_ip_bans;
|
||||
use crate::threads::ip_banlist_set::IpBanlistSet;
|
||||
use database_queries::ip_bans::list_ip_bans::list_ip_bans;
|
||||
use log::info;
|
||||
use log::warn;
|
||||
use sqlx::MySqlPool;
|
||||
|
||||
Reference in new issue
Block a user