Created a domain module to decouple flows from the core.

This commit is contained in:
2025-05-03 22:49:01 +02:00
parent fce0ebd76b
commit 4e26d3cdcb
9 changed files with 54 additions and 29 deletions

View File

@@ -4,7 +4,7 @@ use inquire::Select;
use crate::flows::view_gamenight::ViewGamenight;
use super::{abort::Abort, *};
use super::{exit::Exit, *};
#[derive(Clone)]
pub struct ListGamenights {
@@ -23,9 +23,9 @@ impl<'a> Flow<'a> for ListGamenights {
let response = get_gamenights(&state.configuration).await?;
let mut view_flows = response.into_iter().map(|gamenight| -> Box<dyn Flow<'a> + Send> {
Box::new(ViewGamenight::new(gamenight))
Box::new(ViewGamenight::new(gamenight.into()))
}).collect::<Vec<Box<dyn Flow<'a> + Send>>>();
view_flows.push(Box::new(Abort::new()));
view_flows.push(Box::new(Exit::new()));
let choice = Select::new("What gamenight would you like to view?", view_flows)
.prompt_skippable()?;