Skip to content

Conversation

@JosePizarro3
Copy link
Member

@JosePizarro3 JosePizarro3 commented Dec 10, 2025

@KoeppelSoftwareEngineer please, check the "Files changed" menu above, and see what I did. I am creating now a summary with Copilot, but essentially:

  1. I moved the routes to a separate folder /api/v1. I created specifically the router for different methods (which in our case, will be for manipulating schemas)
  2. I added a settings.py file to control better our previosly hardcoded parameters (e.g., the MongoDB localhost port, or the one for CORS)
  3. Polished main.py and database.py
  4. Moved the model.py to models/schema_definitions.py
  5. Commented out all API functions and left only the one I tested and that worked (we can check this in a next issue/pull request)

Summary by GitHub Copilot

This pull request refactors the backend architecture to use FastAPI with async MongoDB access, introduces a new modular API structure, and updates the schema model and configuration management. The legacy synchronous backend code is removed in favor of a new jsoned package, which implements an async API and database layer, centralized settings, and improved project organization.

Backend architecture migration:

  • Removes legacy backend files (backend/main.py, backend/database.py, backend/datamodel.py) and replaces them with an async FastAPI app in jsoned/main.py, using Motor for MongoDB access and a lifespan event for startup/shutdown logic. [1] [2] [3] [4] [5]

API modularization and routing:

  • Introduces a modular API structure under jsoned/api/v1, including a main router (api.py), a schemas endpoint (endpoints/schemas.py), and an API router initializer (__init__.py). The schemas endpoint provides an async route for listing all schemas. [1] [2] [3]

Database and model updates:

  • Refactors the schema model to use Pydantic with a UUID id, a title field, and updated typing in jsoned/models/schema_definition.py. Database access is now async, and a unique index on the title field is created at startup. [1] [2]

Centralized configuration:

  • Adds a settings module (jsoned/settings.py) using pydantic-settings for configuration management (project name, API prefix, CORS origins, MongoDB URI).

Project structure and dependency updates:

  • Updates dependencies in pyproject.toml to use inboard[fastapi], motor, and pydantic-settings, changes code paths from backend to jsoned, and moves version file output accordingly. [1] [2] [3]

Other cleanup:

  • Removes the proprietary datamodel notice from NOTICE as those files are no longer present.

Created api/ folder and _v1 with routes

Clean up FastAPI app init

Modified database init with motor_async

Created settings.py

Added missing dependencies

Deleted NOTICE
Clean up SchemaDefinition

Added condition for uniqueness of title in schemas_collection
@JosePizarro3 JosePizarro3 self-assigned this Dec 10, 2025
@coveralls
Copy link

coveralls commented Dec 10, 2025

Pull Request Test Coverage Report for Build 20129877451

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 0.0%

Totals Coverage Status
Change from base Build 20060438219: 0.0%
Covered Lines: 0
Relevant Lines: 0

💛 - Coveralls

Added connect_to_mongo and close_mongo to database.py

Added MONGO_URI to settings
@JosePizarro3
Copy link
Member Author

I will work still on this. I will now implement the hashlib approach for id

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants