Skip to content

Conversation

@anthonydmays
Copy link
Contributor

Signed-off-by: Anthony D. Mays [email protected]

Signed-off-by: Anthony D. Mays <[email protected]>
Copilot AI review requested due to automatic review settings October 8, 2025 20:04
Copy link
Contributor

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 adds lesson_25 homework implementation focusing on database integration with a library management system. The code transitions from JSON/CSV data loading to SQLite database operations using Spring Boot and JPA.

  • Comprehensive library management system with database integration
  • Spring Boot application with JPA entities and repositories
  • Command-line interface for library operations including search functionality

Reviewed Changes

Copilot reviewed 58 out of 60 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lesson_25/db/settings.gradle.kts Gradle settings configuration for the database module
lesson_25/db/gradlew.bat Windows Gradle wrapper script
lesson_25/db/gradlew Unix Gradle wrapper script
lesson_25/db/gradle/wrapper/gradle-wrapper.properties Gradle wrapper configuration
lesson_25/db/db_app/src/test/java/com/codedifferently/lesson28/* Unit tests for library components
lesson_25/db/db_app/src/main/resources/* Application configuration, data files, and SQL queries
lesson_25/db/db_app/src/main/java/com/codedifferently/lesson28/* Main application code including entities, repositories, and CLI
lesson_25/db/db_app/build.gradle.kts Build configuration with Spring Boot and database dependencies
lesson_25/createdb/createdb.py Python script for database creation from CSV files
lesson_25/README.md Updated documentation with homework requirements

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +7 to +15
media_items_df = pd.read_csv('/workspaces/code-society-25-2/lesson_12/io/io_app/src/main/resources/csv/media_items.csv')
guests_df = pd.read_csv('/workspaces/code-society-25-2/lesson_12/io/io_app/src/main/resources/csv/guests.csv')
checked_out_items_df = pd.read_csv('/workspaces/code-society-25-2/lesson_12/io/io_app/src/main/resources/csv/checked_out_items.csv')
checked_out_items_df['due_date'] = pd.to_datetime(checked_out_items_df['due_date']).values.astype(np.int64)

# Step 2: Create a connection to the SQLite database
# Note: This will create the database file if it doesn't exist already
os.makedirs('/workspaces/code-society-25-2/lesson_25/db/db_app/src/main/resources/sqlite/', exist_ok=True)
conn = sqlite3.connect('../db/db_app/src/main/resources/sqlite/data.db')
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coded absolute paths make the script non-portable. Consider using relative paths or environment variables to make the script work across different development environments.

Suggested change
media_items_df = pd.read_csv('/workspaces/code-society-25-2/lesson_12/io/io_app/src/main/resources/csv/media_items.csv')
guests_df = pd.read_csv('/workspaces/code-society-25-2/lesson_12/io/io_app/src/main/resources/csv/guests.csv')
checked_out_items_df = pd.read_csv('/workspaces/code-society-25-2/lesson_12/io/io_app/src/main/resources/csv/checked_out_items.csv')
checked_out_items_df['due_date'] = pd.to_datetime(checked_out_items_df['due_date']).values.astype(np.int64)
# Step 2: Create a connection to the SQLite database
# Note: This will create the database file if it doesn't exist already
os.makedirs('/workspaces/code-society-25-2/lesson_25/db/db_app/src/main/resources/sqlite/', exist_ok=True)
conn = sqlite3.connect('../db/db_app/src/main/resources/sqlite/data.db')
base_csv_dir = os.path.join(os.path.dirname(__file__), '../../12/io/io_app/src/main/resources/csv')
media_items_df = pd.read_csv(os.path.join(base_csv_dir, 'media_items.csv'))
guests_df = pd.read_csv(os.path.join(base_csv_dir, 'guests.csv'))
checked_out_items_df = pd.read_csv(os.path.join(base_csv_dir, 'checked_out_items.csv'))
checked_out_items_df['due_date'] = pd.to_datetime(checked_out_items_df['due_date']).values.astype(np.int64)
# Step 2: Create a connection to the SQLite database
# Note: This will create the database file if it doesn't exist already
db_dir = os.path.join(os.path.dirname(__file__), '../db/db_app/src/main/resources/sqlite')
os.makedirs(db_dir, exist_ok=True)
conn = sqlite3.connect(os.path.join(db_dir, 'data.db'))

Copilot uses AI. Check for mistakes.
Comment on lines +14 to +15
os.makedirs('/workspaces/code-society-25-2/lesson_25/db/db_app/src/main/resources/sqlite/', exist_ok=True)
conn = sqlite3.connect('../db/db_app/src/main/resources/sqlite/data.db')
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coded absolute path for the SQLite directory makes the script environment-specific. Use relative paths or path resolution based on the script's location.

Suggested change
os.makedirs('/workspaces/code-society-25-2/lesson_25/db/db_app/src/main/resources/sqlite/', exist_ok=True)
conn = sqlite3.connect('../db/db_app/src/main/resources/sqlite/data.db')
# Resolve the SQLite directory relative to this script's location
script_dir = os.path.dirname(os.path.abspath(__file__))
sqlite_dir = os.path.join(script_dir, '../db/db_app/src/main/resources/sqlite/')
os.makedirs(sqlite_dir, exist_ok=True)
db_path = os.path.join(sqlite_dir, 'data.db')
conn = sqlite3.connect(db_path)

Copilot uses AI. Check for mistakes.
@Entity
@Table(name = "checked_out_items")
public class CheckoutModel {
@Id public UUID itemId;
Copy link

Copilot AI Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using itemId as the primary key could cause issues if the same item is checked out multiple times by different users or at different times. Consider using a composite key or a separate auto-generated ID field.

Copilot uses AI. Check for mistakes.
@anthonydmays anthonydmays merged commit cea352a into main Oct 8, 2025
1 check passed
@anthonydmays anthonydmays deleted the feat/lesson_25 branch October 8, 2025 20:20
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