Implement CRUD API for server management with FastAPI and PostgreSQLa… #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements the complete server inventory challenge: a FastAPI CRUD API backed by PostgreSQL using raw SQL, a Typer CLI for interacting with the API, a pytest suite, and a Docker Compose stack. It also includes clear run instructions and API/CLI specs in API.md.
What’s included
FastAPI CRUD endpoints for servers with validation (unique hostname, IP format, state enum).
PostgreSQL schema and initialization via 001_init.sql.
Raw SQL data access via psycopg and connection pooling.
Typer CLI with readable help and table output.
Pytest suite covering create/read/update/delete, validation, uniqueness, and list filtering.
Docker Compose stack for API + DB and a Dockerfile for the API service.
Updated API.md with run steps, endpoint spec, and CLI usage.
Validation
pytest (5 passing)
API health check via /health
CLI create/list/get/update/delete verified
Notes
CLI help output stabilized for Click/Typer compatibility.
I've tried to keep it simple and built for purpose.