Skip to content

Refactor Duplicate Code After Gemeni PR #8

@abhishek-ch

Description

@abhishek-ch

Issue Summary

While implementing the new PR for Gemeni, I discovered multiple code duplications that need refactoring to improve maintainability. These duplications became apparent when adding new Services.

Areas Requiring Refactoring

  1. Environment and Configuration Files

    • Consolidate to one general workflow per service in .env, Dockerfile, and docker-compose
  2. API Route Handlers

    • Remove multiple references to /webhook/dataengineering-common in src/app/api/n8n/health/[type]/route.ts
    • All references should point to a single n8n service for the first service
  3. Availability Checking Functions

    • The check***Availability functions follow nearly identical patterns and should be refactored into a common implementation
  4. Additional Route Handler Duplications

    • Apply same refactoring to src/app/api/n8n/workflows/[type]/route.ts
    • Apply same refactoring to src/services/n8nService.ts
  5. Connection Handling

    • In src/components/ConnectionSelector.tsx, the hasKey function can be standardized across all services
    • In src/services/connectionValidator.ts, the validate function can be unified with parameters for API URL or using a switch statement

Next Steps

Consolidate duplicate code into shared utility functions and standardize service handling approaches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions