Skip to content

Winnyyyy12/Python_PostgreSQL-FastAPI_Studies

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Employee Project Portfolio Management API

Overview

This project is a backend API for tracking employees and their assigned project hours using FastAPI and PostgreSQL. It allows you to manage employees, projects, assignments, and quickly identify which employees are available for new projects. The API demonstrates practical CRUD operations, relational schema design, and can be expanded to support advanced features like authentication and reporting.


Features

  • Employee, Project, and Assignment CRUD endpoints
  • Track total project hours per employee
  • Query employees who are currently free (unassigned) for new projects
  • Relational database design linking employees, projects, and assignments
  • Automatic API documentation via Swagger UI (/docs)
  • Pydantic validation for request/response schemas

Tech Stack

  • FastAPI
  • SQLAlchemy ORM
  • Pydantic
  • PostgreSQL Database
  • Uvicorn ASGI Server

Getting Started

1. Clone the Repository

git clone https://github.com/yourusername/employee-portfolio-api.git cd employee-portfolio-api

text

2. Set Up PostgreSQL

  • Install PostgreSQL and start the service.
  • Create the database and user: CREATE DATABASE employee_portfolio; CREATE USER your_user WITH PASSWORD 'your_password'; GRANT ALL PRIVILEGES ON DATABASE employee_portfolio TO your_user;

text

3. Configure Database URL

  • Edit db.py: DATABASE_URL = "postgresql://your_user:your_password@localhost:5432/employee_portfolio"

text

4. Install Dependencies

pip install fastapi sqlalchemy psycopg2 pydantic uvicorn

text

5. Run the API Server

uvicorn main:app --reload

text

6. Access Interactive API Docs


Project Structure

project_dir/ ├─ db.py ├─ models.py ├─ schemas.py └─ main.py

text


Example Endpoints

  • POST /employees/ — Create a new employee
  • POST /projects/ — Create a new project
  • POST /assignments/ — Assign employee to a project
  • GET /employees/free/ — List employees who are free for new projects

Future Enhancements

  • Add OAuth2/JWT authentication for secure access
  • Implement role-based admin endpoints
  • Add reporting endpoints for total project hours
  • Enable file/image upload support (e.g., for project documentation)
  • Expand unit and integration testing

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages