removed default implementation of KeyDomain
This commit is contained in:
parent
1f43b186a8
commit
3e056ed63f
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "torn-key-pool"
|
name = "torn-key-pool"
|
||||||
version = "0.5.1"
|
version = "0.5.2"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["Pyrit [2111649]"]
|
authors = ["Pyrit [2111649]"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
|
@ -39,8 +39,6 @@ pub trait KeyDomain: Clone + std::fmt::Debug + Send + Sync {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> KeyDomain for T where T: Clone + std::fmt::Debug + Send + Sync {}
|
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
pub trait KeyPoolStorage {
|
pub trait KeyPoolStorage {
|
||||||
type Key: ApiKey;
|
type Key: ApiKey;
|
||||||
|
|
|
@ -502,10 +502,20 @@ pub(crate) mod test {
|
||||||
#[serde(tag = "type", rename_all = "snake_case")]
|
#[serde(tag = "type", rename_all = "snake_case")]
|
||||||
pub(crate) enum Domain {
|
pub(crate) enum Domain {
|
||||||
All,
|
All,
|
||||||
|
Guild { id: i64 },
|
||||||
User { id: i32 },
|
User { id: i32 },
|
||||||
Faction { id: i32 },
|
Faction { id: i32 },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl KeyDomain for Domain {
|
||||||
|
fn fallback(&self) -> Option<Self> {
|
||||||
|
match self {
|
||||||
|
Self::Guild { id: _ } => Some(Self::All),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) async fn setup() -> PgKeyPoolStorage<Domain> {
|
pub(crate) async fn setup() -> PgKeyPoolStorage<Domain> {
|
||||||
INIT.call_once(|| {
|
INIT.call_once(|| {
|
||||||
dotenv::dotenv().ok();
|
dotenv::dotenv().ok();
|
||||||
|
|
Loading…
Reference in a new issue