mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-09-02 19:23:49 +00:00
Small lemmy_api_common
/db_views
fixes/tweaks (#5783)
* Refactor Taglines * Include crate ts-rs dependencies when needed, move some views to account_management views * Re export NotePerson from lemmy_api_common * Remove unused "full" feature from lemmy_db_views_tagline * Replace "full" feature in lemmy_api_common with "ts-rs" * Remove newly added db_views crates and put structs in existing db_views crates
This commit is contained in:
parent
38e87f6dc4
commit
d1aed75956
83 changed files with 564 additions and 569 deletions
31
Cargo.lock
generated
31
Cargo.lock
generated
|
@ -3101,7 +3101,6 @@ dependencies = [
|
|||
"lemmy_api_utils",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_api_misc",
|
||||
"lemmy_db_views_comment",
|
||||
"lemmy_db_views_community",
|
||||
"lemmy_db_views_community_follower",
|
||||
|
@ -3138,7 +3137,6 @@ version = "1.0.0-alpha.5"
|
|||
dependencies = [
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_api_misc",
|
||||
"lemmy_db_views_comment",
|
||||
"lemmy_db_views_community",
|
||||
"lemmy_db_views_community_follower",
|
||||
|
@ -3180,7 +3178,6 @@ dependencies = [
|
|||
"lemmy_api_utils",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_api_misc",
|
||||
"lemmy_db_views_comment",
|
||||
"lemmy_db_views_community",
|
||||
"lemmy_db_views_community_follower",
|
||||
|
@ -3222,7 +3219,6 @@ dependencies = [
|
|||
"jsonwebtoken",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_api_misc",
|
||||
"lemmy_db_views_comment",
|
||||
"lemmy_db_views_community",
|
||||
"lemmy_db_views_community_follower",
|
||||
|
@ -3274,7 +3270,6 @@ dependencies = [
|
|||
"lemmy_apub_objects",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_api_misc",
|
||||
"lemmy_db_views_comment",
|
||||
"lemmy_db_views_community",
|
||||
"lemmy_db_views_community_follower",
|
||||
|
@ -3391,24 +3386,6 @@ dependencies = [
|
|||
"ts-rs",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_api_misc"
|
||||
version = "1.0.0-alpha.5"
|
||||
dependencies = [
|
||||
"extism",
|
||||
"extism-convert",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_community_follower",
|
||||
"lemmy_db_views_community_moderator",
|
||||
"lemmy_db_views_local_user",
|
||||
"lemmy_db_views_post",
|
||||
"serde",
|
||||
"serde_with",
|
||||
"ts-rs",
|
||||
"url",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lemmy_db_views_comment"
|
||||
version = "1.0.0-alpha.5"
|
||||
|
@ -3798,10 +3775,15 @@ dependencies = [
|
|||
"chrono",
|
||||
"diesel",
|
||||
"diesel-async",
|
||||
"extism",
|
||||
"extism-convert",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_api_misc",
|
||||
"lemmy_db_views_community_follower",
|
||||
"lemmy_db_views_community_moderator",
|
||||
"lemmy_db_views_local_user",
|
||||
"lemmy_db_views_person",
|
||||
"lemmy_db_views_post",
|
||||
"lemmy_db_views_readable_federation_state",
|
||||
"lemmy_utils",
|
||||
"serde",
|
||||
|
@ -3896,7 +3878,6 @@ dependencies = [
|
|||
"lemmy_api_utils",
|
||||
"lemmy_db_schema",
|
||||
"lemmy_db_schema_file",
|
||||
"lemmy_db_views_api_misc",
|
||||
"lemmy_db_views_community",
|
||||
"lemmy_db_views_inbox_combined",
|
||||
"lemmy_db_views_local_image",
|
||||
|
|
|
@ -51,7 +51,6 @@ members = [
|
|||
"crates/utils",
|
||||
"crates/db_schema",
|
||||
"crates/db_schema_file",
|
||||
"crates/db_views/api_misc",
|
||||
"crates/db_views/private_message",
|
||||
"crates/db_views/local_user",
|
||||
"crates/db_views/local_image",
|
||||
|
@ -118,7 +117,6 @@ lemmy_api_utils = { version = "=1.0.0-alpha.5", path = "./crates/api/api_utils"
|
|||
lemmy_routes = { version = "=1.0.0-alpha.5", path = "./crates/routes" }
|
||||
lemmy_federate = { version = "=1.0.0-alpha.5", path = "./crates/federate" }
|
||||
lemmy_email = { version = "=1.0.0-alpha.5", path = "./crates/email" }
|
||||
lemmy_db_views_api_misc = { version = "=1.0.0-alpha.5", path = "./crates/db_views/api_misc" }
|
||||
lemmy_db_views_comment = { version = "=1.0.0-alpha.5", path = "./crates/db_views/comment" }
|
||||
lemmy_db_views_community = { version = "=1.0.0-alpha.5", path = "./crates/db_views/community" }
|
||||
lemmy_db_views_community_follower = { version = "=1.0.0-alpha.5", path = "./crates/db_views/community_follower" }
|
||||
|
|
|
@ -19,7 +19,6 @@ doctest = false
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_api_misc = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_comment = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_community = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_community_moderator = { workspace = true, features = ["full"] }
|
||||
|
|
|
@ -6,9 +6,9 @@ use lemmy_api_utils::{
|
|||
utils::is_mod_or_admin,
|
||||
};
|
||||
use lemmy_db_schema::{source::community::CommunityActions, traits::Followable};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_community::api::ApproveCommunityPendingFollower;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn post_pending_follows_approve(
|
||||
|
|
|
@ -5,8 +5,8 @@ use actix_web::{
|
|||
use bcrypt::verify;
|
||||
use lemmy_api_utils::{claims::Claims, context::LemmyContext, utils::password_length_check};
|
||||
use lemmy_db_schema::source::{local_user::LocalUser, login_token::LoginToken};
|
||||
use lemmy_db_views_api_misc::{ChangePassword, LoginResponse};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::{ChangePassword, LoginResponse};
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn change_password(
|
||||
|
|
|
@ -5,7 +5,7 @@ use lemmy_db_schema::source::{
|
|||
login_token::LoginToken,
|
||||
password_reset_request::PasswordResetRequest,
|
||||
};
|
||||
use lemmy_db_views_api_misc::{PasswordChangeAfterReset, SuccessResponse};
|
||||
use lemmy_db_views_site::api::{PasswordChangeAfterReset, SuccessResponse};
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn change_password_after_reset(
|
||||
|
|
|
@ -2,8 +2,8 @@ use actix_web::web::{Data, Json};
|
|||
use chrono::Utc;
|
||||
use lemmy_api_utils::context::LemmyContext;
|
||||
use lemmy_db_schema::source::local_user::{LocalUser, LocalUserUpdateForm};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn donation_dialog_shown(
|
||||
|
|
|
@ -6,8 +6,8 @@ use lemmy_db_schema::source::{
|
|||
local_user::{LocalUser, LocalUserUpdateForm},
|
||||
site::Site,
|
||||
};
|
||||
use lemmy_db_views_api_misc::GenerateTotpSecretResponse;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::GenerateTotpSecretResponse;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
/// Generate a new secret for two-factor-authentication. Afterwards you need to call [toggle_totp]
|
||||
|
|
|
@ -11,8 +11,10 @@ use actix_web::{
|
|||
use captcha::{generate, Difficulty};
|
||||
use lemmy_api_utils::context::LemmyContext;
|
||||
use lemmy_db_schema::source::captcha_answer::{CaptchaAnswer, CaptchaAnswerForm};
|
||||
use lemmy_db_views_api_misc::{CaptchaResponse, GetCaptchaResponse};
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_db_views_site::{
|
||||
api::{CaptchaResponse, GetCaptchaResponse},
|
||||
SiteView,
|
||||
};
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn get_captcha(context: Data<LemmyContext>) -> LemmyResult<HttpResponse> {
|
||||
|
|
|
@ -2,9 +2,9 @@ use activitypub_federation::config::Data;
|
|||
use actix_web::web::{Json, Query};
|
||||
use lemmy_api_utils::context::LemmyContext;
|
||||
use lemmy_db_schema::source::post::PostActions;
|
||||
use lemmy_db_views_api_misc::{ListPersonHidden, ListPersonHiddenResponse};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_post::PostView;
|
||||
use lemmy_db_views_site::api::{ListPersonHidden, ListPersonHiddenResponse};
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn list_person_hidden(
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use actix_web::web::{Data, Json};
|
||||
use lemmy_api_utils::context::LemmyContext;
|
||||
use lemmy_db_schema::source::login_token::LoginToken;
|
||||
use lemmy_db_views_api_misc::ListLoginsResponse;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::ListLoginsResponse;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn list_logins(
|
||||
|
|
|
@ -2,9 +2,9 @@ use activitypub_federation::config::Data;
|
|||
use actix_web::web::{Json, Query};
|
||||
use lemmy_api_utils::context::LemmyContext;
|
||||
use lemmy_db_schema::source::post::PostActions;
|
||||
use lemmy_db_views_api_misc::{ListPersonRead, ListPersonReadResponse};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_post::PostView;
|
||||
use lemmy_db_views_site::api::{ListPersonRead, ListPersonReadResponse};
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn list_person_read(
|
||||
|
|
|
@ -9,9 +9,11 @@ use lemmy_api_utils::{
|
|||
context::LemmyContext,
|
||||
utils::{check_email_verified, check_local_user_deleted, check_registration_application},
|
||||
};
|
||||
use lemmy_db_views_api_misc::{Login, LoginResponse};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_db_views_site::{
|
||||
api::{Login, LoginResponse},
|
||||
SiteView,
|
||||
};
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn login(
|
||||
|
|
|
@ -5,8 +5,8 @@ use lemmy_api_utils::{
|
|||
utils::{read_auth_token, AUTH_COOKIE_NAME},
|
||||
};
|
||||
use lemmy_db_schema::source::login_token::LoginToken;
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn logout(
|
||||
|
|
|
@ -4,8 +4,9 @@ use lemmy_api_utils::{
|
|||
utils::{get_url_blocklist, process_markdown, slur_regex},
|
||||
};
|
||||
use lemmy_db_schema::source::person::{PersonActions, PersonNoteForm};
|
||||
use lemmy_db_views_api_misc::{NotePerson, SuccessResponse};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_person::api::NotePerson;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorType, LemmyResult},
|
||||
utils::{slurs::check_slurs, validation::is_valid_body_field},
|
||||
|
|
|
@ -6,8 +6,8 @@ use lemmy_db_schema::source::{
|
|||
person_post_mention::PersonPostMention,
|
||||
private_message::PrivateMessage,
|
||||
};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn mark_all_notifications_read(
|
||||
|
|
|
@ -4,9 +4,9 @@ use lemmy_db_schema::{
|
|||
source::person_comment_mention::{PersonCommentMention, PersonCommentMentionUpdateForm},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_inbox_combined::api::MarkPersonCommentMentionAsRead;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn mark_comment_mention_as_read(
|
||||
|
|
|
@ -4,9 +4,9 @@ use lemmy_db_schema::{
|
|||
source::person_post_mention::{PersonPostMention, PersonPostMentionUpdateForm},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_inbox_combined::api::MarkPersonPostMentionAsRead;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn mark_post_mention_as_read(
|
||||
|
|
|
@ -4,9 +4,9 @@ use lemmy_db_schema::{
|
|||
source::comment_reply::{CommentReply, CommentReplyUpdateForm},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_inbox_combined::api::MarkCommentReplyAsRead;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn mark_reply_as_read(
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
use actix_web::web::{Data, Json};
|
||||
use lemmy_api_utils::context::LemmyContext;
|
||||
use lemmy_db_views_api_misc::{ResendVerificationEmail, SuccessResponse};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_db_views_site::{
|
||||
api::{ResendVerificationEmail, SuccessResponse},
|
||||
SiteView,
|
||||
};
|
||||
use lemmy_email::account::send_verification_email_if_required;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
use actix_web::web::{Data, Json};
|
||||
use lemmy_api_utils::{context::LemmyContext, utils::check_email_verified};
|
||||
use lemmy_db_views_api_misc::{PasswordReset, SuccessResponse};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_db_views_site::{
|
||||
api::{PasswordReset, SuccessResponse},
|
||||
SiteView,
|
||||
};
|
||||
use lemmy_email::account::send_password_reset_email;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
use tracing::error;
|
||||
|
|
|
@ -14,9 +14,11 @@ use lemmy_db_schema::{
|
|||
traits::Crud,
|
||||
utils::{diesel_opt_number_update, diesel_string_update},
|
||||
};
|
||||
use lemmy_db_views_api_misc::{SaveUserSettings, SuccessResponse};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_db_views_site::{
|
||||
api::{SaveUserSettings, SuccessResponse},
|
||||
SiteView,
|
||||
};
|
||||
use lemmy_email::account::send_verification_email;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorType, LemmyResult},
|
||||
|
|
|
@ -2,8 +2,8 @@ use crate::check_totp_2fa_valid;
|
|||
use actix_web::web::{Data, Json};
|
||||
use lemmy_api_utils::context::LemmyContext;
|
||||
use lemmy_db_schema::source::local_user::{LocalUser, LocalUserUpdateForm};
|
||||
use lemmy_db_views_api_misc::{UpdateTotp, UpdateTotpResponse};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::{UpdateTotp, UpdateTotpResponse};
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
/// Enable or disable two-factor-authentication. The current setting is determined from
|
||||
|
|
|
@ -5,8 +5,8 @@ use lemmy_db_schema::{
|
|||
source::instance::{InstanceActions, InstanceBlockForm},
|
||||
traits::Blockable,
|
||||
};
|
||||
use lemmy_db_views_api_misc::{SuccessResponse, UserBlockInstanceParams};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::{SuccessResponse, UserBlockInstanceParams};
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn user_block_instance(
|
||||
|
|
|
@ -6,7 +6,7 @@ use lemmy_api_utils::{
|
|||
context::LemmyContext,
|
||||
utils::{local_user_view_from_jwt, read_auth_token},
|
||||
};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
/// Returns an error message if the auth token is invalid for any reason. Necessary because other
|
||||
|
|
|
@ -4,9 +4,11 @@ use lemmy_db_schema::source::{
|
|||
email_verification::EmailVerification,
|
||||
local_user::{LocalUser, LocalUserUpdateForm},
|
||||
};
|
||||
use lemmy_db_views_api_misc::{SuccessResponse, VerifyEmail};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_db_views_site::{
|
||||
api::{SuccessResponse, VerifyEmail},
|
||||
SiteView,
|
||||
};
|
||||
use lemmy_email::{account::send_email_verified_email, admin::send_new_applicant_email_to_admins};
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use actix_web::web::{Data, Json};
|
||||
use lemmy_api_utils::context::LemmyContext;
|
||||
use lemmy_db_schema::{source::post::PostActions, traits::Readable};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_post::api::MarkManyPostsAsRead;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult, MAX_API_PARAM_ELEMENTS};
|
||||
|
||||
pub async fn mark_posts_as_read(
|
||||
|
|
|
@ -4,9 +4,9 @@ use lemmy_db_schema::{
|
|||
source::private_message::{PrivateMessage, PrivateMessageUpdateForm},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_inbox_combined::api::MarkPrivateMessageAsRead;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn mark_pm_as_read(
|
||||
|
|
|
@ -9,9 +9,8 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::AdminAllowInstanceParams;
|
||||
use lemmy_db_views_site::api::{AdminAllowInstanceParams, SuccessResponse};
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn admin_allow_instance(
|
||||
|
|
|
@ -9,9 +9,8 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::AdminBlockInstanceParams;
|
||||
use lemmy_db_views_site::api::{AdminBlockInstanceParams, SuccessResponse};
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn admin_block_instance(
|
||||
|
|
|
@ -13,9 +13,9 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_comment::{api::PurgeComment, CommentView};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn purge_comment(
|
||||
|
|
|
@ -14,10 +14,10 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_community::api::PurgeCommunity;
|
||||
use lemmy_db_views_community_moderator::CommunityModeratorView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn purge_community(
|
||||
|
|
|
@ -14,9 +14,9 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::{Bannable, Crud},
|
||||
};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_person::api::PurgePerson;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn purge_person(
|
||||
|
|
|
@ -13,9 +13,9 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_post::api::PurgePost;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn purge_post(
|
||||
|
|
|
@ -18,40 +18,38 @@ doctest = false
|
|||
workspace = true
|
||||
|
||||
[features]
|
||||
full = [
|
||||
"lemmy_utils/full",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
"lemmy_db_views_api_misc/full",
|
||||
"lemmy_db_views_comment/full",
|
||||
"lemmy_db_views_community/full",
|
||||
"lemmy_db_views_community_follower/full",
|
||||
"lemmy_db_views_community_moderator/full",
|
||||
"lemmy_db_views_custom_emoji/full",
|
||||
"lemmy_db_views_inbox_combined/full",
|
||||
"lemmy_db_views_local_image/full",
|
||||
"lemmy_db_views_local_user/full",
|
||||
"lemmy_db_views_modlog_combined/full",
|
||||
"lemmy_db_views_person/full",
|
||||
"lemmy_db_views_person_content_combined/full",
|
||||
"lemmy_db_views_person_liked_combined/full",
|
||||
"lemmy_db_views_person_saved_combined/full",
|
||||
"lemmy_db_views_post/full",
|
||||
"lemmy_db_views_private_message/full",
|
||||
"lemmy_db_views_readable_federation_state/full",
|
||||
"lemmy_db_views_registration_applications/full",
|
||||
"lemmy_db_views_report_combined/full",
|
||||
"lemmy_db_views_reports/full",
|
||||
"lemmy_db_views_search_combined/full",
|
||||
"lemmy_db_views_site/full",
|
||||
"lemmy_db_views_vote/full",
|
||||
ts-rs = [
|
||||
"lemmy_utils/ts-rs",
|
||||
"lemmy_db_schema/ts-rs",
|
||||
"lemmy_db_schema_file/ts-rs",
|
||||
"lemmy_db_views_comment/ts-rs",
|
||||
"lemmy_db_views_community/ts-rs",
|
||||
"lemmy_db_views_community_follower/ts-rs",
|
||||
"lemmy_db_views_community_moderator/ts-rs",
|
||||
"lemmy_db_views_custom_emoji/ts-rs",
|
||||
"lemmy_db_views_inbox_combined/ts-rs",
|
||||
"lemmy_db_views_local_image/ts-rs",
|
||||
"lemmy_db_views_local_user/ts-rs",
|
||||
"lemmy_db_views_modlog_combined/ts-rs",
|
||||
"lemmy_db_views_person/ts-rs",
|
||||
"lemmy_db_views_person_content_combined/ts-rs",
|
||||
"lemmy_db_views_person_liked_combined/ts-rs",
|
||||
"lemmy_db_views_person_saved_combined/ts-rs",
|
||||
"lemmy_db_views_post/ts-rs",
|
||||
"lemmy_db_views_private_message/ts-rs",
|
||||
"lemmy_db_views_readable_federation_state/ts-rs",
|
||||
"lemmy_db_views_registration_applications/ts-rs",
|
||||
"lemmy_db_views_report_combined/ts-rs",
|
||||
"lemmy_db_views_reports/ts-rs",
|
||||
"lemmy_db_views_search_combined/ts-rs",
|
||||
"lemmy_db_views_site/ts-rs",
|
||||
"lemmy_db_views_vote/ts-rs",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
lemmy_utils.workspace = true
|
||||
lemmy_db_schema.workspace = true
|
||||
lemmy_db_schema_file.workspace = true
|
||||
lemmy_db_views_api_misc.workspace = true
|
||||
lemmy_db_views_comment.workspace = true
|
||||
lemmy_db_views_community.workspace = true
|
||||
lemmy_db_views_community_follower.workspace = true
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
pub use lemmy_db_views_api_misc::{
|
||||
DeleteAccount,
|
||||
ListPersonHidden,
|
||||
ListPersonHiddenResponse,
|
||||
ListPersonRead,
|
||||
ListPersonReadResponse,
|
||||
MyUserInfo,
|
||||
SaveUserSettings,
|
||||
};
|
||||
pub use lemmy_db_views_person_liked_combined::{
|
||||
ListPersonLiked,
|
||||
ListPersonLikedResponse,
|
||||
|
@ -17,10 +8,20 @@ pub use lemmy_db_views_person_saved_combined::{
|
|||
ListPersonSavedResponse,
|
||||
PersonSavedCombinedView,
|
||||
};
|
||||
pub use lemmy_db_views_site::api::{
|
||||
DeleteAccount,
|
||||
ListPersonHidden,
|
||||
ListPersonHiddenResponse,
|
||||
ListPersonRead,
|
||||
ListPersonReadResponse,
|
||||
MyUserInfo,
|
||||
SaveUserSettings,
|
||||
};
|
||||
|
||||
pub mod auth {
|
||||
pub use lemmy_db_schema::source::login_token::LoginToken;
|
||||
pub use lemmy_db_views_api_misc::{
|
||||
pub use lemmy_db_views_registration_applications::api::Register;
|
||||
pub use lemmy_db_views_site::api::{
|
||||
CaptchaResponse,
|
||||
ChangePassword,
|
||||
GenerateTotpSecretResponse,
|
||||
|
@ -35,5 +36,4 @@ pub mod auth {
|
|||
UpdateTotpResponse,
|
||||
VerifyEmail,
|
||||
};
|
||||
pub use lemmy_db_views_registration_applications::api::Register;
|
||||
}
|
||||
|
|
|
@ -8,12 +8,13 @@ pub use lemmy_db_schema::{
|
|||
},
|
||||
};
|
||||
pub use lemmy_db_schema_file::enums::FederationMode;
|
||||
pub use lemmy_db_views_api_misc::{ResolveObject, UserBlockInstanceParams};
|
||||
pub use lemmy_db_views_readable_federation_state::ReadableFederationState;
|
||||
pub use lemmy_db_views_site::api::{
|
||||
FederatedInstances,
|
||||
GetFederatedInstancesResponse,
|
||||
InstanceWithFederationState,
|
||||
ResolveObject,
|
||||
UserBlockInstanceParams,
|
||||
};
|
||||
|
||||
pub mod administration {
|
||||
|
|
|
@ -20,5 +20,5 @@ pub mod tagline;
|
|||
|
||||
pub use lemmy_db_schema::{newtypes::DbUrl, sensitive::SensitiveString};
|
||||
pub use lemmy_db_schema_file::enums::VoteShow;
|
||||
pub use lemmy_db_views_api_misc::SuccessResponse;
|
||||
pub use lemmy_db_views_site::api::SuccessResponse;
|
||||
pub use lemmy_db_views_vote::VoteView;
|
||||
|
|
|
@ -14,7 +14,7 @@ pub use lemmy_db_views_person::{
|
|||
|
||||
pub mod actions {
|
||||
pub use lemmy_db_schema::newtypes::PersonContentCombinedId;
|
||||
pub use lemmy_db_views_person::api::{BlockPerson, BlockPersonResponse};
|
||||
pub use lemmy_db_views_person::api::{BlockPerson, BlockPersonResponse, NotePerson};
|
||||
pub use lemmy_db_views_person_content_combined::{
|
||||
ListPersonContent,
|
||||
ListPersonContentResponse,
|
||||
|
|
|
@ -1 +1 @@
|
|||
pub use lemmy_db_views_api_misc::PluginMetadata;
|
||||
pub use lemmy_db_views_site::api::PluginMetadata;
|
||||
|
|
|
@ -2,5 +2,5 @@ pub use lemmy_db_schema::{newtypes::TaglineId, source::tagline::Tagline};
|
|||
pub use lemmy_db_views_site::api::{ListTaglines, ListTaglinesResponse, TaglineResponse};
|
||||
|
||||
pub mod aministration {
|
||||
pub use lemmy_db_views_site::api::{CreateSite, DeleteTagline, UpdateTagline};
|
||||
pub use lemmy_db_views_site::api::{CreateTagline, DeleteTagline, UpdateTagline};
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ rust-version.workspace = true
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_api_misc = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_comment = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_community = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_community_moderator = { workspace = true, features = ["full"] }
|
||||
|
|
|
@ -2,9 +2,9 @@ use activitypub_federation::config::Data;
|
|||
use actix_web::web::Json;
|
||||
use lemmy_api_utils::{context::LemmyContext, utils::is_admin};
|
||||
use lemmy_db_schema::{source::custom_emoji::CustomEmoji, traits::Crud};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_custom_emoji::api::DeleteCustomEmoji;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn delete_custom_emoji(
|
||||
|
|
|
@ -2,9 +2,8 @@ use activitypub_federation::config::Data;
|
|||
use actix_web::web::Json;
|
||||
use lemmy_api_utils::{context::LemmyContext, utils::is_admin};
|
||||
use lemmy_db_schema::{source::oauth_provider::OAuthProvider, traits::Crud};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::DeleteOAuthProvider;
|
||||
use lemmy_db_views_site::api::{DeleteOAuthProvider, SuccessResponse};
|
||||
use lemmy_utils::error::LemmyError;
|
||||
|
||||
pub async fn delete_oauth_provider(
|
||||
|
|
|
@ -8,9 +8,8 @@ use lemmy_db_schema::{
|
|||
source::tagline::{Tagline, TaglineInsertForm},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views_api_misc::CreateTagline;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::TaglineResponse;
|
||||
use lemmy_db_views_site::api::{CreateTagline, TaglineResponse};
|
||||
use lemmy_utils::error::LemmyError;
|
||||
|
||||
pub async fn create_tagline(
|
||||
|
|
|
@ -2,9 +2,8 @@ use activitypub_federation::config::Data;
|
|||
use actix_web::web::Json;
|
||||
use lemmy_api_utils::{context::LemmyContext, utils::is_admin};
|
||||
use lemmy_db_schema::{source::tagline::Tagline, traits::Crud};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::DeleteTagline;
|
||||
use lemmy_db_views_site::api::{DeleteTagline, SuccessResponse};
|
||||
use lemmy_utils::error::LemmyError;
|
||||
|
||||
pub async fn delete_tagline(
|
||||
|
|
|
@ -31,10 +31,12 @@ use lemmy_db_schema::{
|
|||
utils::get_conn,
|
||||
};
|
||||
use lemmy_db_schema_file::enums::RegistrationMode;
|
||||
use lemmy_db_views_api_misc::LoginResponse;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_registration_applications::api::Register;
|
||||
use lemmy_db_views_site::{api::AuthenticateWithOauth, SiteView};
|
||||
use lemmy_db_views_site::{
|
||||
api::{AuthenticateWithOauth, LoginResponse},
|
||||
SiteView,
|
||||
};
|
||||
use lemmy_email::{
|
||||
account::send_verification_email_if_required,
|
||||
admin::send_new_applicant_email_to_admins,
|
||||
|
|
|
@ -12,8 +12,8 @@ use lemmy_db_schema::source::{
|
|||
oauth_account::OAuthAccount,
|
||||
person::Person,
|
||||
};
|
||||
use lemmy_db_views_api_misc::{DeleteAccount, SuccessResponse};
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::{DeleteAccount, SuccessResponse};
|
||||
use lemmy_utils::error::{LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn delete_account(
|
||||
|
|
|
@ -10,10 +10,10 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Blockable,
|
||||
};
|
||||
use lemmy_db_views_api_misc::MyUserInfo;
|
||||
use lemmy_db_views_community_follower::CommunityFollowerView;
|
||||
use lemmy_db_views_community_moderator::CommunityModeratorView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::MyUserInfo;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn get_my_user(
|
||||
|
|
|
@ -20,7 +20,6 @@ workspace = true
|
|||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
lemmy_db_schema_file = { workspace = true }
|
||||
lemmy_db_views_api_misc = { workspace = true }
|
||||
lemmy_db_views_community = { workspace = true }
|
||||
lemmy_db_views_community_follower = { workspace = true }
|
||||
lemmy_db_views_community_moderator = { workspace = true }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use anyhow::anyhow;
|
||||
use extism::{Manifest, PluginBuilder, Pool, PoolPlugin};
|
||||
use extism_convert::Json;
|
||||
use lemmy_db_views_api_misc::PluginMetadata;
|
||||
use lemmy_db_views_site::api::PluginMetadata;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyError, LemmyErrorType, LemmyResult},
|
||||
settings::SETTINGS,
|
||||
|
|
|
@ -19,7 +19,6 @@ doctest = false
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_api_misc = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_comment = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_community = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_community_moderator = { workspace = true, features = ["full"] }
|
||||
|
|
|
@ -3,14 +3,13 @@ use activitypub_federation::config::Data;
|
|||
use actix_web::web::{Json, Query};
|
||||
use either::Either::*;
|
||||
use lemmy_api_utils::{context::LemmyContext, utils::check_private_instance};
|
||||
use lemmy_db_views_api_misc::ResolveObject;
|
||||
use lemmy_db_views_comment::CommentView;
|
||||
use lemmy_db_views_community::CommunityView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_person::PersonView;
|
||||
use lemmy_db_views_post::PostView;
|
||||
use lemmy_db_views_search_combined::{SearchCombinedView, SearchResponse};
|
||||
use lemmy_db_views_site::SiteView;
|
||||
use lemmy_db_views_site::{api::ResolveObject, SiteView};
|
||||
use lemmy_utils::error::{LemmyErrorExt2, LemmyErrorType, LemmyResult};
|
||||
|
||||
pub async fn resolve_object(
|
||||
|
|
|
@ -22,8 +22,8 @@ use lemmy_db_schema::{
|
|||
traits::{Blockable, Crud, Followable, Saveable},
|
||||
};
|
||||
use lemmy_db_schema_file::enums::CommunityFollowerState;
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::{
|
||||
error::{LemmyErrorType, LemmyResult, MAX_API_PARAM_ELEMENTS},
|
||||
spawn_try_task,
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
[package]
|
||||
name = "lemmy_db_views_api_misc"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
description.workspace = true
|
||||
license.workspace = true
|
||||
homepage.workspace = true
|
||||
documentation.workspace = true
|
||||
repository.workspace = true
|
||||
|
||||
[lib]
|
||||
doctest = false
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[features]
|
||||
full = [
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
"lemmy_db_views_community_follower/full",
|
||||
"lemmy_db_views_community_moderator/full",
|
||||
"lemmy_db_views_local_user/full",
|
||||
"lemmy_db_views_post/full",
|
||||
"lemmy_db_views_post/full",
|
||||
"extism",
|
||||
"extism-convert",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema.workspace = true
|
||||
lemmy_db_schema_file.workspace = true
|
||||
lemmy_db_views_community_follower.workspace = true
|
||||
lemmy_db_views_community_moderator.workspace = true
|
||||
lemmy_db_views_local_user.workspace = true
|
||||
lemmy_db_views_post.workspace = true
|
||||
serde.workspace = true
|
||||
serde_with.workspace = true
|
||||
url.workspace = true
|
||||
ts-rs = { workspace = true, optional = true }
|
||||
extism = { workspace = true, optional = true }
|
||||
extism-convert = { workspace = true, optional = true }
|
|
@ -1,352 +0,0 @@
|
|||
use lemmy_db_schema::{
|
||||
newtypes::{InstanceId, LanguageId, PaginationCursor, PersonId},
|
||||
sensitive::SensitiveString,
|
||||
source::{community::Community, instance::Instance, login_token::LoginToken, person::Person},
|
||||
};
|
||||
use lemmy_db_schema_file::enums::{
|
||||
CommentSortType,
|
||||
ListingType,
|
||||
PostListingMode,
|
||||
PostSortType,
|
||||
VoteShow,
|
||||
};
|
||||
use lemmy_db_views_community_follower::CommunityFollowerView;
|
||||
use lemmy_db_views_community_moderator::CommunityModeratorView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_post::PostView;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
use url::Url;
|
||||
#[cfg(feature = "full")]
|
||||
use {
|
||||
extism::FromBytes,
|
||||
extism_convert::{encoding, Json},
|
||||
};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A captcha response.
|
||||
pub struct CaptchaResponse {
|
||||
/// A Base64 encoded png
|
||||
pub png: String,
|
||||
/// A Base64 encoded wav audio
|
||||
pub wav: String,
|
||||
/// The UUID for the captcha item.
|
||||
pub uuid: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Changes your account password.
|
||||
pub struct ChangePassword {
|
||||
pub new_password: SensitiveString,
|
||||
pub new_password_verify: SensitiveString,
|
||||
pub old_password: SensitiveString,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Create a tagline
|
||||
pub struct CreateTagline {
|
||||
pub content: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Delete your account.
|
||||
pub struct DeleteAccount {
|
||||
pub password: SensitiveString,
|
||||
pub delete_content: bool,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A wrapper for the captcha response.
|
||||
pub struct GetCaptchaResponse {
|
||||
/// Will be None if captchas are disabled.
|
||||
pub ok: Option<CaptchaResponse>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct GenerateTotpSecretResponse {
|
||||
pub totp_secret_url: SensitiveString,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ListLoginsResponse {
|
||||
pub logins: Vec<LoginToken>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Gets your hidden posts.
|
||||
pub struct ListPersonHidden {
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
pub page_back: Option<bool>,
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// You hidden posts response.
|
||||
pub struct ListPersonHiddenResponse {
|
||||
pub hidden: Vec<PostView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Gets your read posts.
|
||||
pub struct ListPersonRead {
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
pub page_back: Option<bool>,
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// You read posts response.
|
||||
pub struct ListPersonReadResponse {
|
||||
pub read: Vec<PostView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Logging into lemmy.
|
||||
///
|
||||
/// Note: Banned users can still log in, to be able to do certain things like delete
|
||||
/// their account.
|
||||
pub struct Login {
|
||||
pub username_or_email: SensitiveString,
|
||||
pub password: SensitiveString,
|
||||
/// May be required, if totp is enabled for their account.
|
||||
pub totp_2fa_token: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A response for your login.
|
||||
pub struct LoginResponse {
|
||||
/// This is None in response to `Register` if email verification is enabled, or the server
|
||||
/// requires registration applications.
|
||||
pub jwt: Option<SensitiveString>,
|
||||
/// If registration applications are required, this will return true for a signup response.
|
||||
pub registration_created: bool,
|
||||
/// If email verifications are required, this will return true for a signup response.
|
||||
pub verify_email_sent: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Make a note for a person.
|
||||
///
|
||||
/// An empty string deletes the note.
|
||||
pub struct NotePerson {
|
||||
pub person_id: PersonId,
|
||||
pub note: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Your user info.
|
||||
pub struct MyUserInfo {
|
||||
pub local_user_view: LocalUserView,
|
||||
pub follows: Vec<CommunityFollowerView>,
|
||||
pub moderates: Vec<CommunityModeratorView>,
|
||||
pub community_blocks: Vec<Community>,
|
||||
pub instance_blocks: Vec<Instance>,
|
||||
pub person_blocks: Vec<Person>,
|
||||
pub keyword_blocks: Vec<String>,
|
||||
pub discussion_languages: Vec<LanguageId>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Change your password after receiving a reset request.
|
||||
pub struct PasswordChangeAfterReset {
|
||||
pub token: SensitiveString,
|
||||
pub password: SensitiveString,
|
||||
pub password_verify: SensitiveString,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Reset your password via email.
|
||||
pub struct PasswordReset {
|
||||
pub email: SensitiveString,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(FromBytes))]
|
||||
#[cfg_attr(feature = "full", encoding(Json))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct PluginMetadata {
|
||||
name: String,
|
||||
url: Url,
|
||||
description: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Make a request to resend your verification email.
|
||||
pub struct ResendVerificationEmail {
|
||||
pub email: SensitiveString,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Does an apub fetch for an object.
|
||||
pub struct ResolveObject {
|
||||
/// Can be the full url, or a shortened version like: !fediverse@lemmy.ml
|
||||
pub q: String,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Saves settings for your user.
|
||||
pub struct SaveUserSettings {
|
||||
/// Show nsfw posts.
|
||||
pub show_nsfw: Option<bool>,
|
||||
/// Blur nsfw posts.
|
||||
pub blur_nsfw: Option<bool>,
|
||||
/// Your user's theme.
|
||||
pub theme: Option<String>,
|
||||
/// The default post listing type, usually "local"
|
||||
pub default_listing_type: Option<ListingType>,
|
||||
/// A post-view mode that changes how multiple post listings look.
|
||||
pub post_listing_mode: Option<PostListingMode>,
|
||||
/// The default post sort, usually "active"
|
||||
pub default_post_sort_type: Option<PostSortType>,
|
||||
/// A default time range limit to apply to post sorts, in seconds. 0 means none.
|
||||
pub default_post_time_range_seconds: Option<i32>,
|
||||
/// The default comment sort, usually "hot"
|
||||
pub default_comment_sort_type: Option<CommentSortType>,
|
||||
/// The language of the lemmy interface
|
||||
pub interface_language: Option<String>,
|
||||
/// Your display name, which can contain strange characters, and does not need to be unique.
|
||||
pub display_name: Option<String>,
|
||||
/// Your email.
|
||||
pub email: Option<SensitiveString>,
|
||||
/// Your bio / info, in markdown.
|
||||
pub bio: Option<String>,
|
||||
/// Your matrix user id. Ex: @my_user:matrix.org
|
||||
pub matrix_user_id: Option<String>,
|
||||
/// Whether to show or hide avatars.
|
||||
pub show_avatars: Option<bool>,
|
||||
/// Sends notifications to your email.
|
||||
pub send_notifications_to_email: Option<bool>,
|
||||
/// Whether this account is a bot account. Users can hide these accounts easily if they wish.
|
||||
pub bot_account: Option<bool>,
|
||||
/// Whether to show bot accounts.
|
||||
pub show_bot_accounts: Option<bool>,
|
||||
/// Whether to show read posts.
|
||||
pub show_read_posts: Option<bool>,
|
||||
/// A list of languages you are able to see discussion in.
|
||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||
// A list of keywords used for blocking posts having them in title,url or body.
|
||||
pub blocking_keywords: Option<Vec<String>>,
|
||||
/// Open links in a new tab
|
||||
pub open_links_in_new_tab: Option<bool>,
|
||||
/// Enable infinite scroll
|
||||
pub infinite_scroll_enabled: Option<bool>,
|
||||
/// Whether to allow keyboard navigation (for browsing and interacting with posts and comments).
|
||||
pub enable_keyboard_navigation: Option<bool>,
|
||||
/// Whether user avatars or inline images in the UI that are gifs should be allowed to play or
|
||||
/// should be paused
|
||||
pub enable_animated_images: Option<bool>,
|
||||
/// Whether a user can send / receive private messages
|
||||
pub enable_private_messages: Option<bool>,
|
||||
/// Whether to auto-collapse bot comments.
|
||||
pub collapse_bot_comments: Option<bool>,
|
||||
/// Some vote display mode settings
|
||||
pub show_scores: Option<bool>,
|
||||
pub show_upvotes: Option<bool>,
|
||||
pub show_downvotes: Option<VoteShow>,
|
||||
pub show_upvote_percentage: Option<bool>,
|
||||
/// Whether to automatically mark fetched posts as read.
|
||||
pub auto_mark_fetched_posts_as_read: Option<bool>,
|
||||
/// Whether to hide posts containing images/videos.
|
||||
pub hide_media: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A response that completes successfully.
|
||||
pub struct SuccessResponse {
|
||||
pub success: bool,
|
||||
}
|
||||
|
||||
impl Default for SuccessResponse {
|
||||
fn default() -> Self {
|
||||
SuccessResponse { success: true }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct UpdateTotp {
|
||||
pub totp_token: String,
|
||||
pub enabled: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct UpdateTotpResponse {
|
||||
pub enabled: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Block an instance as user
|
||||
pub struct UserBlockInstanceParams {
|
||||
pub instance_id: InstanceId,
|
||||
pub block: bool,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Verify your email.
|
||||
pub struct VerifyEmail {
|
||||
pub token: String,
|
||||
}
|
|
@ -26,7 +26,12 @@ full = [
|
|||
"lemmy_db_schema_file/full",
|
||||
"lemmy_db_views_vote/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = [
|
||||
"dep:ts-rs",
|
||||
"lemmy_db_schema/ts-rs",
|
||||
"lemmy_db_schema_file/ts-rs",
|
||||
"lemmy_db_views_vote/ts-rs",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
|
|
@ -26,7 +26,13 @@ full = [
|
|||
"lemmy_db_views_community_moderator/full",
|
||||
"lemmy_db_views_person/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = [
|
||||
"dep:ts-rs",
|
||||
"lemmy_db_schema/ts-rs",
|
||||
"lemmy_db_schema_file/ts-rs",
|
||||
"lemmy_db_views_community_moderator/ts-rs",
|
||||
"lemmy_db_views_person/ts-rs",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
|
|
@ -24,7 +24,7 @@ full = [
|
|||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = ["dep:ts-rs", "lemmy_db_schema/ts-rs", "lemmy_db_schema_file/ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
|
|
@ -23,7 +23,7 @@ full = [
|
|||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = ["dep:ts-rs", "lemmy_db_schema/ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
|
|
@ -23,7 +23,7 @@ full = [
|
|||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = ["dep:ts-rs", "lemmy_db_schema/ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
|
|
@ -23,8 +23,13 @@ full = [
|
|||
"i-love-jesus",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
"lemmy_db_views_private_message/full",
|
||||
]
|
||||
ts-rs = [
|
||||
"dep:ts-rs",
|
||||
"lemmy_db_schema/ts-rs",
|
||||
"lemmy_db_views_private_message/ts-rs",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_private_message = { workspace = true }
|
||||
|
|
|
@ -24,7 +24,7 @@ full = [
|
|||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = ["dep:ts-rs", "lemmy_db_schema/ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
|
|
@ -25,7 +25,7 @@ full = [
|
|||
"lemmy_db_schema_file/full",
|
||||
"i-love-jesus",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = ["dep:ts-rs", "lemmy_db_schema/ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
|
|
@ -24,7 +24,7 @@ full = [
|
|||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = ["dep:ts-rs", "lemmy_db_schema/ts-rs", "lemmy_db_schema_file/ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
|
|
@ -25,7 +25,11 @@ full = [
|
|||
"lemmy_db_schema_file/full",
|
||||
"lemmy_db_views_community_moderator/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = [
|
||||
"dep:ts-rs",
|
||||
"lemmy_db_schema/ts-rs",
|
||||
"lemmy_db_views_community_moderator/ts-rs",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
|
|
@ -99,3 +99,14 @@ pub struct PurgePerson {
|
|||
pub person_id: PersonId,
|
||||
pub reason: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Make a note for a person.
|
||||
///
|
||||
/// An empty string deletes the note.
|
||||
pub struct NotePerson {
|
||||
pub person_id: PersonId,
|
||||
pub note: String,
|
||||
}
|
||||
|
|
|
@ -24,7 +24,13 @@ full = [
|
|||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = [
|
||||
"dep:ts-rs",
|
||||
"lemmy_db_schema/ts-rs",
|
||||
"lemmy_db_schema_file/ts-rs",
|
||||
"lemmy_db_views_post/ts-rs",
|
||||
"lemmy_db_views_comment/ts-rs",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_post = { workspace = true }
|
||||
|
|
|
@ -26,7 +26,12 @@ full = [
|
|||
"lemmy_db_views_comment/full",
|
||||
"lemmy_db_views_post/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = [
|
||||
"dep:ts-rs",
|
||||
"lemmy_db_schema/ts-rs",
|
||||
"lemmy_db_views_comment/ts-rs",
|
||||
"lemmy_db_views_post/ts-rs",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_post = { workspace = true }
|
||||
|
|
|
@ -26,7 +26,12 @@ full = [
|
|||
"lemmy_db_views_post/full",
|
||||
"lemmy_db_views_comment/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = [
|
||||
"dep:ts-rs",
|
||||
"lemmy_db_schema/ts-rs",
|
||||
"lemmy_db_views_post/ts-rs",
|
||||
"lemmy_db_views_comment/ts-rs",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_post = { workspace = true }
|
||||
|
|
|
@ -26,7 +26,13 @@ full = [
|
|||
"lemmy_db_views_community/full",
|
||||
"lemmy_db_views_vote/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = [
|
||||
"dep:ts-rs",
|
||||
"lemmy_db_schema/ts-rs",
|
||||
"lemmy_db_schema_file/ts-rs",
|
||||
"lemmy_db_views_community/ts-rs",
|
||||
"lemmy_db_views_vote/ts-rs",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
|
|
@ -23,7 +23,7 @@ full = [
|
|||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = ["dep:ts-rs", "lemmy_db_schema/ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
|
|
@ -16,7 +16,7 @@ workspace = true
|
|||
|
||||
[features]
|
||||
full = ["lemmy_db_schema/full", "lemmy_utils/full"]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = ["dep:ts-rs", "lemmy_db_schema/ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
|
|
@ -24,7 +24,7 @@ full = [
|
|||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = ["dep:ts-rs", "lemmy_db_schema/ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
|
|
@ -24,7 +24,7 @@ full = [
|
|||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = ["dep:ts-rs", "lemmy_db_schema/ts-rs", "lemmy_db_views_reports/ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_reports = { workspace = true }
|
||||
|
|
|
@ -23,7 +23,7 @@ full = [
|
|||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = ["dep:ts-rs", "lemmy_db_schema/ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
|
|
@ -28,7 +28,15 @@ full = [
|
|||
"lemmy_db_views_community/full",
|
||||
"lemmy_db_views_person/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = [
|
||||
"dep:ts-rs",
|
||||
"lemmy_db_schema/ts-rs",
|
||||
"lemmy_db_schema_file/ts-rs",
|
||||
"lemmy_db_views_comment/ts-rs",
|
||||
"lemmy_db_views_community/ts-rs",
|
||||
"lemmy_db_views_person/ts-rs",
|
||||
"lemmy_db_views_post/ts-rs",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_post = { workspace = true }
|
||||
|
|
|
@ -22,19 +22,34 @@ full = [
|
|||
"diesel-async",
|
||||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
"lemmy_db_views_api_misc/full",
|
||||
"lemmy_db_views_person/full",
|
||||
"lemmy_db_views_post/full",
|
||||
"lemmy_db_views_readable_federation_state/full",
|
||||
"extism",
|
||||
"extism-convert",
|
||||
"anyhow",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = [
|
||||
"dep:ts-rs",
|
||||
"lemmy_db_schema/ts-rs",
|
||||
"lemmy_db_schema_file/ts-rs",
|
||||
"lemmy_db_views_community_follower/ts-rs",
|
||||
"lemmy_db_views_community_moderator/ts-rs",
|
||||
"lemmy_db_views_local_user/ts-rs",
|
||||
"lemmy_db_views_person/ts-rs",
|
||||
"lemmy_db_views_post/ts-rs",
|
||||
"lemmy_db_views_readable_federation_state/ts-rs",
|
||||
]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
lemmy_utils = { workspace = true, optional = true }
|
||||
lemmy_db_schema_file = { workspace = true }
|
||||
lemmy_db_views_api_misc = { workspace = true }
|
||||
lemmy_db_views_community_follower = { workspace = true }
|
||||
lemmy_db_views_community_moderator = { workspace = true }
|
||||
lemmy_db_views_local_user = { workspace = true }
|
||||
lemmy_db_views_person = { workspace = true }
|
||||
lemmy_db_views_post = { workspace = true }
|
||||
lemmy_db_views_readable_federation_state = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
diesel = { workspace = true, optional = true }
|
||||
|
@ -43,4 +58,6 @@ serde = { workspace = true }
|
|||
serde_with = { workspace = true }
|
||||
ts-rs = { workspace = true, optional = true }
|
||||
url = { workspace = true }
|
||||
extism = { workspace = true, optional = true }
|
||||
extism-convert = { workspace = true, optional = true }
|
||||
anyhow = { workspace = true, optional = true }
|
||||
|
|
|
@ -1,12 +1,16 @@
|
|||
use crate::SiteView;
|
||||
use chrono::{DateTime, Utc};
|
||||
use lemmy_db_schema::{
|
||||
newtypes::{LanguageId, OAuthProviderId, PaginationCursor, TaglineId},
|
||||
newtypes::{InstanceId, LanguageId, OAuthProviderId, PaginationCursor, TaglineId},
|
||||
sensitive::SensitiveString,
|
||||
source::{
|
||||
community::Community,
|
||||
instance::Instance,
|
||||
language::Language,
|
||||
local_site_url_blocklist::LocalSiteUrlBlocklist,
|
||||
login_token::LoginToken,
|
||||
oauth_provider::{OAuthProvider, PublicOAuthProvider},
|
||||
person::Person,
|
||||
tagline::Tagline,
|
||||
},
|
||||
};
|
||||
|
@ -17,13 +21,22 @@ use lemmy_db_schema_file::enums::{
|
|||
PostListingMode,
|
||||
PostSortType,
|
||||
RegistrationMode,
|
||||
VoteShow,
|
||||
};
|
||||
use lemmy_db_views_api_misc::PluginMetadata;
|
||||
use lemmy_db_views_community_follower::CommunityFollowerView;
|
||||
use lemmy_db_views_community_moderator::CommunityModeratorView;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_person::PersonView;
|
||||
use lemmy_db_views_post::PostView;
|
||||
use lemmy_db_views_readable_federation_state::ReadableFederationState;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_with::skip_serializing_none;
|
||||
use url::Url;
|
||||
#[cfg(feature = "full")]
|
||||
use {
|
||||
extism::FromBytes,
|
||||
extism_convert::{encoding, Json},
|
||||
};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
|
@ -140,14 +153,6 @@ pub struct DeleteOAuthProvider {
|
|||
pub id: OAuthProviderId,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Delete a tagline
|
||||
pub struct DeleteTagline {
|
||||
pub id: TaglineId,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
|
@ -312,6 +317,305 @@ pub struct InstanceWithFederationState {
|
|||
pub federation_state: Option<ReadableFederationState>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The response for a site.
|
||||
pub struct SiteResponse {
|
||||
pub site_view: SiteView,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A captcha response.
|
||||
pub struct CaptchaResponse {
|
||||
/// A Base64 encoded png
|
||||
pub png: String,
|
||||
/// A Base64 encoded wav audio
|
||||
pub wav: String,
|
||||
/// The UUID for the captcha item.
|
||||
pub uuid: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Changes your account password.
|
||||
pub struct ChangePassword {
|
||||
pub new_password: SensitiveString,
|
||||
pub new_password_verify: SensitiveString,
|
||||
pub old_password: SensitiveString,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Delete your account.
|
||||
pub struct DeleteAccount {
|
||||
pub password: SensitiveString,
|
||||
pub delete_content: bool,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A wrapper for the captcha response.
|
||||
pub struct GetCaptchaResponse {
|
||||
/// Will be None if captchas are disabled.
|
||||
pub ok: Option<CaptchaResponse>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct GenerateTotpSecretResponse {
|
||||
pub totp_secret_url: SensitiveString,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct ListLoginsResponse {
|
||||
pub logins: Vec<LoginToken>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Logging into lemmy.
|
||||
///
|
||||
/// Note: Banned users can still log in, to be able to do certain things like delete
|
||||
/// their account.
|
||||
pub struct Login {
|
||||
pub username_or_email: SensitiveString,
|
||||
pub password: SensitiveString,
|
||||
/// May be required, if totp is enabled for their account.
|
||||
pub totp_2fa_token: Option<String>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A response for your login.
|
||||
pub struct LoginResponse {
|
||||
/// This is None in response to `Register` if email verification is enabled, or the server
|
||||
/// requires registration applications.
|
||||
pub jwt: Option<SensitiveString>,
|
||||
/// If registration applications are required, this will return true for a signup response.
|
||||
pub registration_created: bool,
|
||||
/// If email verifications are required, this will return true for a signup response.
|
||||
pub verify_email_sent: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Your user info.
|
||||
pub struct MyUserInfo {
|
||||
pub local_user_view: LocalUserView,
|
||||
pub follows: Vec<CommunityFollowerView>,
|
||||
pub moderates: Vec<CommunityModeratorView>,
|
||||
pub community_blocks: Vec<Community>,
|
||||
pub instance_blocks: Vec<Instance>,
|
||||
pub person_blocks: Vec<Person>,
|
||||
pub keyword_blocks: Vec<String>,
|
||||
pub discussion_languages: Vec<LanguageId>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Change your password after receiving a reset request.
|
||||
pub struct PasswordChangeAfterReset {
|
||||
pub token: SensitiveString,
|
||||
pub password: SensitiveString,
|
||||
pub password_verify: SensitiveString,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Reset your password via email.
|
||||
pub struct PasswordReset {
|
||||
pub email: SensitiveString,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Make a request to resend your verification email.
|
||||
pub struct ResendVerificationEmail {
|
||||
pub email: SensitiveString,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Saves settings for your user.
|
||||
pub struct SaveUserSettings {
|
||||
/// Show nsfw posts.
|
||||
pub show_nsfw: Option<bool>,
|
||||
/// Blur nsfw posts.
|
||||
pub blur_nsfw: Option<bool>,
|
||||
/// Your user's theme.
|
||||
pub theme: Option<String>,
|
||||
/// The default post listing type, usually "local"
|
||||
pub default_listing_type: Option<ListingType>,
|
||||
/// A post-view mode that changes how multiple post listings look.
|
||||
pub post_listing_mode: Option<PostListingMode>,
|
||||
/// The default post sort, usually "active"
|
||||
pub default_post_sort_type: Option<PostSortType>,
|
||||
/// A default time range limit to apply to post sorts, in seconds. 0 means none.
|
||||
pub default_post_time_range_seconds: Option<i32>,
|
||||
/// The default comment sort, usually "hot"
|
||||
pub default_comment_sort_type: Option<CommentSortType>,
|
||||
/// The language of the lemmy interface
|
||||
pub interface_language: Option<String>,
|
||||
/// Your display name, which can contain strange characters, and does not need to be unique.
|
||||
pub display_name: Option<String>,
|
||||
/// Your email.
|
||||
pub email: Option<SensitiveString>,
|
||||
/// Your bio / info, in markdown.
|
||||
pub bio: Option<String>,
|
||||
/// Your matrix user id. Ex: @my_user:matrix.org
|
||||
pub matrix_user_id: Option<String>,
|
||||
/// Whether to show or hide avatars.
|
||||
pub show_avatars: Option<bool>,
|
||||
/// Sends notifications to your email.
|
||||
pub send_notifications_to_email: Option<bool>,
|
||||
/// Whether this account is a bot account. Users can hide these accounts easily if they wish.
|
||||
pub bot_account: Option<bool>,
|
||||
/// Whether to show bot accounts.
|
||||
pub show_bot_accounts: Option<bool>,
|
||||
/// Whether to show read posts.
|
||||
pub show_read_posts: Option<bool>,
|
||||
/// A list of languages you are able to see discussion in.
|
||||
pub discussion_languages: Option<Vec<LanguageId>>,
|
||||
// A list of keywords used for blocking posts having them in title,url or body.
|
||||
pub blocking_keywords: Option<Vec<String>>,
|
||||
/// Open links in a new tab
|
||||
pub open_links_in_new_tab: Option<bool>,
|
||||
/// Enable infinite scroll
|
||||
pub infinite_scroll_enabled: Option<bool>,
|
||||
/// Whether to allow keyboard navigation (for browsing and interacting with posts and comments).
|
||||
pub enable_keyboard_navigation: Option<bool>,
|
||||
/// Whether user avatars or inline images in the UI that are gifs should be allowed to play or
|
||||
/// should be paused
|
||||
pub enable_animated_images: Option<bool>,
|
||||
/// Whether a user can send / receive private messages
|
||||
pub enable_private_messages: Option<bool>,
|
||||
/// Whether to auto-collapse bot comments.
|
||||
pub collapse_bot_comments: Option<bool>,
|
||||
/// Some vote display mode settings
|
||||
pub show_scores: Option<bool>,
|
||||
pub show_upvotes: Option<bool>,
|
||||
pub show_downvotes: Option<VoteShow>,
|
||||
pub show_upvote_percentage: Option<bool>,
|
||||
/// Whether to automatically mark fetched posts as read.
|
||||
pub auto_mark_fetched_posts_as_read: Option<bool>,
|
||||
/// Whether to hide posts containing images/videos.
|
||||
pub hide_media: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct UpdateTotp {
|
||||
pub totp_token: String,
|
||||
pub enabled: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct UpdateTotpResponse {
|
||||
pub enabled: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Block an instance as user
|
||||
pub struct UserBlockInstanceParams {
|
||||
pub instance_id: InstanceId,
|
||||
pub block: bool,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Default, Debug, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Verify your email.
|
||||
pub struct VerifyEmail {
|
||||
pub token: String,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Gets your hidden posts.
|
||||
pub struct ListPersonHidden {
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
pub page_back: Option<bool>,
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// You hidden posts response.
|
||||
pub struct ListPersonHiddenResponse {
|
||||
pub hidden: Vec<PostView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Gets your read posts.
|
||||
pub struct ListPersonRead {
|
||||
pub page_cursor: Option<PaginationCursor>,
|
||||
pub page_back: Option<bool>,
|
||||
pub limit: Option<i64>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// You read posts response.
|
||||
pub struct ListPersonReadResponse {
|
||||
pub read: Vec<PostView>,
|
||||
/// the pagination cursor to use to fetch the next page
|
||||
pub next_page: Option<PaginationCursor>,
|
||||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Create a tagline
|
||||
pub struct CreateTagline {
|
||||
pub content: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Delete a tagline
|
||||
pub struct DeleteTagline {
|
||||
pub id: TaglineId,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
|
@ -334,14 +638,6 @@ pub struct ListTaglinesResponse {
|
|||
pub prev_page: Option<PaginationCursor>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// The response for a site.
|
||||
pub struct SiteResponse {
|
||||
pub site_view: SiteView,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
|
@ -357,3 +653,37 @@ pub struct UpdateTagline {
|
|||
pub id: TaglineId,
|
||||
pub content: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
#[cfg_attr(feature = "full", derive(FromBytes))]
|
||||
#[cfg_attr(feature = "full", encoding(Json))]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
pub struct PluginMetadata {
|
||||
name: String,
|
||||
url: Url,
|
||||
description: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// Does an apub fetch for an object.
|
||||
pub struct ResolveObject {
|
||||
/// Can be the full url, or a shortened version like: !fediverse@lemmy.ml
|
||||
pub q: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]
|
||||
#[cfg_attr(feature = "ts-rs", ts(optional_fields, export))]
|
||||
/// A response that completes successfully.
|
||||
pub struct SuccessResponse {
|
||||
pub success: bool,
|
||||
}
|
||||
|
||||
impl Default for SuccessResponse {
|
||||
fn default() -> Self {
|
||||
SuccessResponse { success: true }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ full = [
|
|||
"lemmy_db_schema/full",
|
||||
"lemmy_db_schema_file/full",
|
||||
]
|
||||
ts-rs = ["dep:ts-rs"]
|
||||
ts-rs = ["dep:ts-rs", "lemmy_db_schema/ts-rs"]
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_schema = { workspace = true }
|
||||
|
|
|
@ -17,7 +17,6 @@ doctest = false
|
|||
workspace = true
|
||||
|
||||
[dependencies]
|
||||
lemmy_db_views_api_misc = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_community = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_post = { workspace = true, features = ["full"] }
|
||||
lemmy_db_views_local_image = { workspace = true, features = ["full"] }
|
||||
|
|
|
@ -14,10 +14,10 @@ use lemmy_db_schema::{
|
|||
},
|
||||
traits::Crud,
|
||||
};
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_community::api::CommunityIdQuery;
|
||||
use lemmy_db_views_local_image::api::DeleteImageParams;
|
||||
use lemmy_db_views_local_user::LocalUserView;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub async fn delete_site_icon(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use actix_web::web::*;
|
||||
use lemmy_api_utils::context::LemmyContext;
|
||||
use lemmy_db_views_api_misc::SuccessResponse;
|
||||
use lemmy_db_views_site::api::SuccessResponse;
|
||||
use lemmy_utils::error::LemmyResult;
|
||||
|
||||
pub mod delete;
|
||||
|
|
Loading…
Reference in a new issue