From ed53fbc9097370feeda1c5507878933643a9bcc5 Mon Sep 17 00:00:00 2001 From: Yigit Sever Date: Sat, 10 Apr 2021 14:16:41 +0300 Subject: Trying to auth --- src/schema.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/schema.rs') diff --git a/src/schema.rs b/src/schema.rs index 556e625..c4917ab 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -29,6 +29,8 @@ pub struct Db { pub blockchain: Arc>>, // every proposer can have _one_ pending transaction, a way to enforce this, String is proposer identifier pub pending_transactions: Arc>>, + // this was bound to happen eventually + pub users: Arc>>, } impl Db { @@ -36,12 +38,15 @@ impl Db { Db { blockchain: Arc::new(RwLock::new(Vec::new())), pending_transactions: Arc::new(RwLock::new(HashMap::new())), + users: Arc::new(RwLock::new(HashMap::new())), } } } -/// A transaction between `source` and `target` that moves `amount` -#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)] +/// A transaction between `source` and `target` that moves `amount` Note: +/// https://serde.rs/container-attrs.html might be valueable to normalize the serialize/deserialize +/// conventions as these will be hashed +#[derive(Serialize, Deserialize, Debug)] pub struct Transaction { pub source: String, pub target: String, @@ -65,5 +70,10 @@ pub struct Block { pub hash: String, // future proof'd baby } +#[derive(Serialize, Deserialize, Debug)] +pub struct User { + username: String, + token: String +} // TODO: write schema tests using the original repo <09-04-21, yigit> // -- cgit v1.2.3-70-g09d2