Group imports

This commit is contained in:
silverpill 2023-02-12 23:07:19 +00:00
parent bc3184cf77
commit 6945ded963
52 changed files with 403 additions and 280 deletions

View file

@ -23,14 +23,18 @@ use crate::activitypub::{
use crate::config::Instance;
use crate::errors::ValidationError;
use crate::media::get_file_url;
use crate::models::profiles::types::{
use crate::models::{
profiles::types::{
ExtraField,
IdentityProof,
PaymentOption,
},
users::types::User,
};
use crate::utils::{
crypto_rsa::{deserialize_private_key, get_public_key_pem},
urls::get_hostname,
};
use crate::models::users::types::User;
use crate::utils::crypto_rsa::{deserialize_private_key, get_public_key_pem};
use crate::utils::urls::get_hostname;
use crate::webfinger::types::ActorAddress;
use super::attachments::{
attach_extra_field,

View file

@ -17,8 +17,10 @@ use crate::json_signatures::verify::{
JsonSignatureVerificationError as JsonSignatureError,
JsonSigner,
};
use crate::models::profiles::queries::get_profile_by_remote_actor_id;
use crate::models::profiles::types::DbActorProfile;
use crate::models::{
profiles::queries::get_profile_by_remote_actor_id,
profiles::types::DbActorProfile,
};
use crate::utils::crypto_rsa::deserialize_public_key;
use super::fetcher::helpers::get_or_import_profile_by_actor_id;
use super::receiver::HandlerError;

View file

@ -8,8 +8,10 @@ use crate::activitypub::{
vocabulary::ACCEPT,
};
use crate::config::Instance;
use crate::models::profiles::types::DbActorProfile;
use crate::models::users::types::User;
use crate::models::{
profiles::types::DbActorProfile,
users::types::User,
};
use crate::utils::id::generate_ulid;
#[derive(Serialize)]

View file

@ -11,9 +11,11 @@ use crate::activitypub::{
};
use crate::config::Instance;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::posts::types::Post;
use crate::models::relationships::queries::get_followers;
use crate::models::users::types::User;
use crate::models::{
posts::types::Post,
relationships::queries::get_followers,
users::types::User,
};
#[derive(Serialize)]
struct Announce {

View file

@ -8,9 +8,11 @@ use crate::activitypub::{
};
use crate::config::Instance;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::posts::helpers::add_related_posts;
use crate::models::posts::types::Post;
use crate::models::users::types::User;
use crate::models::{
posts::helpers::add_related_posts,
posts::types::Post,
users::types::User,
};
use super::create_note::{
build_note,
get_note_recipients,

View file

@ -10,8 +10,10 @@ use crate::activitypub::{
};
use crate::config::Instance;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::relationships::queries::{get_followers, get_following};
use crate::models::users::types::User;
use crate::models::{
relationships::queries::{get_followers, get_following},
users::types::User,
};
#[derive(Serialize)]
struct DeletePerson {

View file

@ -9,8 +9,10 @@ use crate::activitypub::{
vocabulary::FOLLOW,
};
use crate::config::Instance;
use crate::models::profiles::types::DbActorProfile;
use crate::models::users::types::User;
use crate::models::{
profiles::types::DbActorProfile,
users::types::User,
};
#[derive(Serialize)]
pub(super) struct Follow {

View file

@ -11,9 +11,11 @@ use crate::activitypub::{
};
use crate::config::Instance;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::posts::types::{Post, Visibility};
use crate::models::profiles::types::DbActorProfile;
use crate::models::users::types::User;
use crate::models::{
posts::types::{Post, Visibility},
profiles::types::DbActorProfile,
users::types::User,
};
#[derive(Serialize)]
struct Like {

View file

@ -10,9 +10,11 @@ use crate::activitypub::{
};
use crate::config::Instance;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::posts::types::Post;
use crate::models::profiles::types::DbActorProfile;
use crate::models::users::types::User;
use crate::models::{
posts::types::Post,
profiles::types::DbActorProfile,
users::types::User,
};
use super::announce::get_announce_recipients;
#[derive(Serialize)]

View file

@ -9,8 +9,10 @@ use crate::activitypub::{
vocabulary::{FOLLOW, UNDO},
};
use crate::config::Instance;
use crate::models::profiles::types::DbActorProfile;
use crate::models::users::types::User;
use crate::models::{
profiles::types::DbActorProfile,
users::types::User,
};
use super::follow::Follow;
#[derive(Serialize)]

View file

@ -9,9 +9,11 @@ use crate::activitypub::{
};
use crate::config::Instance;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::posts::types::{Post, Visibility};
use crate::models::profiles::types::DbActorProfile;
use crate::models::users::types::User;
use crate::models::{
posts::types::{Post, Visibility},
profiles::types::DbActorProfile,
users::types::User,
};
use super::like::{
get_like_audience,
get_like_recipients,

View file

@ -11,8 +11,10 @@ use crate::activitypub::{
};
use crate::config::Instance;
use crate::database::{DatabaseClient, DatabaseError, DatabaseTypeError};
use crate::models::relationships::queries::get_followers;
use crate::models::users::types::User;
use crate::models::{
relationships::queries::get_followers,
users::types::User,
};
use crate::utils::id::generate_ulid;
#[derive(Serialize)]

View file

@ -16,8 +16,10 @@ use crate::http_signatures::create::{
HttpSignatureError,
};
use crate::media::{save_file, SUPPORTED_MEDIA_TYPES};
use crate::utils::files::sniff_media_type;
use crate::utils::urls::guess_protocol;
use crate::utils::{
files::sniff_media_type,
urls::guess_protocol,
};
use crate::webfinger::types::{ActorAddress, JsonResourceDescriptor};
const FETCHER_CONNECTION_TIMEOUT: u64 = 30;

View file

@ -11,14 +11,16 @@ use crate::activitypub::{
use crate::config::{Config, Instance};
use crate::database::{DatabaseClient, DatabaseError};
use crate::errors::ValidationError;
use crate::models::posts::helpers::get_local_post_by_id;
use crate::models::posts::queries::get_post_by_remote_object_id;
use crate::models::posts::types::Post;
use crate::models::profiles::queries::{
use crate::models::{
posts::helpers::get_local_post_by_id,
posts::queries::get_post_by_remote_object_id,
posts::types::Post,
profiles::queries::{
get_profile_by_acct,
get_profile_by_remote_actor_id,
},
profiles::types::DbActorProfile,
};
use crate::models::profiles::types::DbActorProfile;
use crate::webfinger::types::ActorAddress;
use super::fetchers::{
fetch_actor,

View file

@ -1,10 +1,14 @@
use std::time::Instant;
use actix_web::{
get, post, web,
HttpRequest, HttpResponse, Scope,
get,
post,
web,
http::header as http_header,
http::header::HeaderMap,
HttpRequest,
HttpResponse,
Scope,
};
use serde::Deserialize;
use tokio::sync::Mutex;

View file

@ -1,7 +1,9 @@
use crate::activitypub::identifiers::{local_actor_id, local_object_id};
use crate::config::Instance;
use crate::models::posts::types::Post;
use crate::models::profiles::types::DbActorProfile;
use crate::models::{
posts::types::Post,
profiles::types::DbActorProfile,
};
use crate::utils::{
datetime::get_min_datetime,
html::{clean_html_all, escape_html},

View file

@ -3,8 +3,10 @@ use actix_web::{get, web, HttpResponse};
use crate::config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::models::posts::queries::get_posts_by_author;
use crate::models::users::queries::get_user_by_name;
use crate::models::{
posts::queries::get_posts_by_author,
users::queries::get_user_by_name,
};
use super::feeds::make_feed;
const FEED_SIZE: u16 = 10;

View file

@ -4,12 +4,14 @@ use std::str::FromStr;
use rsa::RsaPrivateKey;
use crate::utils::crypto_rsa::{
use crate::utils::{
crypto_rsa::{
deserialize_private_key,
generate_rsa_key,
serialize_private_key,
},
files::{set_file_permissions, write_file},
};
use crate::utils::files::{set_file_permissions, write_file};
use super::environment::Environment;
use super::main::{Config, RegistrationType};

View file

@ -1,7 +1,8 @@
use actix_web::{
http::StatusCode,
HttpResponse, HttpResponseBuilder,
error::ResponseError,
http::StatusCode,
HttpResponse,
HttpResponseBuilder,
};
use serde::Serialize;

View file

@ -36,11 +36,13 @@ pub fn verify_eip191_identity_proof(
#[cfg(test)]
mod tests {
use web3::signing::{Key, SecretKeyRef};
use crate::ethereum::signatures::{
use crate::ethereum::{
signatures::{
generate_ecdsa_key,
sign_message,
},
utils::address_to_string,
};
use crate::ethereum::utils::address_to_string;
use crate::utils::currencies::Currency;
use super::*;

View file

@ -10,11 +10,13 @@ use web3::{
types::{BlockId, BlockNumber, FilterBuilder, U256},
};
use crate::activitypub::builders::{
use crate::activitypub::{
builders::{
add_person::prepare_add_person,
remove_person::prepare_remove_person,
},
identifiers::LocalActorCollection,
};
use crate::activitypub::identifiers::LocalActorCollection;
use crate::config::{EthereumConfig, Instance};
use crate::database::{
get_database_client,
@ -23,29 +25,33 @@ use crate::database::{
DbPool,
};
use crate::errors::ConversionError;
use crate::models::notifications::queries::{
use crate::models::{
notifications::queries::{
create_subscription_notification,
create_subscription_expiration_notification,
};
use crate::models::profiles::queries::{
},
profiles::queries::{
get_profile_by_id,
search_profiles_by_wallet_address,
};
use crate::models::profiles::types::DbActorProfile;
use crate::models::relationships::queries::unsubscribe;
use crate::models::subscriptions::queries::{
},
profiles::types::DbActorProfile,
relationships::queries::unsubscribe,
subscriptions::queries::{
create_subscription,
update_subscription,
get_expired_subscriptions,
get_subscription_by_participants,
};
use crate::models::users::queries::{
},
users::queries::{
get_user_by_id,
get_user_by_public_wallet_address,
},
users::types::User,
};
use crate::utils::{
caip2::ChainId,
currencies::Currency,
};
use crate::models::users::types::User;
use crate::utils::caip2::ChainId;
use crate::utils::currencies::Currency;
use super::contracts::ContractSet;
use super::errors::EthereumError;
use super::signatures::{

View file

@ -11,11 +11,13 @@ use crate::activitypub::queues::{
};
use crate::config::Config;
use crate::database::{get_database_client, DbPool};
use crate::ethereum::contracts::Blockchain;
use crate::ethereum::nft::process_nft_events;
use crate::ethereum::subscriptions::{
use crate::ethereum::{
contracts::Blockchain,
nft::process_nft_events,
subscriptions::{
check_ethereum_subscriptions,
update_expired_subscriptions,
},
};
use crate::monero::subscriptions::check_monero_subscriptions;
use crate::models::{

View file

@ -133,8 +133,10 @@ pub fn verify_ed25519_json_signature(
mod tests {
use serde_json::json;
use crate::json_signatures::create::sign_object;
use crate::utils::crypto_rsa::generate_weak_rsa_key;
use crate::utils::currencies::Currency;
use crate::utils::{
crypto_rsa::generate_weak_rsa_key,
currencies::Currency,
};
use super::*;
#[test]

View file

@ -15,10 +15,12 @@ use crate::activitypub::builders::{
use crate::config::{Config, RegistrationType};
use crate::database::{get_database_client, DatabaseError, DbPool};
use crate::errors::{HttpError, ValidationError};
use crate::ethereum::contracts::ContractSet;
use crate::ethereum::eip4361::verify_eip4361_signature;
use crate::ethereum::gate::is_allowed_user;
use crate::ethereum::identity::verify_eip191_identity_proof;
use crate::ethereum::{
contracts::ContractSet,
eip4361::verify_eip4361_signature,
gate::is_allowed_user,
identity::verify_eip191_identity_proof,
};
use crate::identity::{
claims::create_identity_claim,
did::Did,
@ -36,24 +38,27 @@ use crate::json_signatures::{
verify_eip191_json_signature,
},
};
use crate::mastodon_api::oauth::auth::get_current_user;
use crate::mastodon_api::pagination::get_paginated_response;
use crate::mastodon_api::search::helpers::search_profiles_only;
use crate::mastodon_api::statuses::helpers::build_status_list;
use crate::mastodon_api::statuses::types::Status;
use crate::models::posts::queries::get_posts_by_author;
use crate::models::profiles::queries::{
use crate::mastodon_api::{
oauth::auth::get_current_user,
pagination::get_paginated_response,
search::helpers::search_profiles_only,
statuses::helpers::build_status_list,
statuses::types::Status,
};
use crate::models::{
posts::queries::get_posts_by_author,
profiles::queries::{
get_profile_by_acct,
get_profile_by_id,
search_profiles_by_did,
update_profile,
};
use crate::models::profiles::types::{
},
profiles::types::{
IdentityProof,
ProfileUpdateData,
ProofType,
};
use crate::models::relationships::queries::{
},
relationships::queries::{
get_followers_paginated,
get_following_paginated,
hide_replies,
@ -61,14 +66,15 @@ use crate::models::relationships::queries::{
show_replies,
show_reposts,
unfollow,
};
use crate::models::subscriptions::queries::get_incoming_subscriptions;
use crate::models::users::queries::{
},
subscriptions::queries::get_incoming_subscriptions,
users::queries::{
create_user,
get_user_by_did,
is_valid_invite_code,
},
users::types::{Role, UserCreateData},
};
use crate::models::users::types::{Role, UserCreateData};
use crate::utils::{
caip2::ChainId,
canonicalization::canonicalize_object,

View file

@ -5,8 +5,10 @@ use actix_web_httpauth::extractors::bearer::BearerAuth;
use crate::config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::mastodon_api::accounts::types::Account;
use crate::mastodon_api::oauth::auth::get_current_user;
use crate::mastodon_api::{
accounts::types::Account,
oauth::auth::get_current_user,
};
use crate::models::profiles::queries::get_profiles;
use super::types::DirectoryQueryParams;

View file

@ -4,11 +4,13 @@ use actix_web_httpauth::extractors::bearer::BearerAuth;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::mastodon_api::oauth::auth::get_current_user;
use crate::models::markers::queries::{
use crate::models::{
markers::queries::{
create_or_update_marker,
get_marker_opt,
},
markers::types::Timeline,
};
use crate::models::markers::types::Timeline;
use super::types::{MarkerQueryParams, MarkerCreateData, Markers};
/// https://docs.joinmastodon.org/methods/timelines/markers/

View file

@ -5,8 +5,10 @@ use actix_web_httpauth::extractors::bearer::BearerAuth;
use crate::config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::mastodon_api::oauth::auth::get_current_user;
use crate::mastodon_api::uploads::save_b64_file;
use crate::mastodon_api::{
oauth::auth::get_current_user,
uploads::save_b64_file,
};
use crate::models::attachments::queries::create_attachment;
use super::types::{AttachmentCreateData, Attachment};

View file

@ -1,9 +1,11 @@
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use crate::mastodon_api::accounts::types::Account;
use crate::mastodon_api::pagination::PageSize;
use crate::mastodon_api::statuses::types::Status;
use crate::mastodon_api::{
accounts::types::Account,
pagination::PageSize,
statuses::types::Status,
};
use crate::models::notifications::types::{EventType, Notification};
fn default_page_size() -> PageSize { PageSize::new(20) }

View file

@ -9,8 +9,10 @@ use actix_web_httpauth::extractors::bearer::BearerAuth;
use crate::config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::mastodon_api::oauth::auth::get_current_user;
use crate::mastodon_api::pagination::get_paginated_response;
use crate::mastodon_api::{
oauth::auth::get_current_user,
pagination::get_paginated_response,
};
use crate::models::notifications::queries::get_notifications;
use super::types::{ApiNotification, NotificationQueryParams};

View file

@ -8,8 +8,10 @@ use serde_json::json;
use crate::database::{DatabaseClient, DatabaseError};
use crate::errors::HttpError;
use crate::models::oauth::queries::get_user_by_oauth_token;
use crate::models::users::types::User;
use crate::models::{
oauth::queries::get_user_by_oauth_token,
users::types::User,
};
pub async fn get_current_user(
db_client: &impl DatabaseClient,

View file

@ -1,11 +1,11 @@
use actix_web::{
get,
http::header as http_header,
post,
web,
Either,
HttpResponse,
Scope as ActixScope,
http::header as http_header,
};
use actix_web_httpauth::extractors::bearer::BearerAuth;
use chrono::{Duration, Utc};
@ -17,16 +17,18 @@ use crate::ethereum::{
eip4361::verify_eip4361_signature,
utils::validate_ethereum_address,
};
use crate::models::oauth::queries::{
use crate::models::{
oauth::queries::{
create_oauth_authorization,
delete_oauth_token,
get_oauth_app_by_client_id,
get_user_by_authorization_code,
save_oauth_token,
};
use crate::models::users::queries::{
},
users::queries::{
get_user_by_name,
get_user_by_login_address,
},
};
use crate::utils::passwords::verify_password;
use super::auth::get_current_user;

View file

@ -17,20 +17,22 @@ use crate::database::{DatabaseClient, DatabaseError};
use crate::errors::ValidationError;
use crate::ethereum::utils::validate_ethereum_address;
use crate::identity::did::Did;
use crate::models::posts::{
use crate::models::{
posts::{
helpers::{can_view_post, get_local_post_by_id},
types::Post,
};
use crate::models::profiles::queries::{
},
profiles::queries::{
search_profiles,
search_profiles_by_did_only,
search_profiles_by_wallet_address,
};
use crate::models::profiles::types::DbActorProfile;
use crate::models::tags::queries::search_tags;
use crate::models::users::{
},
profiles::types::DbActorProfile,
tags::queries::search_tags,
users::{
queries::get_user_by_name,
types::User,
},
};
use crate::utils::currencies::Currency;
use crate::webfinger::types::ActorAddress;

View file

@ -1,9 +1,11 @@
/// https://docs.joinmastodon.org/methods/search/
use serde::{Deserialize, Serialize};
use crate::mastodon_api::accounts::types::Account;
use crate::mastodon_api::pagination::PageSize;
use crate::mastodon_api::statuses::types::{Status, Tag};
use crate::mastodon_api::{
accounts::types::Account,
pagination::PageSize,
statuses::types::{Status, Tag},
};
fn default_page_size() -> PageSize { PageSize::new(20) }

View file

@ -16,12 +16,15 @@ use crate::config::Config;
use crate::database::{get_database_client, DatabaseError, DbPool};
use crate::errors::{HttpError, ValidationError};
use crate::ethereum::nft::create_mint_signature;
use crate::ipfs::store as ipfs_store;
use crate::ipfs::posts::PostMetadata;
use crate::ipfs::utils::get_ipfs_url;
use crate::ipfs::{
store as ipfs_store,
posts::PostMetadata,
utils::get_ipfs_url,
};
use crate::mastodon_api::oauth::auth::get_current_user;
use crate::models::posts::helpers::{can_create_post, can_view_post};
use crate::models::posts::queries::{
use crate::models::{
posts::helpers::{can_create_post, can_view_post},
posts::queries::{
create_post,
get_post_by_id,
get_thread,
@ -29,18 +32,19 @@ use crate::models::posts::queries::{
set_post_ipfs_cid,
set_post_token_tx_id,
delete_post,
};
use crate::models::posts::types::{PostCreateData, Visibility};
use crate::models::posts::validators::{
},
posts::types::{PostCreateData, Visibility},
posts::validators::{
clean_content,
ATTACHMENTS_MAX_NUM,
EMOJIS_MAX_NUM,
};
use crate::models::reactions::queries::{
},
reactions::queries::{
create_reaction,
delete_reaction,
},
relationships::queries::get_subscribers,
};
use crate::models::relationships::queries::get_subscribers;
use crate::utils::{
currencies::Currency,
markdown::markdown_lite_to_html,

View file

@ -2,8 +2,10 @@ use chrono::{DateTime, Duration, Utc};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use crate::models::invoices::types::{DbInvoice, InvoiceStatus};
use crate::models::profiles::types::PaymentOption;
use crate::models::{
invoices::types::{DbInvoice, InvoiceStatus},
profiles::types::PaymentOption,
};
use crate::monero::subscriptions::MONERO_INVOICE_TIMEOUT;
#[derive(Deserialize)]

View file

@ -6,13 +6,17 @@ use crate::activitypub::builders::update_person::prepare_update_person;
use crate::config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::{HttpError, ValidationError};
use crate::ethereum::contracts::ContractSet;
use crate::ethereum::subscriptions::{
use crate::ethereum::{
contracts::ContractSet,
subscriptions::{
create_subscription_signature,
is_registered_recipient,
},
};
use crate::mastodon_api::{
accounts::types::Account,
oauth::auth::get_current_user,
};
use crate::mastodon_api::accounts::types::Account;
use crate::mastodon_api::oauth::auth::get_current_user;
use crate::models::{
invoices::queries::{create_invoice, get_invoice_by_id},
profiles::queries::{

View file

@ -5,8 +5,10 @@ use actix_web_httpauth::extractors::bearer::BearerAuth;
use crate::config::Config;
use crate::database::{get_database_client, DbPool};
use crate::errors::HttpError;
use crate::mastodon_api::oauth::auth::get_current_user;
use crate::mastodon_api::statuses::helpers::build_status_list;
use crate::mastodon_api::{
oauth::auth::get_current_user,
statuses::helpers::build_status_list,
};
use crate::models::posts::queries::{
get_home_timeline,
get_local_timeline,

View file

@ -96,8 +96,10 @@ pub async fn delete_unused_attachments(
mod tests {
use serial_test::serial;
use crate::database::test_utils::create_test_database;
use crate::models::profiles::types::ProfileCreateData;
use crate::models::profiles::queries::create_profile;
use crate::models::{
profiles::types::ProfileCreateData,
profiles::queries::create_profile,
};
use super::*;
#[tokio::test]

View file

@ -1,13 +1,15 @@
use uuid::Uuid;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::posts::helpers::{add_related_posts, add_user_actions};
use crate::models::posts::queries::{
use crate::models::{
posts::helpers::{add_related_posts, add_user_actions},
posts::queries::{
RELATED_ATTACHMENTS,
RELATED_EMOJIS,
RELATED_LINKS,
RELATED_MENTIONS,
RELATED_TAGS,
},
};
use super::types::{EventType, Notification};

View file

@ -6,8 +6,10 @@ use crate::database::{
DatabaseClient,
DatabaseError,
};
use crate::models::profiles::types::DbActorProfile;
use crate::models::users::types::{DbUser, User};
use crate::models::{
profiles::types::DbActorProfile,
users::types::{DbUser, User},
};
use super::types::{DbOauthApp, DbOauthAppData};
pub async fn create_oauth_app(

View file

@ -3,8 +3,10 @@ use std::collections::HashMap;
use regex::Regex;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::emojis::queries::get_local_emojis_by_names;
use crate::models::emojis::types::DbEmoji;
use crate::models::{
emojis::queries::get_local_emojis_by_names,
emojis::types::DbEmoji,
};
use super::links::is_inside_code_block;
// See also: EMOJI_NAME_RE in models::emojis::validators

View file

@ -2,10 +2,12 @@ use uuid::Uuid;
use crate::activitypub::identifiers::parse_local_object_id;
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::reactions::queries::find_favourited_by_user;
use crate::models::relationships::queries::has_relationship;
use crate::models::relationships::types::RelationshipType;
use crate::models::users::types::{Permission, User};
use crate::models::{
reactions::queries::find_favourited_by_user,
relationships::queries::has_relationship,
relationships::types::RelationshipType,
users::types::{Permission, User},
};
use super::queries::{
get_post_by_id,
get_post_by_remote_object_id,
@ -164,11 +166,13 @@ mod tests {
use serial_test::serial;
use tokio_postgres::Client;
use crate::database::test_utils::create_test_database;
use crate::models::posts::queries::create_post;
use crate::models::posts::types::PostCreateData;
use crate::models::relationships::queries::{follow, subscribe};
use crate::models::users::queries::create_user;
use crate::models::users::types::{Role, User, UserCreateData};
use crate::models::{
posts::queries::create_post,
posts::types::PostCreateData,
relationships::queries::{follow, subscribe},
users::queries::create_user,
users::types::{Role, User, UserCreateData},
};
use super::*;
#[tokio::test]

View file

@ -4,8 +4,10 @@ use regex::{Captures, Regex};
use crate::database::{DatabaseClient, DatabaseError};
use crate::errors::ValidationError;
use crate::models::profiles::queries::get_profiles_by_accts;
use crate::models::profiles::types::DbActorProfile;
use crate::models::{
profiles::queries::get_profiles_by_accts,
profiles::types::DbActorProfile,
};
use crate::webfinger::types::ActorAddress;
use super::links::is_inside_code_block;

View file

@ -7,22 +7,24 @@ use crate::database::{
DatabaseClient,
DatabaseError,
};
use crate::models::attachments::queries::set_attachment_ipfs_cid;
use crate::models::attachments::types::DbMediaAttachment;
use crate::models::cleanup::{
use crate::models::{
attachments::queries::set_attachment_ipfs_cid,
attachments::types::DbMediaAttachment,
cleanup::{
find_orphaned_files,
find_orphaned_ipfs_objects,
DeletionQueue,
};
use crate::models::emojis::types::DbEmoji;
use crate::models::notifications::queries::{
},
emojis::types::DbEmoji,
notifications::queries::{
create_mention_notification,
create_reply_notification,
create_repost_notification,
},
profiles::queries::update_post_count,
profiles::types::DbActorProfile,
relationships::types::RelationshipType,
};
use crate::models::profiles::queries::update_post_count;
use crate::models::profiles::types::DbActorProfile;
use crate::models::relationships::types::RelationshipType;
use crate::utils::id::generate_ulid;
use super::types::{
DbPost,
@ -1304,15 +1306,17 @@ mod tests {
use chrono::Duration;
use serial_test::serial;
use crate::database::test_utils::create_test_database;
use crate::models::profiles::queries::create_profile;
use crate::models::profiles::types::ProfileCreateData;
use crate::models::relationships::queries::{
use crate::models::{
profiles::queries::create_profile,
profiles::types::ProfileCreateData,
relationships::queries::{
follow,
hide_reposts,
subscribe,
},
users::queries::create_user,
users::types::UserCreateData,
};
use crate::models::users::queries::create_user;
use crate::models::users::types::UserCreateData;
use super::*;
#[tokio::test]

View file

@ -8,13 +8,15 @@ use crate::database::{
DatabaseError,
};
use crate::identity::{did::Did, did_pkh::DidPkh};
use crate::models::cleanup::{
use crate::models::{
cleanup::{
find_orphaned_files,
find_orphaned_ipfs_objects,
DeletionQueue,
},
instances::queries::create_instance,
relationships::types::RelationshipType,
};
use crate::models::instances::queries::create_instance;
use crate::models::relationships::types::RelationshipType;
use crate::utils::{
currencies::Currency,
id::generate_ulid,

View file

@ -11,8 +11,10 @@ use serde::{
};
use uuid::Uuid;
use crate::activitypub::actors::types::Actor;
use crate::activitypub::identifiers::local_actor_id;
use crate::activitypub::{
actors::types::Actor,
identifiers::local_actor_id,
};
use crate::database::{
json_macro::{json_from_sql, json_to_sql},
DatabaseTypeError,

View file

@ -5,10 +5,12 @@ use crate::database::{
DatabaseClient,
DatabaseError,
};
use crate::models::notifications::queries::create_reaction_notification;
use crate::models::posts::queries::{
use crate::models::{
notifications::queries::create_reaction_notification,
posts::queries::{
update_reaction_count,
get_post_author,
},
};
use crate::utils::id::generate_ulid;
use super::types::DbReaction;

View file

@ -5,13 +5,15 @@ use crate::database::{
DatabaseClient,
DatabaseError,
};
use crate::models::notifications::queries::create_follow_notification;
use crate::models::profiles::queries::{
use crate::models::{
notifications::queries::create_follow_notification,
profiles::queries::{
update_follower_count,
update_following_count,
update_subscriber_count,
},
profiles::types::DbActorProfile,
};
use crate::models::profiles::types::DbActorProfile;
use crate::utils::id::generate_ulid;
use super::types::{
DbFollowRequest,

View file

@ -6,9 +6,11 @@ use crate::database::{
DatabaseClient,
DatabaseError,
};
use crate::models::profiles::types::PaymentType;
use crate::models::relationships::queries::{subscribe, subscribe_opt};
use crate::models::relationships::types::RelationshipType;
use crate::models::{
profiles::types::PaymentType,
relationships::queries::{subscribe, subscribe_opt},
relationships::types::RelationshipType,
};
use crate::utils::caip2::ChainId;
use super::types::{DbSubscription, Subscription};

View file

@ -6,8 +6,10 @@ use crate::database::{
DatabaseError,
};
use crate::identity::{did::Did, did_pkh::DidPkh};
use crate::models::profiles::queries::create_profile;
use crate::models::profiles::types::{DbActorProfile, ProfileCreateData};
use crate::models::{
profiles::queries::create_profile,
profiles::types::{DbActorProfile, ProfileCreateData},
};
use crate::utils::currencies::Currency;
use super::types::{DbUser, Role, User, UserCreateData};
use super::utils::generate_invite_code;

View file

@ -1,6 +1,8 @@
use crate::database::{DatabaseClient, DatabaseError};
use crate::models::posts::queries::get_local_post_count;
use crate::models::users::queries::get_user_count;
use crate::models::{
posts::queries::get_local_post_count,
users::queries::get_user_count,
};
use super::types::{Usage, Users};
pub async fn get_usage(db_client: &impl DatabaseClient)

View file

@ -1,10 +1,12 @@
use actix_web::{get, web, HttpResponse};
use crate::activitypub::constants::AP_MEDIA_TYPE;
use crate::activitypub::identifiers::{
use crate::activitypub::{
constants::AP_MEDIA_TYPE,
identifiers::{
local_actor_id,
local_instance_actor_id,
parse_local_actor_id,
},
};
use crate::config::{Config, Instance};
use crate::database::{get_database_client, DatabaseClient, DbPool};