2025-03-22 22:17:47 -04:00
|
|
|
pub mod auth;
|
2025-03-27 18:10:47 -04:00
|
|
|
pub mod communities;
|
2025-03-29 23:51:13 -04:00
|
|
|
pub mod notifications;
|
2025-03-24 22:42:33 -04:00
|
|
|
pub mod reactions;
|
2025-04-02 11:39:51 -04:00
|
|
|
pub mod reports;
|
2025-04-12 22:25:54 -04:00
|
|
|
pub mod requests;
|
2025-04-01 13:26:33 -04:00
|
|
|
pub mod util;
|
2025-03-24 19:55:08 -04:00
|
|
|
|
2025-04-27 23:11:37 -04:00
|
|
|
#[cfg(feature = "redis")]
|
|
|
|
pub mod channels;
|
|
|
|
|
2025-03-22 22:17:47 -04:00
|
|
|
use axum::{
|
2025-04-27 23:11:37 -04:00
|
|
|
routing::{any, delete, get, post},
|
2025-03-22 22:17:47 -04:00
|
|
|
Router,
|
|
|
|
};
|
|
|
|
use serde::Deserialize;
|
2025-03-24 22:42:33 -04:00
|
|
|
use tetratto_core::model::{
|
2025-04-01 15:03:56 -04:00
|
|
|
communities::{
|
|
|
|
CommunityContext, CommunityJoinAccess, CommunityReadAccess, CommunityWriteAccess,
|
|
|
|
PostContext,
|
|
|
|
},
|
2025-03-31 15:39:49 -04:00
|
|
|
communities_permissions::CommunityPermission,
|
2025-04-02 11:39:51 -04:00
|
|
|
permissions::FinePermission,
|
2025-03-24 22:42:33 -04:00
|
|
|
reactions::AssetType,
|
2025-03-24 20:23:52 -04:00
|
|
|
};
|
2025-03-22 22:17:47 -04:00
|
|
|
|
|
|
|
pub fn routes() -> Router {
|
|
|
|
Router::new()
|
2025-04-01 13:26:33 -04:00
|
|
|
// misc
|
|
|
|
.route("/util/proxy", get(util::proxy_request))
|
|
|
|
.route("/util/lang", get(util::set_langfile_request))
|
2025-04-19 19:09:24 -04:00
|
|
|
.route("/util/ip", get(util::ip_test_request))
|
2025-03-24 22:42:33 -04:00
|
|
|
// reactions
|
|
|
|
.route("/reactions", post(reactions::create_request))
|
|
|
|
.route("/reactions/{id}", get(reactions::get_request))
|
|
|
|
.route("/reactions/{id}", delete(reactions::delete_request))
|
2025-03-29 00:26:56 -04:00
|
|
|
// communities
|
|
|
|
.route(
|
|
|
|
"/communities/find/{id}",
|
|
|
|
get(communities::communities::redirect_from_id),
|
|
|
|
)
|
2025-03-24 19:55:08 -04:00
|
|
|
.route(
|
2025-03-27 18:10:47 -04:00
|
|
|
"/communities",
|
|
|
|
post(communities::communities::create_request),
|
2025-03-24 19:55:08 -04:00
|
|
|
)
|
|
|
|
.route(
|
2025-03-27 18:10:47 -04:00
|
|
|
"/communities/{id}",
|
|
|
|
delete(communities::communities::delete_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/communities/{id}/title",
|
|
|
|
post(communities::communities::update_title_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/communities/{id}/context",
|
|
|
|
post(communities::communities::update_context_request),
|
2025-03-24 19:55:08 -04:00
|
|
|
)
|
|
|
|
.route(
|
2025-03-29 00:26:56 -04:00
|
|
|
"/communities/{id}/access/read",
|
2025-03-27 18:10:47 -04:00
|
|
|
post(communities::communities::update_read_access_request),
|
2025-03-24 19:55:08 -04:00
|
|
|
)
|
|
|
|
.route(
|
2025-03-29 00:26:56 -04:00
|
|
|
"/communities/{id}/access/write",
|
2025-03-27 18:10:47 -04:00
|
|
|
post(communities::communities::update_write_access_request),
|
2025-03-24 19:55:08 -04:00
|
|
|
)
|
2025-04-01 15:03:56 -04:00
|
|
|
.route(
|
|
|
|
"/communities/{id}/access/join",
|
|
|
|
post(communities::communities::update_join_access_request),
|
|
|
|
)
|
2025-04-24 16:57:25 -04:00
|
|
|
.route(
|
|
|
|
"/communities/{id}/transfer_ownership",
|
|
|
|
post(communities::communities::update_owner_request),
|
|
|
|
)
|
2025-03-29 00:26:56 -04:00
|
|
|
.route(
|
|
|
|
"/communities/{id}/upload/avatar",
|
|
|
|
post(communities::images::upload_avatar_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/communities/{id}/upload/banner",
|
|
|
|
post(communities::images::upload_banner_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/communities/{id}/avatar",
|
|
|
|
get(communities::images::avatar_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/communities/{id}/banner",
|
|
|
|
get(communities::images::banner_request),
|
|
|
|
)
|
2025-03-27 18:10:47 -04:00
|
|
|
// posts
|
|
|
|
.route("/posts", post(communities::posts::create_request))
|
|
|
|
.route("/posts/{id}", delete(communities::posts::delete_request))
|
2025-04-10 18:16:52 -04:00
|
|
|
.route(
|
|
|
|
"/posts/{id}/repost",
|
|
|
|
post(communities::posts::create_repost_request),
|
|
|
|
)
|
2025-03-24 19:55:08 -04:00
|
|
|
.route(
|
2025-03-25 21:19:55 -04:00
|
|
|
"/posts/{id}/content",
|
2025-03-27 18:10:47 -04:00
|
|
|
post(communities::posts::update_content_request),
|
2025-03-24 19:55:08 -04:00
|
|
|
)
|
2025-03-24 20:23:52 -04:00
|
|
|
.route(
|
2025-03-25 21:19:55 -04:00
|
|
|
"/posts/{id}/context",
|
2025-03-27 18:10:47 -04:00
|
|
|
post(communities::posts::update_context_request),
|
2025-03-24 20:23:52 -04:00
|
|
|
)
|
2025-04-12 22:25:54 -04:00
|
|
|
// questions
|
|
|
|
.route("/questions", post(communities::questions::create_request))
|
|
|
|
.route(
|
|
|
|
"/questions/{id}",
|
|
|
|
delete(communities::questions::delete_request),
|
|
|
|
)
|
2025-04-19 18:59:55 -04:00
|
|
|
.route(
|
|
|
|
"/questions/{id}/block_ip",
|
|
|
|
post(communities::questions::ip_block_request),
|
|
|
|
)
|
2025-03-23 16:37:43 -04:00
|
|
|
// auth
|
2025-03-22 22:17:47 -04:00
|
|
|
// global
|
|
|
|
.route("/auth/register", post(auth::register_request))
|
|
|
|
.route("/auth/login", post(auth::login_request))
|
2025-03-23 16:37:43 -04:00
|
|
|
.route("/auth/logout", post(auth::logout_request))
|
2025-04-03 22:36:58 -04:00
|
|
|
.route("/auth/token", get(auth::set_token_request))
|
2025-03-23 18:03:11 -04:00
|
|
|
.route(
|
|
|
|
"/auth/upload/avatar",
|
|
|
|
post(auth::images::upload_avatar_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/auth/upload/banner",
|
|
|
|
post(auth::images::upload_banner_request),
|
|
|
|
)
|
2025-03-22 22:17:47 -04:00
|
|
|
// profile
|
2025-04-26 16:27:18 -04:00
|
|
|
.route("/auth/user/me", get(auth::profile::me_request))
|
2025-04-04 21:42:08 -04:00
|
|
|
.route("/auth/user/{id}/avatar", get(auth::images::avatar_request))
|
|
|
|
.route("/auth/user/{id}/banner", get(auth::images::banner_request))
|
|
|
|
.route("/auth/user/{id}/follow", post(auth::social::follow_request))
|
2025-04-14 17:21:52 -04:00
|
|
|
.route(
|
|
|
|
"/auth/user/{id}/follow/cancel",
|
|
|
|
post(auth::social::cancel_follow_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/auth/user/{id}/follow/accept",
|
|
|
|
post(auth::social::accept_follow_request),
|
|
|
|
)
|
2025-04-04 21:42:08 -04:00
|
|
|
.route("/auth/user/{id}/block", post(auth::social::block_request))
|
2025-03-22 22:17:47 -04:00
|
|
|
.route(
|
2025-04-04 21:42:08 -04:00
|
|
|
"/auth/user/{id}/settings",
|
2025-04-01 16:12:13 -04:00
|
|
|
post(auth::profile::update_user_settings_request),
|
|
|
|
)
|
2025-04-02 11:39:51 -04:00
|
|
|
.route(
|
2025-04-04 21:42:08 -04:00
|
|
|
"/auth/user/{id}/role",
|
2025-04-02 11:39:51 -04:00
|
|
|
post(auth::profile::update_user_role_request),
|
|
|
|
)
|
2025-04-01 16:12:13 -04:00
|
|
|
.route(
|
2025-04-04 21:42:08 -04:00
|
|
|
"/auth/user/{id}",
|
2025-04-01 16:12:13 -04:00
|
|
|
delete(auth::profile::delete_user_request),
|
2025-03-25 23:58:27 -04:00
|
|
|
)
|
2025-03-31 11:45:34 -04:00
|
|
|
.route(
|
2025-04-04 21:42:08 -04:00
|
|
|
"/auth/user/{id}/password",
|
2025-04-01 16:12:13 -04:00
|
|
|
post(auth::profile::update_user_password_request),
|
2025-03-31 11:45:34 -04:00
|
|
|
)
|
|
|
|
.route(
|
2025-04-04 21:42:08 -04:00
|
|
|
"/auth/user/{id}/username",
|
2025-04-01 16:12:13 -04:00
|
|
|
post(auth::profile::update_user_username_request),
|
2025-03-31 11:45:34 -04:00
|
|
|
)
|
2025-03-26 21:46:21 -04:00
|
|
|
.route(
|
2025-04-04 21:42:08 -04:00
|
|
|
"/auth/user/{id}/tokens",
|
2025-04-01 16:12:13 -04:00
|
|
|
post(auth::profile::update_user_tokens_request),
|
2025-03-26 21:46:21 -04:00
|
|
|
)
|
|
|
|
.route(
|
2025-04-04 21:42:08 -04:00
|
|
|
"/auth/user/{id}/verified",
|
2025-04-01 16:12:13 -04:00
|
|
|
post(auth::profile::update_user_is_verified_request),
|
2025-03-26 21:46:21 -04:00
|
|
|
)
|
2025-03-29 00:26:56 -04:00
|
|
|
.route(
|
2025-04-04 21:42:08 -04:00
|
|
|
"/auth/user/{id}/totp",
|
|
|
|
post(auth::profile::enable_totp_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/auth/user/{id}/totp",
|
|
|
|
delete(auth::profile::disable_totp_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/auth/user/{id}/totp/codes",
|
|
|
|
post(auth::profile::refresh_totp_codes_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/auth/user/{username}/totp/check",
|
|
|
|
get(auth::profile::has_totp_enabled_request),
|
2025-03-29 00:26:56 -04:00
|
|
|
)
|
2025-04-04 21:42:08 -04:00
|
|
|
.route("/auth/user/me/seen", post(auth::profile::seen_request))
|
|
|
|
.route("/auth/user/find/{id}", get(auth::profile::redirect_from_id))
|
2025-04-03 11:22:56 -04:00
|
|
|
.route(
|
2025-04-04 21:42:08 -04:00
|
|
|
"/auth/user/find_by_ip/{ip}",
|
2025-04-03 11:22:56 -04:00
|
|
|
get(auth::profile::redirect_from_ip),
|
|
|
|
)
|
2025-04-19 18:59:55 -04:00
|
|
|
.route("/auth/ip/{ip}/block", post(auth::social::ip_block_request))
|
2025-05-01 16:43:58 -04:00
|
|
|
.route(
|
|
|
|
"/auth/user/{id}/_connect/{stream}",
|
2025-05-01 23:35:40 -04:00
|
|
|
any(auth::profile::subscription_handler),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/auth/user/{id}/_connect/{stream}/send",
|
|
|
|
post(auth::profile::post_to_socket_request),
|
2025-05-01 16:43:58 -04:00
|
|
|
)
|
2025-04-11 22:12:43 -04:00
|
|
|
// warnings
|
|
|
|
.route("/warnings/{id}", post(auth::user_warnings::create_request))
|
|
|
|
.route(
|
|
|
|
"/warnings/{id}",
|
|
|
|
delete(auth::user_warnings::delete_request),
|
|
|
|
)
|
2025-03-29 23:51:13 -04:00
|
|
|
// notifications
|
|
|
|
.route(
|
|
|
|
"/notifications/my",
|
|
|
|
delete(notifications::delete_all_request),
|
|
|
|
)
|
|
|
|
.route("/notifications/{id}", delete(notifications::delete_request))
|
|
|
|
.route(
|
2025-03-30 22:26:20 -04:00
|
|
|
"/notifications/{id}/read_status",
|
|
|
|
post(notifications::update_read_status_request),
|
2025-03-29 23:51:13 -04:00
|
|
|
)
|
2025-03-31 15:39:49 -04:00
|
|
|
// community memberships
|
|
|
|
.route(
|
|
|
|
"/communities/{id}/join",
|
|
|
|
post(communities::communities::create_membership),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/communities/{cid}/memberships/{uid}",
|
|
|
|
get(communities::communities::get_membership),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/communities/{cid}/memberships/{uid}",
|
|
|
|
delete(communities::communities::delete_membership),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/communities/{cid}/memberships/{uid}/role",
|
|
|
|
post(communities::communities::update_membership_role),
|
|
|
|
)
|
2025-04-01 23:16:09 -04:00
|
|
|
// ipbans
|
|
|
|
.route("/bans/{ip}", post(auth::ipbans::create_request))
|
|
|
|
.route("/bans/id/{id}", delete(auth::ipbans::delete_request))
|
2025-04-02 11:39:51 -04:00
|
|
|
// reports
|
|
|
|
.route("/reports", post(reports::create_request))
|
|
|
|
.route("/reports/{id}", delete(reports::delete_request))
|
2025-04-12 22:25:54 -04:00
|
|
|
// requests
|
|
|
|
.route(
|
|
|
|
"/requests/{id}/{linked_asset}",
|
|
|
|
delete(requests::delete_request),
|
|
|
|
)
|
|
|
|
.route("/requests/my", delete(requests::delete_all_request))
|
2025-04-26 16:27:18 -04:00
|
|
|
// connections
|
|
|
|
.route(
|
|
|
|
"/auth/user/connections/_data",
|
|
|
|
post(auth::connections::update_info_data_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/auth/user/connections/_state",
|
|
|
|
post(auth::connections::update_state_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/auth/user/connections/_shown",
|
|
|
|
post(auth::connections::update_shown_on_profile_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/auth/user/connections/{connection}",
|
|
|
|
delete(auth::connections::delete_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/auth/user/connections/spotify",
|
|
|
|
post(auth::connections::spotify::create_request),
|
|
|
|
)
|
2025-04-26 19:23:30 -04:00
|
|
|
.route(
|
|
|
|
"/auth/user/connections/last_fm",
|
|
|
|
post(auth::connections::last_fm::create_request),
|
|
|
|
)
|
2025-04-26 21:55:32 -04:00
|
|
|
.route(
|
|
|
|
"/auth/user/connections/last_fm/data/{username}",
|
|
|
|
get(auth::connections::last_fm::get_request),
|
|
|
|
)
|
2025-04-26 19:23:30 -04:00
|
|
|
.route(
|
|
|
|
"/auth/user/connections/last_fm/api_proxy",
|
|
|
|
post(auth::connections::last_fm::proxy_request),
|
|
|
|
)
|
2025-04-27 23:11:37 -04:00
|
|
|
// channels
|
|
|
|
.route("/channels", post(channels::channels::create_request))
|
|
|
|
.route(
|
|
|
|
"/channels/group",
|
|
|
|
post(channels::channels::create_group_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/channels/{id}/title",
|
|
|
|
post(channels::channels::update_title_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/channels/{id}/move",
|
|
|
|
post(channels::channels::update_position_request),
|
|
|
|
)
|
|
|
|
.route("/channels/{id}", delete(channels::channels::delete_request))
|
|
|
|
.route(
|
|
|
|
"/channels/{id}/kick",
|
|
|
|
post(channels::channels::kick_member_request),
|
|
|
|
)
|
|
|
|
// messages
|
|
|
|
.route(
|
2025-04-29 16:53:34 -04:00
|
|
|
"/_connect/{id}",
|
2025-04-27 23:11:37 -04:00
|
|
|
any(channels::messages::subscription_handler),
|
|
|
|
)
|
|
|
|
.route("/messages", post(channels::messages::create_request))
|
|
|
|
.route("/messages/{id}", delete(channels::messages::delete_request))
|
2025-05-02 20:08:35 -04:00
|
|
|
// subscriptions
|
|
|
|
.route(
|
|
|
|
"/auth/user/me/subscriptions/{channel_id}/{message_id}",
|
|
|
|
post(auth::subscriptions::update_last_message_request),
|
|
|
|
)
|
|
|
|
.route(
|
|
|
|
"/auth/user/me/subscriptions/{channel_id}",
|
|
|
|
delete(auth::subscriptions::delete_request),
|
|
|
|
)
|
2025-03-22 22:17:47 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
2025-04-02 23:26:43 -04:00
|
|
|
pub struct LoginProps {
|
2025-03-22 22:17:47 -04:00
|
|
|
pub username: String,
|
|
|
|
pub password: String,
|
2025-04-04 21:42:08 -04:00
|
|
|
#[serde(default)]
|
|
|
|
pub totp: String,
|
2025-03-22 22:17:47 -04:00
|
|
|
}
|
2025-03-24 19:55:08 -04:00
|
|
|
|
2025-04-02 23:26:43 -04:00
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct RegisterProps {
|
|
|
|
pub username: String,
|
|
|
|
pub password: String,
|
|
|
|
pub policy_consent: bool,
|
|
|
|
pub captcha_response: String,
|
|
|
|
}
|
|
|
|
|
2025-03-24 19:55:08 -04:00
|
|
|
#[derive(Deserialize)]
|
2025-03-27 18:10:47 -04:00
|
|
|
pub struct CreateCommunity {
|
2025-03-24 19:55:08 -04:00
|
|
|
pub title: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
2025-03-29 00:26:56 -04:00
|
|
|
pub struct UpdateCommunityTitle {
|
2025-03-24 19:55:08 -04:00
|
|
|
pub title: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
2025-03-27 18:10:47 -04:00
|
|
|
pub struct UpdateCommunityContext {
|
|
|
|
pub context: CommunityContext,
|
2025-03-24 19:55:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
2025-03-29 00:26:56 -04:00
|
|
|
pub struct UpdateCommunityReadAccess {
|
2025-03-27 18:10:47 -04:00
|
|
|
pub access: CommunityReadAccess,
|
2025-03-24 19:55:08 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
2025-03-29 00:26:56 -04:00
|
|
|
pub struct UpdateCommunityWriteAccess {
|
2025-03-27 18:10:47 -04:00
|
|
|
pub access: CommunityWriteAccess,
|
2025-03-24 19:55:08 -04:00
|
|
|
}
|
|
|
|
|
2025-04-01 15:03:56 -04:00
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct UpdateCommunityJoinAccess {
|
|
|
|
pub access: CommunityJoinAccess,
|
|
|
|
}
|
|
|
|
|
2025-03-24 19:55:08 -04:00
|
|
|
#[derive(Deserialize)]
|
2025-03-29 00:26:56 -04:00
|
|
|
pub struct CreatePost {
|
2025-03-24 19:55:08 -04:00
|
|
|
pub content: String,
|
2025-03-29 00:26:56 -04:00
|
|
|
pub community: String,
|
2025-03-25 22:52:47 -04:00
|
|
|
#[serde(default)]
|
2025-03-29 00:26:56 -04:00
|
|
|
pub replying_to: Option<String>,
|
2025-04-12 22:25:54 -04:00
|
|
|
#[serde(default)]
|
|
|
|
pub answering: String,
|
2025-03-24 19:55:08 -04:00
|
|
|
}
|
|
|
|
|
2025-04-10 18:16:52 -04:00
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct CreateRepost {
|
|
|
|
pub content: String,
|
|
|
|
pub community: String,
|
|
|
|
}
|
|
|
|
|
2025-03-24 19:55:08 -04:00
|
|
|
#[derive(Deserialize)]
|
2025-03-29 00:26:56 -04:00
|
|
|
pub struct UpdatePostContent {
|
2025-03-24 19:55:08 -04:00
|
|
|
pub content: String,
|
|
|
|
}
|
2025-03-24 20:23:52 -04:00
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
2025-03-29 00:26:56 -04:00
|
|
|
pub struct UpdatePostContext {
|
2025-03-27 18:10:47 -04:00
|
|
|
pub context: PostContext,
|
2025-03-24 20:23:52 -04:00
|
|
|
}
|
2025-03-24 22:42:33 -04:00
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct CreateReaction {
|
2025-03-29 22:27:57 -04:00
|
|
|
pub asset: String,
|
2025-03-24 22:42:33 -04:00
|
|
|
pub asset_type: AssetType,
|
2025-03-24 22:49:15 -04:00
|
|
|
pub is_like: bool,
|
2025-03-24 22:42:33 -04:00
|
|
|
}
|
2025-03-26 21:46:21 -04:00
|
|
|
|
2025-04-02 11:39:51 -04:00
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct CreateReport {
|
|
|
|
pub content: String,
|
|
|
|
pub asset: String,
|
|
|
|
pub asset_type: AssetType,
|
|
|
|
}
|
|
|
|
|
2025-03-31 11:45:34 -04:00
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct UpdateUserPassword {
|
|
|
|
pub from: String,
|
|
|
|
pub to: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct UpdateUserUsername {
|
|
|
|
pub to: String,
|
|
|
|
}
|
|
|
|
|
2025-03-26 21:46:21 -04:00
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct UpdateUserIsVerified {
|
|
|
|
pub is_verified: bool,
|
|
|
|
}
|
2025-03-29 23:51:13 -04:00
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct UpdateNotificationRead {
|
|
|
|
pub read: bool,
|
|
|
|
}
|
2025-03-31 15:39:49 -04:00
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct UpdateMembershipRole {
|
|
|
|
pub role: CommunityPermission,
|
|
|
|
}
|
2025-04-01 16:12:13 -04:00
|
|
|
|
2025-04-24 16:57:25 -04:00
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct UpdateCommunityOwner {
|
|
|
|
pub user: String,
|
|
|
|
}
|
|
|
|
|
2025-04-02 11:39:51 -04:00
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct UpdateUserRole {
|
|
|
|
pub role: FinePermission,
|
|
|
|
}
|
|
|
|
|
2025-04-01 16:12:13 -04:00
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct DeleteUser {
|
|
|
|
pub password: String,
|
|
|
|
}
|
2025-04-01 23:16:09 -04:00
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct CreateIpBan {
|
|
|
|
pub reason: String,
|
|
|
|
}
|
2025-04-04 21:42:08 -04:00
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct DisableTotp {
|
|
|
|
pub totp: String,
|
|
|
|
}
|
2025-04-11 22:12:43 -04:00
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct CreateUserWarning {
|
|
|
|
pub content: String,
|
|
|
|
}
|
2025-04-12 22:25:54 -04:00
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct CreateQuestion {
|
|
|
|
pub content: String,
|
|
|
|
pub is_global: bool,
|
|
|
|
#[serde(default)]
|
|
|
|
pub receiver: String,
|
|
|
|
#[serde(default)]
|
|
|
|
pub community: String,
|
|
|
|
}
|
2025-04-27 23:11:37 -04:00
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct CreateChannel {
|
|
|
|
pub title: String,
|
|
|
|
pub community: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct CreateGroupChannel {
|
|
|
|
pub title: String,
|
|
|
|
pub members: Vec<String>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct UpdateChannelTitle {
|
|
|
|
pub title: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct UpdateChannelPosition {
|
|
|
|
pub position: i32,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct CreateMessage {
|
|
|
|
pub content: String,
|
|
|
|
pub channel: String,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Deserialize)]
|
|
|
|
pub struct KickMember {
|
|
|
|
pub member: String,
|
|
|
|
}
|