feat: README, config.example, turnstile integration, exchange rate, auth utils refactor

This commit is contained in:
Ember Moth
2026-07-05 21:15:17 +08:00
parent 25d190b90e
commit 4ffdc89421
19 changed files with 763 additions and 4 deletions
+10 -1
View File
@@ -4,7 +4,7 @@ use asynq::error::Result;
use asynq::task::Task;
use crate::config::Config;
use crate::queue::service::task::QuotaTaskLogic;
use crate::queue::service::task::{QuotaTaskLogic, RateLogic};
use crate::repository::Repositories;
pub async fn quota_task(task: Task, repos: Arc<Repositories>, config: Arc<Config>) -> Result<()> {
@@ -13,3 +13,12 @@ pub async fn quota_task(task: Task, repos: Arc<Repositories>, config: Arc<Config
.await
.map_err(|e| asynq::error::Error::other(e.to_string()))
}
/// Fetch the current exchange rate and persist it.
/// Scheduled daily at 01:00 by the scheduler (mirrors `rateLogic.go`).
pub async fn rate_task(_task: Task, repos: Arc<Repositories>, config: Arc<Config>) -> Result<()> {
RateLogic::new(repos, config)
.execute()
.await
.map_err(|e| asynq::error::Error::other(e.to_string()))
}