You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The vFolder CRUD handler in manager contains significant code duplication and lacks clarity, making it difficult to maintain.
The interface requires refactoring to enhance modularity and scalability, which will facilitate smoother integration of future features and updates.
Required Features
Define Handler container class and method
Split all existing super-role handlers in /manger/api/vfolder.py into Service and Repository layers for each interest
Apply Handler’s method to new route
Implementation Detail (interface)
Using@dataclass, Pydantic for data handling, validation
Transitioning from the Trafaret library and raw Python data types to @dataclass and Pydantic for data handling and validation. This update strengthens type hints, improves validation, and preserves existing functionality. The goal is to enhance code readability, type safety, and IDE support, aligning with modern Python best practices.
The current application manages DB connections through app['root_context'] within the request object. Since existing APIs rely on this approach, modifying this initialization method would 1) require large-scale code modifications and 2) potentially cause unpredictable side effects in existing APIs.
Initially, we adopt a progressive approach to implementing layered architecture. As a first step, we initialize repositories using the DB object from root_context, then use these repositories to initialize services, and store both in the root_context for application-wide use. This strategy allows us to establish the basic structure of layered architecture while minimizing immediate changes to the existing codebase.
The plan is to gradually refactor the root_context implementation in subsequent phases, incrementally expanding the scope of modifications. This phased approach ensures we can maintain system stability while progressively moving towards a more modular and maintainable architecture.
HyeockJinKim
changed the title
Implement CRUD handlers for manager
Add Interface for vFolder CRUD handlers in Manager
Jan 15, 2025
HyeockJinKim
changed the title
Add Interface for vFolder CRUD handlers in Manager
Add a new handler with an empty interface to handle VFolder CRUD API in manager
Jan 15, 2025
HyeockJinKim
changed the title
Add a new handler with an empty interface to handle VFolder CRUD API in manager
Add the skeleton interface of VFolder CRUD APIs using the new layered architecture in Manager
Jan 15, 2025
Motivation
Required Features
/manger/api/vfolder.py
into Service and Repository layers for each interestImplementation Detail (interface)
Using
@dataclass
, Pydantic for data handling, validationTransitioning from the Trafaret library and raw Python data types to
@dataclass
and Pydantic for data handling and validation. This update strengthens type hints, improves validation, and preserves existing functionality. The goal is to enhance code readability, type safety, and IDE support, aligning with modern Python best practices.Separate legacy handlers into Handler, Service, Repository layers
Implementation
DI Strategy
The current application manages DB connections through
app['root_context']
within the request object. Since existing APIs rely on this approach, modifying this initialization method would 1) require large-scale code modifications and 2) potentially cause unpredictable side effects in existing APIs.Initially, we adopt a progressive approach to implementing layered architecture. As a first step, we initialize repositories using the DB object from
root_context
, then use these repositories to initialize services, and store both in theroot_context
for application-wide use. This strategy allows us to establish the basic structure of layered architecture while minimizing immediate changes to the existing codebase.The plan is to gradually refactor the
root_context
implementation in subsequent phases, incrementally expanding the scope of modifications. This phased approach ensures we can maintain system stability while progressively moving towards a more modular and maintainable architecture.Impact
Testing Scenarios
vfolder_service
,storagy_proxy_client
) to isolate handler testingThe text was updated successfully, but these errors were encountered: