Move contents of database and models modules to mitra-models crate
This commit is contained in:
parent
19780c3b8a
commit
95daa94a97
203 changed files with 882 additions and 742 deletions
34
Cargo.lock
generated
34
Cargo.lock
generated
|
@ -1832,22 +1832,16 @@ dependencies = [
|
|||
"base64",
|
||||
"blake2",
|
||||
"chrono",
|
||||
"deadpool",
|
||||
"deadpool-postgres",
|
||||
"ed25519",
|
||||
"ed25519-dalek",
|
||||
"env_logger",
|
||||
"hex",
|
||||
"log",
|
||||
"mitra-config",
|
||||
"mitra-models",
|
||||
"mitra-utils",
|
||||
"monero-rpc",
|
||||
"num_cpus",
|
||||
"postgres-protocol",
|
||||
"postgres-types",
|
||||
"postgres_query",
|
||||
"postgres_query_macro",
|
||||
"refinery",
|
||||
"regex",
|
||||
"reqwest",
|
||||
"rsa",
|
||||
|
@ -1859,7 +1853,6 @@ dependencies = [
|
|||
"siwe",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tokio-postgres",
|
||||
"url 2.2.2",
|
||||
"uuid",
|
||||
"web3",
|
||||
|
@ -1874,6 +1867,7 @@ dependencies = [
|
|||
"log",
|
||||
"mitra",
|
||||
"mitra-config",
|
||||
"mitra-models",
|
||||
"mitra-utils",
|
||||
"tokio",
|
||||
"uuid",
|
||||
|
@ -1894,6 +1888,30 @@ dependencies = [
|
|||
"url 2.2.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mitra-models"
|
||||
version = "1.19.0"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"deadpool",
|
||||
"deadpool-postgres",
|
||||
"hex",
|
||||
"log",
|
||||
"mitra-utils",
|
||||
"postgres-protocol",
|
||||
"postgres-types",
|
||||
"postgres_query",
|
||||
"postgres_query_macro",
|
||||
"refinery",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serial_test",
|
||||
"thiserror",
|
||||
"tokio",
|
||||
"tokio-postgres",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mitra-utils"
|
||||
version = "1.19.0"
|
||||
|
|
16
Cargo.toml
16
Cargo.toml
|
@ -14,17 +14,20 @@ members = [
|
|||
".",
|
||||
"mitra-cli",
|
||||
"mitra-config",
|
||||
"mitra-models",
|
||||
"mitra-utils",
|
||||
]
|
||||
default-members = [
|
||||
".",
|
||||
"mitra-cli",
|
||||
"mitra-config",
|
||||
"mitra-models",
|
||||
"mitra-utils",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
mitra-config = { path = "mitra-config" }
|
||||
mitra-models = { path = "mitra-models" }
|
||||
mitra-utils = { path = "mitra-utils" }
|
||||
|
||||
# Used to handle incoming HTTP requests
|
||||
|
@ -38,9 +41,6 @@ anyhow = "1.0.58"
|
|||
base64 = "0.13.0"
|
||||
# Used for working with dates
|
||||
chrono = { version = "0.4.23", default-features = false, features = ["std", "serde"] }
|
||||
# Used for pooling database connections
|
||||
deadpool = "0.9.2"
|
||||
deadpool-postgres = { version = "0.10.2", default-features = false }
|
||||
# Used to work with hexadecimal strings
|
||||
hex = { version = "0.4.3", features = ["serde"] }
|
||||
# Used for logging
|
||||
|
@ -56,8 +56,6 @@ monero-rpc = "0.3.2"
|
|||
num_cpus = "1.13.0"
|
||||
# Used for working with regular expressions
|
||||
regex = "1.6.0"
|
||||
# Used for managing database migrations
|
||||
refinery = { version = "0.8.4", features = ["tokio-postgres"] }
|
||||
# Used for making async HTTP requests
|
||||
reqwest = { version = "0.11.13", features = ["json", "multipart", "socks"] }
|
||||
# Used for working with RSA keys
|
||||
|
@ -75,13 +73,6 @@ siwe = "0.4.0"
|
|||
thiserror = "1.0.37"
|
||||
# Async runtime
|
||||
tokio = { version = "1.20.4", features = ["macros"] }
|
||||
# Used for working with Postgresql database
|
||||
tokio-postgres = { version = "0.7.6", features = ["with-chrono-0_4", "with-uuid-1", "with-serde_json-1"] }
|
||||
postgres-types = { version = "0.2.3", features = ["derive", "with-chrono-0_4", "with-uuid-1", "with-serde_json-1"] }
|
||||
postgres-protocol = "0.6.4"
|
||||
# Used to construct PostgreSQL queries
|
||||
postgres_query = { git = "https://github.com/nolanderc/rust-postgres-query", rev = "b4422051c8a31fbba4a35f88004c1cefb1878dd5" }
|
||||
postgres_query_macro = { git = "https://github.com/nolanderc/rust-postgres-query", rev = "b4422051c8a31fbba4a35f88004c1cefb1878dd5" }
|
||||
# Used to work with URLs
|
||||
url = "2.2.2"
|
||||
# Used to work with UUIDs
|
||||
|
@ -91,6 +82,7 @@ web3 = { version = "0.18.0", default-features = false, features = ["http", "http
|
|||
|
||||
[dev-dependencies]
|
||||
mitra-config = { path = "mitra-config", features = ["test-utils"] }
|
||||
mitra-models = { path = "mitra-models", features = ["test-utils"] }
|
||||
mitra-utils = { path = "mitra-utils", features = ["test-utils"] }
|
||||
|
||||
serial_test = "0.7.0"
|
||||
|
|
|
@ -11,6 +11,7 @@ path = "src/main.rs"
|
|||
|
||||
[dependencies]
|
||||
mitra-config = { path = "../mitra-config" }
|
||||
mitra-models = { path = "../mitra-models" }
|
||||
mitra-utils = { path = "../mitra-utils" }
|
||||
mitra = { path = ".." }
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ use mitra::activitypub::{
|
|||
builders::delete_person::prepare_delete_person,
|
||||
fetcher::fetchers::fetch_actor,
|
||||
};
|
||||
use mitra::database::DatabaseClient;
|
||||
use mitra::ethereum::{
|
||||
signatures::generate_ecdsa_key,
|
||||
sync::save_current_block_number,
|
||||
|
@ -19,9 +18,16 @@ use mitra::media::{
|
|||
remove_media,
|
||||
MediaStorage,
|
||||
};
|
||||
use mitra::models::{
|
||||
use mitra::monero::{
|
||||
helpers::check_expired_invoice,
|
||||
wallet::create_monero_wallet,
|
||||
};
|
||||
use mitra::validators::emojis::EMOJI_LOCAL_MAX_SIZE;
|
||||
use mitra_config::Config;
|
||||
use mitra_models::{
|
||||
attachments::queries::delete_unused_attachments,
|
||||
cleanup::find_orphaned_files,
|
||||
database::DatabaseClient,
|
||||
emojis::helpers::get_emoji_by_name,
|
||||
emojis::queries::{
|
||||
create_emoji,
|
||||
|
@ -48,12 +54,6 @@ use mitra::models::{
|
|||
},
|
||||
users::types::Role,
|
||||
};
|
||||
use mitra::monero::{
|
||||
helpers::check_expired_invoice,
|
||||
wallet::create_monero_wallet,
|
||||
};
|
||||
use mitra::validators::emojis::EMOJI_LOCAL_MAX_SIZE;
|
||||
use mitra_config::Config;
|
||||
use mitra_utils::{
|
||||
crypto_rsa::{
|
||||
generate_rsa_key,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use clap::Parser;
|
||||
|
||||
use mitra::database::create_database_client;
|
||||
use mitra::database::migrate::apply_migrations;
|
||||
use mitra::logger::configure_logger;
|
||||
use mitra_config::parse_config;
|
||||
use mitra_models::database::create_database_client;
|
||||
use mitra_models::database::migrate::apply_migrations;
|
||||
|
||||
mod cli;
|
||||
use cli::{Opts, SubCommand};
|
||||
|
|
45
mitra-models/Cargo.toml
Normal file
45
mitra-models/Cargo.toml
Normal file
|
@ -0,0 +1,45 @@
|
|||
[package]
|
||||
name = "mitra-models"
|
||||
version = "1.19.0"
|
||||
license = "AGPL-3.0"
|
||||
edition = "2021"
|
||||
rust-version = "1.56"
|
||||
|
||||
[dependencies]
|
||||
mitra-utils = { path = "../mitra-utils" }
|
||||
|
||||
# Used for working with dates
|
||||
chrono = { version = "0.4.23", default-features = false, features = ["std", "serde"] }
|
||||
# Used for pooling database connections
|
||||
deadpool = "0.9.2"
|
||||
deadpool-postgres = { version = "0.10.2", default-features = false }
|
||||
# Used to work with hexadecimal strings
|
||||
hex = { version = "0.4.3", features = ["serde"] }
|
||||
# Used for logging
|
||||
log = "0.4.14"
|
||||
# Used for managing database migrations
|
||||
refinery = { version = "0.8.4", features = ["tokio-postgres"] }
|
||||
# Used for serialization/deserialization
|
||||
serde = { version = "1.0.136", features = ["derive"] }
|
||||
serde_json = "1.0.89"
|
||||
# Used for creating error types
|
||||
thiserror = "1.0.37"
|
||||
# Async runtime
|
||||
tokio = { version = "1.20.4", features = [] }
|
||||
# Used for working with Postgresql database
|
||||
tokio-postgres = { version = "0.7.6", features = ["with-chrono-0_4", "with-uuid-1", "with-serde_json-1"] }
|
||||
postgres-types = { version = "0.2.3", features = ["derive", "with-chrono-0_4", "with-uuid-1", "with-serde_json-1"] }
|
||||
postgres-protocol = "0.6.4"
|
||||
# Used to construct PostgreSQL queries
|
||||
postgres_query = { git = "https://github.com/nolanderc/rust-postgres-query", rev = "b4422051c8a31fbba4a35f88004c1cefb1878dd5" }
|
||||
postgres_query_macro = { git = "https://github.com/nolanderc/rust-postgres-query", rev = "b4422051c8a31fbba4a35f88004c1cefb1878dd5" }
|
||||
# Used to work with UUIDs
|
||||
uuid = { version = "1.1.2", features = ["serde", "v4"] }
|
||||
|
||||
[dev-dependencies]
|
||||
mitra-utils = { path = "../mitra-utils", features = ["test-utils"] }
|
||||
|
||||
serial_test = "0.7.0"
|
||||
|
||||
[features]
|
||||
test-utils = []
|
|
@ -3,12 +3,13 @@ use uuid::Uuid;
|
|||
|
||||
use mitra_utils::id::generate_ulid;
|
||||
|
||||
use crate::database::{DatabaseClient, DatabaseError};
|
||||
use crate::models::cleanup::{
|
||||
use crate::cleanup::{
|
||||
find_orphaned_files,
|
||||
find_orphaned_ipfs_objects,
|
||||
DeletionQueue,
|
||||
};
|
||||
use crate::database::{DatabaseClient, DatabaseError};
|
||||
|
||||
use super::types::DbMediaAttachment;
|
||||
|
||||
pub async fn create_attachment(
|
||||
|
@ -97,9 +98,9 @@ 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,
|
||||
profiles::queries::create_profile,
|
||||
use crate::profiles::{
|
||||
queries::create_profile,
|
||||
types::ProfileCreateData,
|
||||
};
|
||||
use super::*;
|
||||
|
|
@ -6,7 +6,7 @@ pub mod json_macro;
|
|||
pub mod migrate;
|
||||
pub mod query_macro;
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(feature = "test-utils")]
|
||||
pub mod test_utils;
|
||||
|
||||
pub type DbPool = deadpool_postgres::Pool;
|
|
@ -1,4 +1,5 @@
|
|||
use crate::database::{DatabaseClient, DatabaseError};
|
||||
|
||||
use super::types::DbEmoji;
|
||||
use super::queries::{
|
||||
get_local_emoji_by_name,
|
|
@ -3,16 +3,15 @@ use uuid::Uuid;
|
|||
|
||||
use mitra_utils::id::generate_ulid;
|
||||
|
||||
use crate::cleanup::{find_orphaned_files, DeletionQueue};
|
||||
use crate::database::{
|
||||
catch_unique_violation,
|
||||
DatabaseClient,
|
||||
DatabaseError,
|
||||
};
|
||||
use crate::models::{
|
||||
cleanup::{find_orphaned_files, DeletionQueue},
|
||||
instances::queries::create_instance,
|
||||
profiles::queries::update_emoji_caches,
|
||||
};
|
||||
use crate::instances::queries::create_instance;
|
||||
use crate::profiles::queries::update_emoji_caches;
|
||||
|
||||
use super::types::{DbEmoji, EmojiImage};
|
||||
|
||||
pub async fn create_emoji(
|
|
@ -9,7 +9,7 @@ use crate::database::json_macro::{json_from_sql, json_to_sql};
|
|||
fn default_emoji_file_size() -> usize { 250 * 1000 }
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[cfg_attr(test, derive(Default))]
|
||||
#[cfg_attr(feature = "test-utils", derive(Default))]
|
||||
pub struct EmojiImage {
|
||||
pub file_name: String,
|
||||
#[serde(default = "default_emoji_file_size")]
|
||||
|
@ -21,7 +21,7 @@ json_from_sql!(EmojiImage);
|
|||
json_to_sql!(EmojiImage);
|
||||
|
||||
#[derive(Clone, Deserialize, FromSql)]
|
||||
#[cfg_attr(test, derive(Default))]
|
||||
#[cfg_attr(feature = "test-utils", derive(Default))]
|
||||
#[postgres(name = "emoji")]
|
||||
pub struct DbEmoji {
|
||||
pub id: Uuid,
|
|
@ -10,6 +10,7 @@ use crate::database::{
|
|||
DatabaseClient,
|
||||
DatabaseError,
|
||||
};
|
||||
|
||||
use super::types::{DbChainId, DbInvoice, InvoiceStatus};
|
||||
|
||||
pub async fn create_invoice(
|
||||
|
@ -120,11 +121,13 @@ pub async fn set_invoice_status(
|
|||
mod tests {
|
||||
use serial_test::serial;
|
||||
use crate::database::test_utils::create_test_database;
|
||||
use crate::models::{
|
||||
profiles::queries::create_profile,
|
||||
profiles::types::ProfileCreateData,
|
||||
users::queries::create_user,
|
||||
users::types::UserCreateData,
|
||||
use crate::profiles::{
|
||||
queries::create_profile,
|
||||
types::ProfileCreateData,
|
||||
};
|
||||
use crate::users::{
|
||||
queries::create_user,
|
||||
types::UserCreateData,
|
||||
};
|
||||
use super::*;
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
pub mod attachments;
|
||||
pub mod background_jobs;
|
||||
pub mod database;
|
||||
pub mod cleanup;
|
||||
pub mod emojis;
|
||||
pub mod instances;
|
|
@ -1,9 +1,9 @@
|
|||
use uuid::Uuid;
|
||||
|
||||
use crate::database::{DatabaseClient, DatabaseError};
|
||||
use crate::models::{
|
||||
posts::helpers::{add_related_posts, add_user_actions},
|
||||
posts::queries::{
|
||||
use crate::posts::{
|
||||
helpers::{add_related_posts, add_user_actions},
|
||||
queries::{
|
||||
RELATED_ATTACHMENTS,
|
||||
RELATED_EMOJIS,
|
||||
RELATED_LINKS,
|
||||
|
@ -11,6 +11,7 @@ use crate::models::{
|
|||
RELATED_TAGS,
|
||||
},
|
||||
};
|
||||
|
||||
use super::types::{EventType, Notification};
|
||||
|
||||
async fn create_notification(
|
|
@ -3,17 +3,15 @@ use postgres_types::FromSql;
|
|||
use tokio_postgres::Row;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::attachments::types::DbMediaAttachment;
|
||||
use crate::database::{
|
||||
int_enum::{int_enum_from_sql, int_enum_to_sql},
|
||||
DatabaseError,
|
||||
DatabaseTypeError,
|
||||
};
|
||||
use crate::models::{
|
||||
attachments::types::DbMediaAttachment,
|
||||
emojis::types::DbEmoji,
|
||||
posts::types::{DbPost, Post},
|
||||
profiles::types::DbActorProfile,
|
||||
};
|
||||
use crate::emojis::types::DbEmoji;
|
||||
use crate::posts::types::{DbPost, Post};
|
||||
use crate::profiles::types::DbActorProfile;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum EventType {
|
|
@ -6,10 +6,9 @@ use crate::database::{
|
|||
DatabaseClient,
|
||||
DatabaseError,
|
||||
};
|
||||
use crate::models::{
|
||||
profiles::types::DbActorProfile,
|
||||
users::types::{DbUser, User},
|
||||
};
|
||||
use crate::profiles::types::DbActorProfile;
|
||||
use crate::users::types::{DbUser, User};
|
||||
|
||||
use super::types::{DbOauthApp, DbOauthAppData};
|
||||
|
||||
pub async fn create_oauth_app(
|
||||
|
@ -200,8 +199,10 @@ pub async fn get_user_by_oauth_token(
|
|||
mod tests {
|
||||
use serial_test::serial;
|
||||
use crate::database::test_utils::create_test_database;
|
||||
use crate::models::users::queries::create_user;
|
||||
use crate::models::users::types::UserCreateData;
|
||||
use crate::users::{
|
||||
queries::create_user,
|
||||
types::UserCreateData,
|
||||
};
|
||||
use super::*;
|
||||
|
||||
#[tokio::test]
|
|
@ -1,12 +1,13 @@
|
|||
use uuid::Uuid;
|
||||
|
||||
use crate::database::{DatabaseClient, DatabaseError};
|
||||
use crate::models::{
|
||||
reactions::queries::find_favourited_by_user,
|
||||
relationships::queries::has_relationship,
|
||||
relationships::types::RelationshipType,
|
||||
users::types::{Permission, User},
|
||||
use crate::reactions::queries::find_favourited_by_user;
|
||||
use crate::relationships::{
|
||||
queries::has_relationship,
|
||||
types::RelationshipType,
|
||||
};
|
||||
use crate::users::types::{Permission, User};
|
||||
|
||||
use super::queries::{
|
||||
get_post_by_id,
|
||||
get_related_posts,
|
||||
|
@ -145,12 +146,14 @@ 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,
|
||||
posts::types::PostCreateData,
|
||||
relationships::queries::{follow, subscribe},
|
||||
users::queries::create_user,
|
||||
users::types::{Role, User, UserCreateData},
|
||||
use crate::posts::{
|
||||
queries::create_post,
|
||||
types::PostCreateData,
|
||||
};
|
||||
use crate::relationships::queries::{follow, subscribe};
|
||||
use crate::users::{
|
||||
queries::create_user,
|
||||
types::{Role, User, UserCreateData},
|
||||
};
|
||||
use super::*;
|
||||
|
|
@ -3,30 +3,33 @@ use uuid::Uuid;
|
|||
|
||||
use mitra_utils::id::generate_ulid;
|
||||
|
||||
use crate::attachments::{
|
||||
queries::set_attachment_ipfs_cid,
|
||||
types::DbMediaAttachment,
|
||||
};
|
||||
use crate::cleanup::{
|
||||
find_orphaned_files,
|
||||
find_orphaned_ipfs_objects,
|
||||
DeletionQueue,
|
||||
};
|
||||
use crate::database::{
|
||||
catch_unique_violation,
|
||||
query_macro::query,
|
||||
DatabaseClient,
|
||||
DatabaseError,
|
||||
};
|
||||
use crate::models::{
|
||||
attachments::queries::set_attachment_ipfs_cid,
|
||||
attachments::types::DbMediaAttachment,
|
||||
cleanup::{
|
||||
find_orphaned_files,
|
||||
find_orphaned_ipfs_objects,
|
||||
DeletionQueue,
|
||||
},
|
||||
emojis::types::DbEmoji,
|
||||
notifications::queries::{
|
||||
use crate::emojis::types::DbEmoji;
|
||||
use crate::notifications::queries::{
|
||||
create_mention_notification,
|
||||
create_reply_notification,
|
||||
create_repost_notification,
|
||||
},
|
||||
profiles::queries::update_post_count,
|
||||
profiles::types::DbActorProfile,
|
||||
relationships::types::RelationshipType,
|
||||
};
|
||||
use crate::profiles::{
|
||||
queries::update_post_count,
|
||||
types::DbActorProfile,
|
||||
};
|
||||
use crate::relationships::types::RelationshipType;
|
||||
|
||||
use super::types::{
|
||||
DbPost,
|
||||
Post,
|
||||
|
@ -1308,16 +1311,18 @@ mod tests {
|
|||
use chrono::Duration;
|
||||
use serial_test::serial;
|
||||
use crate::database::test_utils::create_test_database;
|
||||
use crate::models::{
|
||||
profiles::queries::create_profile,
|
||||
profiles::types::ProfileCreateData,
|
||||
relationships::queries::{
|
||||
use crate::profiles::{
|
||||
queries::create_profile,
|
||||
types::ProfileCreateData,
|
||||
};
|
||||
use crate::relationships::queries::{
|
||||
follow,
|
||||
hide_reposts,
|
||||
subscribe,
|
||||
},
|
||||
users::queries::create_user,
|
||||
users::types::UserCreateData,
|
||||
};
|
||||
use crate::users::{
|
||||
queries::create_user,
|
||||
types::UserCreateData,
|
||||
};
|
||||
use super::*;
|
||||
|
|
@ -3,16 +3,14 @@ use postgres_types::FromSql;
|
|||
use tokio_postgres::Row;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::attachments::types::DbMediaAttachment;
|
||||
use crate::database::{
|
||||
int_enum::{int_enum_from_sql, int_enum_to_sql},
|
||||
DatabaseError,
|
||||
DatabaseTypeError,
|
||||
};
|
||||
use crate::models::{
|
||||
attachments::types::DbMediaAttachment,
|
||||
emojis::types::DbEmoji,
|
||||
profiles::types::DbActorProfile,
|
||||
};
|
||||
use crate::emojis::types::DbEmoji;
|
||||
use crate::profiles::types::DbActorProfile;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum Visibility {
|
||||
|
@ -182,7 +180,7 @@ impl Post {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(feature = "test-utils")]
|
||||
impl Default for Post {
|
||||
fn default() -> Self {
|
||||
Self {
|
|
@ -1,4 +1,5 @@
|
|||
use crate::database::{DatabaseClient, DatabaseError};
|
||||
|
||||
use super::queries::search_profiles_by_did_only;
|
||||
use super::types::DbActorProfile;
|
||||
|
|
@ -8,22 +8,21 @@ use mitra_utils::{
|
|||
id::generate_ulid,
|
||||
};
|
||||
|
||||
use crate::cleanup::{
|
||||
find_orphaned_files,
|
||||
find_orphaned_ipfs_objects,
|
||||
DeletionQueue,
|
||||
};
|
||||
use crate::database::{
|
||||
catch_unique_violation,
|
||||
query_macro::query,
|
||||
DatabaseClient,
|
||||
DatabaseError,
|
||||
};
|
||||
use crate::models::{
|
||||
cleanup::{
|
||||
find_orphaned_files,
|
||||
find_orphaned_ipfs_objects,
|
||||
DeletionQueue,
|
||||
},
|
||||
emojis::types::DbEmoji,
|
||||
instances::queries::create_instance,
|
||||
relationships::types::RelationshipType,
|
||||
};
|
||||
use crate::emojis::types::DbEmoji;
|
||||
use crate::instances::queries::create_instance;
|
||||
use crate::relationships::types::RelationshipType;
|
||||
|
||||
use super::types::{
|
||||
Aliases,
|
||||
DbActorProfile,
|
||||
|
@ -829,19 +828,23 @@ pub async fn find_empty_profiles(
|
|||
mod tests {
|
||||
use serial_test::serial;
|
||||
use crate::database::test_utils::create_test_database;
|
||||
use crate::models::{
|
||||
emojis::queries::create_emoji,
|
||||
emojis::types::EmojiImage,
|
||||
profiles::queries::create_profile,
|
||||
profiles::types::{
|
||||
use crate::emojis::{
|
||||
queries::create_emoji,
|
||||
types::EmojiImage,
|
||||
};
|
||||
use crate::profiles::{
|
||||
queries::create_profile,
|
||||
types::{
|
||||
DbActor,
|
||||
ExtraField,
|
||||
IdentityProof,
|
||||
IdentityProofType,
|
||||
ProfileCreateData,
|
||||
},
|
||||
users::queries::create_user,
|
||||
users::types::UserCreateData,
|
||||
};
|
||||
use crate::users::{
|
||||
queries::create_user,
|
||||
types::UserCreateData,
|
||||
};
|
||||
use super::*;
|
||||
|
|
@ -17,7 +17,7 @@ use crate::database::{
|
|||
json_macro::{json_from_sql, json_to_sql},
|
||||
DatabaseTypeError,
|
||||
};
|
||||
use crate::models::emojis::types::DbEmoji;
|
||||
use crate::emojis::types::DbEmoji;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct ProfileImage {
|
||||
|
@ -334,7 +334,7 @@ impl ProfileEmojis {
|
|||
json_from_sql!(ProfileEmojis);
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[cfg_attr(test, derive(Default))]
|
||||
#[cfg_attr(feature = "test-utils", derive(Default))]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct DbActorPublicKey {
|
||||
pub id: String,
|
||||
|
@ -343,7 +343,7 @@ pub struct DbActorPublicKey {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
#[cfg_attr(test, derive(Default))]
|
||||
#[cfg_attr(feature = "test-utils", derive(Default))]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct DbActor {
|
||||
#[serde(rename = "type")]
|
||||
|
@ -422,7 +422,7 @@ impl DbActorProfile {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(feature = "test-utils")]
|
||||
impl Default for DbActorProfile {
|
||||
fn default() -> Self {
|
||||
let now = Utc::now();
|
||||
|
@ -455,7 +455,7 @@ impl Default for DbActorProfile {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(test, derive(Default))]
|
||||
#[cfg_attr(feature = "test-utils", derive(Default))]
|
||||
pub struct ProfileCreateData {
|
||||
pub username: String,
|
||||
pub hostname: Option<String>,
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue