mirror of
https://github.com/aljazceru/cdk.git
synced 2025-12-18 21:25:09 +01:00
feat: remove delete fns for quotes (#1122)
This commit is contained in:
@@ -170,8 +170,7 @@ pub trait QuotesTransaction<'a> {
|
||||
quote_id: &QuoteId,
|
||||
amount_issued: Amount,
|
||||
) -> Result<Amount, Self::Err>;
|
||||
/// Remove [`MintMintQuote`]
|
||||
async fn remove_mint_quote(&mut self, quote_id: &QuoteId) -> Result<(), Self::Err>;
|
||||
|
||||
/// Get [`mint::MeltQuote`] and lock it for update in this transaction
|
||||
async fn get_melt_quote(
|
||||
&mut self,
|
||||
@@ -196,8 +195,7 @@ pub trait QuotesTransaction<'a> {
|
||||
new_state: MeltQuoteState,
|
||||
payment_proof: Option<String>,
|
||||
) -> Result<(MeltQuoteState, mint::MeltQuote), Self::Err>;
|
||||
/// Remove [`mint::MeltQuote`]
|
||||
async fn remove_melt_quote(&mut self, quote_id: &QuoteId) -> Result<(), Self::Err>;
|
||||
|
||||
/// Get all [`MintMintQuote`]s and lock it for update in this transaction
|
||||
async fn get_mint_quote_by_request(
|
||||
&mut self,
|
||||
|
||||
@@ -878,14 +878,6 @@ VALUES (:quote_id, :amount, :timestamp);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn remove_mint_quote(&mut self, quote_id: &QuoteId) -> Result<(), Self::Err> {
|
||||
query(r#"DELETE FROM mint_quote WHERE id=:id"#)?
|
||||
.bind("id", quote_id.to_string())
|
||||
.execute(&self.inner)
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn add_melt_quote(&mut self, quote: mint::MeltQuote) -> Result<(), Self::Err> {
|
||||
// Now insert the new quote
|
||||
query(
|
||||
@@ -1020,20 +1012,6 @@ VALUES (:quote_id, :amount, :timestamp);
|
||||
Ok((old_state, quote))
|
||||
}
|
||||
|
||||
async fn remove_melt_quote(&mut self, quote_id: &QuoteId) -> Result<(), Self::Err> {
|
||||
query(
|
||||
r#"
|
||||
DELETE FROM melt_quote
|
||||
WHERE id=:id
|
||||
"#,
|
||||
)?
|
||||
.bind("id", quote_id.to_string())
|
||||
.execute(&self.inner)
|
||||
.await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn get_mint_quote(&mut self, quote_id: &QuoteId) -> Result<Option<MintQuote>, Self::Err> {
|
||||
let payments = get_mint_quote_payments(&self.inner, quote_id).await?;
|
||||
let issuance = get_mint_quote_issuance(&self.inner, quote_id).await?;
|
||||
|
||||
@@ -376,39 +376,6 @@ impl Mint {
|
||||
result
|
||||
}
|
||||
|
||||
/// Removes a mint quote from the database
|
||||
///
|
||||
/// # Arguments
|
||||
/// * `quote_id` - The UUID of the quote to remove
|
||||
///
|
||||
/// # Returns
|
||||
/// * `Ok(())` if removal was successful
|
||||
/// * `Error` if the quote doesn't exist or removal fails
|
||||
#[instrument(skip_all)]
|
||||
pub async fn remove_mint_quote(&self, quote_id: &QuoteId) -> Result<(), Error> {
|
||||
#[cfg(feature = "prometheus")]
|
||||
METRICS.inc_in_flight_requests("remove_mint_quote");
|
||||
|
||||
let result = async {
|
||||
let mut tx = self.localstore.begin_transaction().await?;
|
||||
tx.remove_mint_quote(quote_id).await?;
|
||||
tx.commit().await?;
|
||||
Ok(())
|
||||
}
|
||||
.await;
|
||||
|
||||
#[cfg(feature = "prometheus")]
|
||||
{
|
||||
METRICS.dec_in_flight_requests("remove_mint_quote");
|
||||
METRICS.record_mint_operation("remove_mint_quote", result.is_ok());
|
||||
if result.is_err() {
|
||||
METRICS.record_error();
|
||||
}
|
||||
}
|
||||
|
||||
result
|
||||
}
|
||||
|
||||
/// Marks a mint quote as paid based on the payment request ID
|
||||
///
|
||||
/// Looks up the mint quote by the payment request ID and marks it as paid
|
||||
|
||||
Reference in New Issue
Block a user