Created a domain module to decouple flows from the core.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
|
||||
use gamenight_api_client_rs::{apis::default_api::post_gamenight, models};
|
||||
use inquire::{Text, DateSelect};
|
||||
use inquire::{CustomType, DateSelect, Text};
|
||||
use chrono::{self, Local, NaiveTime};
|
||||
|
||||
use super::*;
|
||||
@@ -21,9 +21,14 @@ impl<'a> Flow<'a> for AddGamenight {
|
||||
async fn run(&self, state: &'a mut GamenightState) -> FlowResult<'a> {
|
||||
let mut add_gamenight = models::AddGamenightRequestBody::new();
|
||||
|
||||
add_gamenight.name = Some(Text::new("What should we call your gamenight").prompt()?);
|
||||
add_gamenight.datetime = Some(DateSelect::new("When is your gamenight").prompt()?
|
||||
.and_time(NaiveTime::default())
|
||||
add_gamenight.name = Some(Text::new("What should we call your gamenight")
|
||||
.prompt()?);
|
||||
let naive_date = DateSelect::new("When is your gamenight")
|
||||
.prompt()?;
|
||||
let naive_time = CustomType::<NaiveTime>::new("At What time")
|
||||
.prompt()?;
|
||||
add_gamenight.datetime = Some(naive_date
|
||||
.and_time(naive_time)
|
||||
.and_local_timezone(Local)
|
||||
.earliest()
|
||||
.unwrap()
|
||||
|
||||
Reference in New Issue
Block a user