Skip to content

refactor: move logic out of API endpoint handlers #223

@jennifer-bowser

Description

@jennifer-bowser

Feature description

We have a lot of logic living directly in our endpoint handlers in main.py. @jsstevenson brought up the excellent point that this paradigm is something we should move away from. There are several reasons for this:

  1. It will help future-proof AnyVar:
    • We currently can't access AnyVar functionality through any means other than a REST API. If/when we want to allow access to AnyVar in other ways (e.g., through a local Python installation, etc.), we would need to do this refactor first
  2. It makes our test logic cleaner:
    • Separating out our endpoint handlers and our core logic allows us to test each separately, which is what we should be doing anyways to align with best practices.

Use case

We want AnyVar to be a maintainable, bug-free system that can easily grow to fit our needs now and in the future. This refactor will help us in that goal.

Acceptance Criteria

  • Endpoint handlers contain minimal logic. All core functionalities should be abstracted out into their own functions
  • Tests are updated/created for both the endpoint handlers and the abstracted functionality as needed

Proposed solution

No response

Alternatives considered

No response

Implementation details

No response

Potential Impact

No response

Additional context

No response

Contribution

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions