diff options
| author | rtkay123 <dev@kanjala.com> | 2026-03-29 16:36:13 +0200 |
|---|---|---|
| committer | rtkay123 <dev@kanjala.com> | 2026-03-29 16:36:13 +0200 |
| commit | ff3b9fbaf400c344cae67ef9bdc9ba7d5f27b976 (patch) | |
| tree | ce417252c6ea56c540e4c78f43c9ad4af9b76c64 /lib/api-config/src/schema/mod.rs | |
| parent | 57c4a5251c30d3dc2b78059fd208d8948d999056 (diff) | |
| download | warden-ff3b9fbaf400c344cae67ef9bdc9ba7d5f27b976.tar.bz2 warden-ff3b9fbaf400c344cae67ef9bdc9ba7d5f27b976.zip | |
refactor: move state to core
Diffstat (limited to 'lib/api-config/src/schema/mod.rs')
| -rw-r--r-- | lib/api-config/src/schema/mod.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/api-config/src/schema/mod.rs b/lib/api-config/src/schema/mod.rs new file mode 100644 index 0000000..654e6ad --- /dev/null +++ b/lib/api-config/src/schema/mod.rs @@ -0,0 +1,33 @@ +pub mod create; + +use serde::{Deserialize, Serialize}; +use time::OffsetDateTime; + +use crate::ConfigurationError; + +/// Transaction to monitor +#[derive(Deserialize, Serialize)] +#[cfg_attr(feature = "utoipa", derive(utoipa::ToSchema))] +pub struct TransactionSchema { + #[serde(rename = "type")] + /// Transaction schema type + pub kind: String, + /// The schema's version + pub version: String, + /// JSON schema for transcation + #[serde(rename = "json_schema")] + pub schema: serde_json::Value, + #[serde(with = "time::serde::rfc3339")] + pub created_at: OffsetDateTime, + #[serde(with = "time::serde::rfc3339")] + pub updated_at: OffsetDateTime, +} + +pub trait SchemaDriver { + fn create( + &self, + name: impl AsRef<str>, + version: impl AsRef<str>, + schema: serde_json::Value, + ) -> impl std::future::Future<Output = Result<TransactionSchema, ConfigurationError>> + Send + Sync; +} |
