File tree Expand file tree Collapse file tree 5 files changed +71
-4
lines changed Expand file tree Collapse file tree 5 files changed +71
-4
lines changed Original file line number Diff line number Diff line change 1+ use rust_db_manager_core:: infrastructure:: repository:: e_db_repository:: EDBRepository ;
2+
3+ use super :: dto:: dto_db_resources:: DTODBResources ;
4+
5+ pub trait WebEDBRepository {
6+
7+ fn resources ( & self ) -> DTODBResources ;
8+
9+ }
10+
11+ impl WebEDBRepository for EDBRepository {
12+
13+ fn resources ( & self ) -> DTODBResources {
14+ match self {
15+ EDBRepository :: MongoDB => DTODBResources :: new (
16+ String :: from ( "https://www.mongodb.com/" ) ,
17+ String :: from ( "#00ED64" ) ,
18+ String :: from ( "https://thumbs.bfldr.com/at/hj345wvxsvpbc82vchqcj9qh?expiry=1714820885&fit=bounds&height=162&sig=NTU3MjQ1YzFjYzljYzFhY2UxNjI0ZDA4ZjhjNTc4ZDI2YzViNmMxOQ%3D%3D&width=262" )
19+ ) ,
20+ }
21+ }
22+
23+ }
Original file line number Diff line number Diff line change 11use rust_db_manager_core:: infrastructure:: db_service_lite:: DBServiceLite ;
22use serde:: { Deserialize , Serialize } ;
33
4+ use super :: dto_db_service_web_category:: DTODBServiceWebCategory ;
5+
46#[ derive( Clone , Serialize , Deserialize ) ]
57pub struct DTODBServiceLite {
68 pub name : String ,
7- pub category : String
9+ pub category : DTODBServiceWebCategory
810}
911
1012impl DTODBServiceLite {
1113
1214 pub fn from_vec ( collection : Vec < DBServiceLite > ) -> Vec < DTODBServiceLite > {
13- collection. iter ( ) . map ( |s| DTODBServiceLite { name : s. name ( ) , category : s. category ( ) . to_string ( ) } ) . collect ( )
15+ collection. iter ( ) . map ( |s| DTODBServiceLite { name : s. name ( ) , category : DTODBServiceWebCategory :: from ( s. category ( ) ) } ) . collect ( )
1416 }
1517
1618}
Original file line number Diff line number Diff line change 1+ use rust_db_manager_core:: infrastructure:: { db_service_lite:: DBServiceLite , repository:: e_db_repository:: EDBRepository } ;
2+ use serde:: { Deserialize , Serialize } ;
3+
4+ use crate :: infrastructure:: { db_assets:: WebEDBRepository , dto:: dto_db_resources:: DTODBResources } ;
5+
6+ #[ derive( Clone , Serialize , Deserialize ) ]
7+ pub struct DTODBServiceWebCategory {
8+ pub category : String ,
9+ pub resources : DTODBResources
10+ }
11+
12+ impl DTODBServiceWebCategory {
13+
14+ pub fn from ( category : EDBRepository ) -> DTODBServiceWebCategory {
15+ DTODBServiceWebCategory {
16+ category : category. to_string ( ) ,
17+ resources : category. resources ( )
18+ }
19+ }
20+
21+ }
Original file line number Diff line number Diff line change 1+ use serde:: { Deserialize , Serialize } ;
2+
3+ #[ derive( Clone , Serialize , Deserialize ) ]
4+ pub struct DTODBResources {
5+ pub web_site : String ,
6+ pub color : String ,
7+ pub image : String
8+ }
9+
10+ impl DTODBResources {
11+
12+ pub fn new ( web_site : String , color : String , image : String ) -> DTODBResources {
13+ DTODBResources {
14+ web_site, color, image
15+ }
16+ }
17+
18+ }
Original file line number Diff line number Diff line change @@ -11,13 +11,16 @@ pub mod infrastructure {
1111 pub mod dto {
1212 pub mod db_service {
1313 pub mod dto_db_connection_data;
14- pub mod dto_db_service;
15- pub mod dto_paginated_collection;
14+ pub mod dto_db_service_web_category;
1615 pub mod dto_db_service_lite;
16+ pub mod dto_paginated_collection;
17+ pub mod dto_db_service;
1718 }
19+ pub mod dto_db_resources;
1820 pub mod dto_query_pagination;
1921 }
2022 pub mod controller;
23+ pub mod db_assets;
2124 pub mod pagination;
2225 pub mod utils;
2326}
You can’t perform that action at this time.
0 commit comments