Skip to content

Commit 55a299c

Browse files
authored
Merge pull request #202 from refactor-group/160-feature-enhanced-coaching-sessions-endpoint
160 feature enhanced coaching sessions endpoint
2 parents ffa7a6c + ba2cb62 commit 55a299c

20 files changed

+1451
-19
lines changed

domain/src/coaching_session.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ use log::*;
1111
use sea_orm::{DatabaseConnection, IntoActiveModel};
1212
use service::config::Config;
1313

14-
pub use entity_api::coaching_session::{find_by_id, find_by_id_with_coaching_relationship};
14+
pub use entity_api::coaching_session::{
15+
find_by_id, find_by_id_with_coaching_relationship, find_by_user_with_includes, EnrichedSession,
16+
IncludeOptions,
17+
};
1518

1619
#[derive(Debug, Clone)]
1720
struct SessionDate(NaiveDateTime);

domain/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ pub use entity_api::{
99
query::{FilterOnly, IntoQueryFilterMap, QueryFilterMap},
1010
};
1111

12-
// Re-exports from `entity` crate
12+
// Re-exports from `entity` crate via `entity_api`
1313
pub use entity_api::{
1414
actions, agreements, coachees, coaches, coaching_relationships, coaching_sessions, jwts, notes,
15-
organizations, overarching_goals, query::QuerySort, user_roles, users, Id,
15+
organizations, overarching_goals, query::QuerySort, status, user_roles, users, Id,
1616
};
1717

1818
pub mod action;

entity/src/status.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
use sea_orm::entity::prelude::*;
22
use serde::{Deserialize, Serialize};
33

4-
#[derive(Debug, Clone, Eq, PartialEq, EnumIter, Deserialize, Serialize, DeriveActiveEnum)]
4+
#[derive(
5+
Debug, Clone, Eq, PartialEq, EnumIter, Deserialize, Serialize, DeriveActiveEnum, Default,
6+
)]
57
#[sea_orm(rs_type = "String", db_type = "Enum", enum_name = "status")]
68
pub enum Status {
79
#[sea_orm(string_value = "not_started")]
810
NotStarted,
911
#[sea_orm(string_value = "in_progress")]
12+
#[default]
1013
InProgress,
1114
#[sea_orm(string_value = "completed")]
1215
Completed,
1316
#[sea_orm(string_value = "wont_do")]
1417
WontDo,
1518
}
1619

17-
impl std::default::Default for Status {
18-
fn default() -> Self {
19-
Self::InProgress
20-
}
21-
}
22-
2320
impl From<&str> for Status {
2421
fn from(value: &str) -> Self {
2522
match value {
@@ -31,3 +28,14 @@ impl From<&str> for Status {
3128
}
3229
}
3330
}
31+
32+
impl std::fmt::Display for Status {
33+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
34+
match self {
35+
Self::NotStarted => write!(f, "Not Started"),
36+
Self::InProgress => write!(f, "In Progress"),
37+
Self::Completed => write!(f, "Completed"),
38+
Self::WontDo => write!(f, "Won't Do"),
39+
}
40+
}
41+
}

0 commit comments

Comments
 (0)