This commit is contained in:
aecsocket
2026-08-04 14:17:50 +01:00
parent 6549d047dc
commit 5c4c30e514
8 changed files with 370 additions and 1 deletions
+1
View File
@@ -14,6 +14,7 @@ pub use v3::oauth_clients;
pub use v3::organizations;
pub use v3::pack;
pub use v3::pats;
pub use v3::payout_runs;
pub use v3::payouts;
pub use v3::projects;
pub use v3::reports;
+1
View File
@@ -11,6 +11,7 @@ pub mod oauth_clients;
pub mod organizations;
pub mod pack;
pub mod pats;
pub mod payout_runs;
pub mod payouts;
pub mod projects;
pub mod reports;
@@ -0,0 +1,51 @@
use ariadne::ids::UserId;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use crate::util::time::YearMonth;
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
pub struct PayoutRun {
/// What period this payout run is for.
///
/// Payout runs are always for the period of a specific year and month -
/// they are not associated with any specific day.
pub period_start: YearMonth,
/// What state this run is in.
pub status: PayoutRunStatus,
/// When this run started running.
///
/// Only accessible to admins.
pub started_at: Option<DateTime<Utc>>,
/// What user started this run.
///
/// Only accessible to admins.
pub started_by: Option<UserId>,
/// When this run completed.
///
/// Only accessible to admins.
pub completed_at: Option<DateTime<Utc>>,
/// What payout adjustments were specified in this run.
///
/// Only accessible to admins.
pub adjustments: Option<Vec<Adjustment>>,
}
#[derive(
Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, utoipa::ToSchema,
)]
#[serde(rename_all = "snake_case")]
pub enum PayoutRunStatus {
/// We are still waiting on the ad provider to issue payouts to us.
Pending,
/// The ad provider should have issued payouts to us by now, and we will
/// soon run the payouts.
Review,
/// Payouts run is currently being performed.
Running,
/// Payouts run is complete and payouts have been distributed to users.
Done,
}
#[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)]
pub struct Adjustment {}