Skip to content

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

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

Conversation

LadyKerr
Copy link
Collaborator

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.

LadyKerr and others added 19 commits February 6, 2025 15:19
…ent, add user and trip models, and implement database initialization script.
@Copilot Copilot AI review requested due to automatic review settings April 21, 2025 20:34
Copy link

@Copilot Copilot AI left a 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()
Copy link
Preview

Copilot AI Apr 21, 2025

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.

Suggested change
current_user_id = get_jwt_identity()
current_user_id = int(get_jwt_identity())

Copilot uses AI. Check for mistakes.

@LadyKerr LadyKerr changed the title Api complete Full Flask API Build - do not merge Apr 21, 2025
@LadyKerr LadyKerr changed the title Full Flask API Build - do not merge Flask API Completed State - do not merge Apr 21, 2025
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.

2 participants