-
Notifications
You must be signed in to change notification settings - Fork 122
Flask API Completed State - do not merge #11
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
base: main
Are you sure you want to change the base?
Conversation
…on and Docker setup
…ent, add user and trip models, and implement database initialization script.
… generate default itinerary
Update container files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new Flask-based REST API for the Planventure application with full support for user authentication, trip management, and a development environment built on Docker and GitHub Codespaces. Key changes include:
- Implementation of authentication routes (registration and login) using JWT tokens.
- Creation of SQLAlchemy models for User and Trip along with middleware for token verification.
- Enhancements to configuration, documentation, and development container setup.
Reviewed Changes
Copilot reviewed 24 out of 28 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
planventure-api/routes/auth.py | Added authentication endpoints with proper error responses and JWT flows. |
planventure-api/models/user.py | Defined User model with password hashing and JWT token generation. |
planventure-api/models/trip.py | Added Trip model and established relationship with User. |
planventure-api/middleware/auth.py | Introduced middleware for verifying JWTs and checking user existence. |
planventure-api/app.py | Configured Flask app with CORS, JWT callbacks, and blueprint registration. |
Others (README, config, etc.) | Updated documentation and environment configuration files for the API. |
Files not reviewed (4)
- .devcontainer/Dockerfile: Language not supported
- .devcontainer/devcontainer.json: Language not supported
- planventure-api/.env.example: Language not supported
- planventure-api/requirements.txt: Language not supported
Comments suppressed due to low confidence (1)
planventure-api/models/user.py:31
- [nitpick] The identity is wrapped in a tuple unnecessarily; passing the string directly (as in create_access_token(identity=str(self.id))) may help avoid potential type mismatches downstream.
return create_access_token(identity=(str(self.id)))
def decorated(*args, **kwargs): | ||
try: | ||
verify_jwt_in_request() | ||
current_user_id = get_jwt_identity() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The auth middleware retrieves the user ID as a string (from create_access_token), but the User model's primary key is an integer. Consider converting current_user_id to an integer (e.g., int(get_jwt_identity())) to ensure proper query matching.
current_user_id = get_jwt_identity() | |
current_user_id = int(get_jwt_identity()) |
Copilot uses AI. Check for mistakes.
…reSQL; update README and add security guidelines
…anventure-api directory
renamed branch to
api-complete
This pull request introduces a new Flask-based REST API for the Planventure application, along with a complete development environment setup using Docker and GitHub Codespaces. Key changes include the creation of the API, its supporting infrastructure, and updates to documentation and configuration files.