diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-11 14:52:44 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-11 14:52:44 -0800 |
commit | 54e34ddd56b705cba239f88a9239c603d3ecd20e (patch) | |
tree | 5007cbc2d315d04b5788eb6cec0b7537e8baa51b /rust/src/bin | |
parent | cd5cf1b9f7a50cd3c2f2a42b4a0b3743a5c31d7e (diff) | |
download | fatcat-54e34ddd56b705cba239f88a9239c603d3ecd20e.tar.gz fatcat-54e34ddd56b705cba239f88a9239c603d3ecd20e.zip |
yet more edit lifecycle progress
Diffstat (limited to 'rust/src/bin')
-rw-r--r-- | rust/src/bin/fatcat-auth.rs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/rust/src/bin/fatcat-auth.rs b/rust/src/bin/fatcat-auth.rs index 0ba543b4..652c0db5 100644 --- a/rust/src/bin/fatcat-auth.rs +++ b/rust/src/bin/fatcat-auth.rs @@ -2,9 +2,11 @@ use clap::{App, SubCommand}; +use fatcat::editing_crud::EditorCrud; use fatcat::errors::Result; use fatcat::identifiers::FatcatId; -use fatcat::{auth, editing, server}; +use fatcat::{auth, server}; +use fatcat_api_spec::models::Editor; use std::process; use std::str::FromStr; @@ -75,14 +77,16 @@ fn main() -> Result<()> { fatcat::auth::print_editors(&db_conn)?; } ("create-editor", Some(subm)) => { - let editor = editing::create_editor( - &db_conn, - subm.value_of("username").unwrap().to_string(), - subm.is_present("admin"), - subm.is_present("bot"), - )?; + let editor = Editor { + editor_id: None, + username: subm.value_of("username").unwrap().to_string(), + is_admin: Some(subm.is_present("admin")), + is_bot: Some(subm.is_present("bot")), + is_active: Some(true), + }; + let editor_row = editor.db_create(&db_conn)?; //println!("{:?}", editor); - println!("{}", FatcatId::from_uuid(&editor.id).to_string()); + println!("{}", FatcatId::from_uuid(&editor_row.id).to_string()); } ("create-token", Some(subm)) => { let editor_id = FatcatId::from_str(subm.value_of("editor-id").unwrap())?; |