Skip to content

Refactor Flow Management to be User-Scoped and Database-Backed #71

@Edwardvaneechoud

Description

@Edwardvaneechoud

The current FlowfileHandler is a global, in-memory object, meaning all users share the same flows and all data is lost on restart. This issue tracks the work to replace it with a robust, database-driven system.

  • Create DB Schema: Define new SQLAlchemy models for Flow and Node. Each model must contain a user_id foreign key that links to the User model, ensuring a clear ownership record for every piece of data.
  • Implement a Service Layer: Develop a new UserFlowService class. This class will be instantiated for each API request and will contain the authenticated user's ID. All methods within this service (get_flow, create_node, etc.) must use the user_id to scope database queries, guaranteeing that a user can only access their own data.
  • Refactor API Endpoints: Update all API endpoints that currently depend on the global flow_file_handler. Use FastAPI's dependency injection to provide the UserFlowService to these endpoints. This ensures that the application logic is automatically operating within the context of the correct user.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions