Skip to content

Commit 46becf9

Browse files
author
Isaac Herrera
committed
refactor: rename bounded context, simplify domain model definnitions and improve prompts
1 parent 12d709c commit 46becf9

40 files changed

+58
-150
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "arpeggio"
3-
version = "1.0.5"
3+
version = "1.0.6"
44
edition = "2021"
55
authors = ["Isaac Herrera <isaacdecoded@gmail.com>"]
66
description = "CLI for managing Arpeggio-based projects"
File renamed without changes.

src/cli/bounded_context/adapters/presenters/add_aggregate_presenter.rs renamed to src/clean_architecture/bounded_context/adapters/presenters/add_aggregate_presenter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::error::Error;
22
use async_trait::async_trait;
33
use crate::core::application::use_case_output_port::UseCaseOutputPort;
4-
use crate::cli::bounded_context::application::commands::add_aggregate_use_case::AddAggregateResponseModel;
4+
use crate::clean_architecture::bounded_context::application::commands::add_aggregate_use_case::AddAggregateResponseModel;
55

66
pub struct AddAggregatePresenter;
77

src/cli/bounded_context/adapters/presenters/add_component_presenter.rs renamed to src/clean_architecture/bounded_context/adapters/presenters/add_component_presenter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::error::Error;
22
use async_trait::async_trait;
33
use crate::core::application::use_case_output_port::UseCaseOutputPort;
4-
use crate::cli::bounded_context::{
4+
use crate::clean_architecture::bounded_context::{
55
domain::enums::component_type::ComponentType,
66
application::commands::add_component_use_case::AddComponentResponseModel,
77
};

src/cli/bounded_context/adapters/presenters/create_bounded_context_presenter.rs renamed to src/clean_architecture/bounded_context/adapters/presenters/create_bounded_context_presenter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::error::Error;
22
use async_trait::async_trait;
33
use crate::core::application::use_case_output_port::UseCaseOutputPort;
4-
use crate::cli::bounded_context::application::commands::create_bounded_context_use_case::CreateBoundedContextResponseModel;
4+
use crate::clean_architecture::bounded_context::application::commands::create_bounded_context_use_case::CreateBoundedContextResponseModel;
55

66
pub struct CreateBoundedContextPresenter;
77

src/cli/bounded_context/adapters/presenters/find_bounded_contexts_presenter.rs renamed to src/clean_architecture/bounded_context/adapters/presenters/find_bounded_contexts_presenter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::error::Error;
22
use async_trait::async_trait;
33
use crate::core::application::use_case_output_port::UseCaseOutputPort;
4-
use crate::cli::bounded_context::application::queries::find_bounded_contexts_use_case::{
4+
use crate::clean_architecture::bounded_context::application::queries::find_bounded_contexts_use_case::{
55
FindBoundedContextsResponseModel,
66
BoundedContextReadModel,
77
};

src/cli/bounded_context/adapters/presenters/mod.rs renamed to src/clean_architecture/bounded_context/adapters/presenters/mod.rs

File renamed without changes.

src/cli/bounded_context/application/commands/add_aggregate_use_case.rs renamed to src/clean_architecture/bounded_context/application/commands/add_aggregate_use_case.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::error::Error;
33
use anyhow::Result;
44
use async_trait::async_trait;
55
use crate::{
6-
cli::bounded_context::domain::{
6+
clean_architecture::bounded_context::domain::{
77
enums::layer_name::LayerName,
88
repositories::bounded_context_repository::BoundedContextRepository,
99
value_objects::{

src/cli/bounded_context/application/commands/add_component_use_case.rs renamed to src/clean_architecture/bounded_context/application/commands/add_component_use_case.rs

Lines changed: 7 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ use std::error::Error;
33
use anyhow::Result;
44
use async_trait::async_trait;
55
use crate::{
6-
cli::bounded_context::domain::{
6+
clean_architecture::bounded_context::domain::{
77
enums::component_type::ComponentType,
88
repositories::bounded_context_repository::BoundedContextRepository,
9-
value_objects::component_name::ComponentName,
9+
value_objects::layer_component::{ LayerComponent, LayerComponentValue },
1010
},
1111
core::{
1212
application::{
@@ -49,60 +49,6 @@ impl<'a> AddComponentUseCase<'a> {
4949
}
5050
}
5151

52-
/*
53-
fn get_aggregate_layers(&self) -> Vec<AggregateLayer> {
54-
vec![
55-
AggregateLayer::new(AggregateLayerValue {
56-
name: AggregateLayerName::Domain,
57-
components: vec![
58-
AggregateLayerComponent::Entities,
59-
AggregateLayerComponent::Events,
60-
AggregateLayerComponent::ValueObjects,
61-
AggregateLayerComponent::Repositories,
62-
AggregateLayerComponent::Services
63-
],
64-
}),
65-
AggregateLayer::new(AggregateLayerValue {
66-
name: AggregateLayerName::Application,
67-
components: vec![
68-
AggregateLayerComponent::Commands,
69-
AggregateLayerComponent::Queries,
70-
AggregateLayerComponent::Subscribers
71-
],
72-
}),
73-
AggregateLayer::new(AggregateLayerValue {
74-
name: AggregateLayerName::Adapters,
75-
components: vec![
76-
AggregateLayerComponent::Controllers,
77-
AggregateLayerComponent::Presenters
78-
],
79-
}),
80-
AggregateLayer::new(AggregateLayerValue {
81-
name: AggregateLayerName::Infrastructure,
82-
components: vec![
83-
AggregateLayerComponent::Repositories,
84-
AggregateLayerComponent::Services
85-
],
86-
})
87-
]
88-
}
89-
90-
fn prepare_aggregate_layers(
91-
&self,
92-
layers: Vec<AddAggregateLayerRequestModel>
93-
) -> Vec<AggregateLayer> {
94-
layers
95-
.iter()
96-
.map(|layer| {
97-
AggregateLayer::new(AggregateLayerValue {
98-
name: layer.layer_name.clone(),
99-
components: layer.components.clone(),
100-
})
101-
})
102-
.collect()
103-
}
104-
*/
105-
10652
async fn try_interact(
10753
&self,
10854
request_model: AddComponentRequestModel
@@ -113,14 +59,11 @@ impl<'a> AddComponentUseCase<'a> {
11359
match result {
11460
Some(mut bounded_context) => {
11561
let aggregate_id = IdentityObject::new(request_model.aggregate_name);
116-
let component_name = ComponentName::new(
117-
request_model.component.component_name.clone()
118-
);
119-
bounded_context.add_aggregate_component(
120-
&aggregate_id,
121-
request_model.component.component_type.clone(),
122-
component_name
123-
)?;
62+
let layer_component = LayerComponent::new(LayerComponentValue {
63+
component_type: request_model.component.component_type.clone(),
64+
component_name: request_model.component.component_name.clone(),
65+
});
66+
bounded_context.add_aggregate_component(&aggregate_id, layer_component)?;
12467

12568
self.repository.write_bounded_context(&bounded_context).await?;
12669
Ok(AddComponentResponseModel {

0 commit comments

Comments
 (0)