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

Resources - PostgreSQL Database, Interface, and API Routes #131

Open
wants to merge 196 commits into
base: main
Choose a base branch
from

Conversation

Dozgulbas
Copy link
Collaborator

This PR introduces a new resources management system, integrated with a PostgreSQL database (running in a Docker container), along with interfaces, models, and API routes to manage various resource types such as Stack, Queue, Collection, Plate, and Pool. These features allow for efficient resource management and interaction both through a well-defined interface and an API, ensuring robust database operations and accessible endpoints.

Key Components:

1. PostgreSQL Database Docker Container:

  • A new PostgreSQL database container has been added to manage the persistence of resource-related data.

2. resource_types.py:

  • Defines the schema for various resources like Stack, Queue, Collection, Plate, Pool, and Asset.
  • Automatically creates the necessary tables in the PostgreSQL database using SQLAlchemy and SQLModel.
  • Manages relationships and constraints for efficient resource handling.

3. resources_interface.py:

  • Acts as the main interface for interacting with the PostgreSQL database.
  • Provides methods for initializing the database, adding, retrieving, updating, and deleting resources.
  • Specialized methods for pushing/popping assets from Stacks and Queues, managing pool quantities, and updating Plates.

4. resources_routes.py (API Routes):

  • A set of FastAPI routes has been added to expose resource-related operations via a REST API.
  • These routes allow clients to interact with the resource management system through HTTP endpoints, providing functionality for dashboard actions.

5. Database Operations and Actions:

  • Adding Resources: Resources can be added via the API or the interface, ensuring validation before insertion.
  • Retrieving Resources: Resources can be fetched using resource_id, resource_name, or owner_name.
  • Stack and Queue Operations: Assets can be pushed to and popped from Stacks and Queues via dedicated API endpoints.
  • Error Handling: Clear errors are raised for non-existent resources, duplicate entries, or capacity issues in queues/stacks.
  • Automatic Timestamping: Resources automatically track creation and update timestamps.

@Dozgulbas Dozgulbas requested a review from tginsbu1 October 3, 2024 01:27
@Dozgulbas Dozgulbas changed the title Resource - PostgreSQL Database, Interface, and API Routes Resources - PostgreSQL Database, Interface, and API Routes Oct 3, 2024
Base automatically changed from dev to main October 10, 2024 17:53
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