Finished work on ciphers (import, update, and the missing types)

This commit is contained in:
Daniel García
2018-02-16 00:32:26 +01:00
parent 84a75c871b
commit 7a3308200a
4 changed files with 113 additions and 62 deletions

View File

@ -18,10 +18,6 @@ pub struct Cipher {
pub folder_uuid: Option<String>,
pub organization_uuid: Option<String>,
// Login = 1,
// SecureNote = 2,
// Card = 3,
// Identity = 4
pub type_: i32,
pub data: String,
@ -113,4 +109,10 @@ impl Cipher {
.filter(ciphers::user_uuid.eq(user_uuid))
.load::<Self>(&**conn).expect("Error loading ciphers")
}
pub fn find_by_folder(folder_uuid: &str, conn: &DbConn) -> Vec<Self> {
ciphers::table
.filter(ciphers::folder_uuid.eq(folder_uuid))
.load::<Self>(&**conn).expect("Error loading ciphers")
}
}