You've already forked pages
forked from didirus/AstralRinth
Automatically fail payments that are older than 30 days (#3697)
This commit is contained in:
15
apps/labrinth/.sqlx/query-33893ae0a7d244c33b489e4d4fa444fa17a6bb5b7a834794a5482f4dc85c6ce0.json
generated
Normal file
15
apps/labrinth/.sqlx/query-33893ae0a7d244c33b489e4d4fa444fa17a6bb5b7a834794a5482f4dc85c6ce0.json
generated
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "\n UPDATE payouts\n SET status = $1\n WHERE status = $2 AND created < NOW() - INTERVAL '30 days'\n ",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": [
|
||||
"Varchar",
|
||||
"Text"
|
||||
]
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "33893ae0a7d244c33b489e4d4fa444fa17a6bb5b7a834794a5482f4dc85c6ce0"
|
||||
}
|
||||
@@ -735,6 +735,18 @@ pub async fn process_payout(
|
||||
pool: &PgPool,
|
||||
client: &clickhouse::Client,
|
||||
) -> Result<(), ApiError> {
|
||||
sqlx::query!(
|
||||
"
|
||||
UPDATE payouts
|
||||
SET status = $1
|
||||
WHERE status = $2 AND created < NOW() - INTERVAL '30 days'
|
||||
",
|
||||
crate::models::payouts::PayoutStatus::Failed.as_str(),
|
||||
crate::models::payouts::PayoutStatus::InTransit.as_str(),
|
||||
)
|
||||
.execute(pool)
|
||||
.await?;
|
||||
|
||||
let start: DateTime<Utc> = DateTime::from_naive_utc_and_offset(
|
||||
(Utc::now() - Duration::days(1))
|
||||
.date_naive()
|
||||
|
||||
Reference in New Issue
Block a user