Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update codebase structure to improve maintenance #175

Closed
edmondchuc opened this issue Nov 20, 2023 · 1 comment
Closed

Update codebase structure to improve maintenance #175

edmondchuc opened this issue Nov 20, 2023 · 1 comment

Comments

@edmondchuc
Copy link
Collaborator

The below text originally taken from comment in #168 (review).


I think the PR is fine for now as it addresses the immediate issues with the way we run tests. Nice work! 🎉 I can see that the tests run around 4 times faster, which is a nice bonus.

A follow-up to improve the structure of the codebase for long-term maintenance can look something like this:

/
├── repositories/
│   ├── __init__.py
│   ├── remote_sparql.py
│   ├── pyoxigraph.py
│   └── oxrdflib.py
├── services/
│   ├── __init__.py
│   ├── object.py
│   ├── listing.py
│   └── etc...
└── routers/
    ├── __init__.py
    ├── object.py
    ├── listing.py
    ├── sparql.py
    ├── vocprez.py
    ├── catprez.py
    └── spaceprez.py
  • Repositories are the interfaces to the data store.
  • Services are the business logic for each of facets of functionality within Prez. They only contain business logic and interact with the data store through a repository object.
  • Routers are the API endpoints of Prez. They are the entrypoints to each facet of business logic of Prez and only deal with the HTTP layer. The service and repo objects are injected via FastAPI's DI.

I think by having these three layers at a minimum will allow us all to conceptually understand Prez and its implementation details a bit clearer.

Anyway, I think this can probably be followed up in a separate PR as it's more maintenance-related. If you agree with the above's proposed structure, I can create an issue and reference this PR's comment.

@recalcitrantsupplant
Copy link
Collaborator

codebase is aligned to the above

@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in Prez Board Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

No branches or pull requests

2 participants