From b0e79e26a40eeac3a21d41af1f1d273ba6188035 Mon Sep 17 00:00:00 2001 From: silverpill Date: Tue, 6 Sep 2022 15:44:30 +0000 Subject: [PATCH] Change invoice API to accept sender ID instead of acct --- docs/openapi.yaml | 8 ++++---- src/mastodon_api/subscriptions/types.rs | 4 ++-- src/mastodon_api/subscriptions/views.rs | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/openapi.yaml b/docs/openapi.yaml index 72e41b1..9d35a53 100644 --- a/docs/openapi.yaml +++ b/docs/openapi.yaml @@ -754,11 +754,11 @@ paths: schema: type: object properties: - sender: - description: Sender actor address (webfinger account URI). + sender_id: + description: Sender ID. type: string - example: user@example.org - recipient: + format: uuid + recipient_id: description: Recipient ID. type: string format: uuid diff --git a/src/mastodon_api/subscriptions/types.rs b/src/mastodon_api/subscriptions/types.rs index 3e107c6..6880f93 100644 --- a/src/mastodon_api/subscriptions/types.rs +++ b/src/mastodon_api/subscriptions/types.rs @@ -7,8 +7,8 @@ use crate::models::profiles::types::PaymentOption; #[derive(Deserialize)] pub struct InvoiceData { - pub sender: String, // acct - pub recipient: Uuid, + pub sender_id: Uuid, + pub recipient_id: Uuid, } #[derive(Serialize)] diff --git a/src/mastodon_api/subscriptions/views.rs b/src/mastodon_api/subscriptions/views.rs index 99b3adf..056e67b 100644 --- a/src/mastodon_api/subscriptions/views.rs +++ b/src/mastodon_api/subscriptions/views.rs @@ -14,7 +14,7 @@ use crate::mastodon_api::accounts::types::Account; use crate::mastodon_api::oauth::auth::get_current_user; use crate::models::invoices::queries::create_invoice; use crate::models::profiles::queries::{ - get_profile_by_acct, + get_profile_by_id, update_profile, }; use crate::models::profiles::types::{ @@ -177,8 +177,8 @@ async fn create_invoice_view( .monero_config() .ok_or(HttpError::NotSupported)?; let db_client = &**get_database_client(&db_pool).await?; - let sender = get_profile_by_acct(db_client, &invoice_data.sender).await?; - let recipient = get_user_by_id(db_client, &invoice_data.recipient).await?; + let sender = get_profile_by_id(db_client, &invoice_data.sender_id).await?; + let recipient = get_user_by_id(db_client, &invoice_data.recipient_id).await?; let payment_address = create_monero_address(monero_config).await .map_err(|_| HttpError::InternalError)? .to_string();