1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
use crate::{types, Party, Result, Store};
use async_trait::async_trait;

#[async_trait]
pub trait PartyStore
where
    Self: Store + Send + 'static,
{
    type PartyModel: Party;
    type TemporaryModel;

    async fn delete_party(&self, party_id: <Self::PartyModel as Party>::Id) -> Result<()>;

    async fn save_new_party(
        &self,
        temporary_model: Self::TemporaryModel,
        credentials: types::Credential,
        details: types::VersionDetails,
    ) -> Result<Self::PartyModel>;

    async fn update_party(
        &self,
        model: Self::PartyModel,
        credentials: types::Credential,
        details: types::VersionDetails,
    ) -> Result<Self::PartyModel>;

    async fn get_our_roles(&self) -> Result<Vec<types::CredentialsRole>>;
}