Initial commit: NextGen PPR System

- FastAPI backend with JWT authentication
- MySQL database with full schema
- Docker Compose orchestration
- CSV data import for 43,208 airports and 519,999 aircraft
- Complete PPR management API
- Modernized replacement for PHP-based system
This commit is contained in:
James Pattinson
2025-10-21 17:33:19 +00:00
commit 8a94ce0f5b
33 changed files with 564782 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
from typing import Optional
from sqlalchemy.orm import Session
from app.models.ppr import User
from app.schemas.ppr import UserCreate
from app.core.security import get_password_hash, verify_password
class CRUDUser:
def get(self, db: Session, user_id: int) -> Optional[User]:
return db.query(User).filter(User.id == user_id).first()
def get_by_username(self, db: Session, username: str) -> Optional[User]:
return db.query(User).filter(User.username == username).first()
def create(self, db: Session, obj_in: UserCreate) -> User:
hashed_password = get_password_hash(obj_in.password)
db_obj = User(
username=obj_in.username,
password=hashed_password
)
db.add(db_obj)
db.commit()
db.refresh(db_obj)
return db_obj
def authenticate(self, db: Session, username: str, password: str) -> Optional[User]:
user = self.get_by_username(db, username=username)
if not user:
return None
if not verify_password(password, user.password):
return None
return user
def is_active(self, user: User) -> bool:
# For future use if we add user status
return True
user = CRUDUser()