-
Notifications
You must be signed in to change notification settings - Fork 29
feat: adds lesson_25 homework #777
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
Conversation
Signed-off-by: Anthony D. Mays <[email protected]>
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 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.
| 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') |
Copilot
AI
Oct 8, 2025
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.
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.
| 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')) |
| 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') |
Copilot
AI
Oct 8, 2025
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.
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.
| 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) |
| @Entity | ||
| @Table(name = "checked_out_items") | ||
| public class CheckoutModel { | ||
| @Id public UUID itemId; |
Copilot
AI
Oct 8, 2025
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.
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.
Signed-off-by: Anthony D. Mays <[email protected]>
Signed-off-by: Anthony D. Mays <[email protected]>
Signed-off-by: Anthony D. Mays <[email protected]>
Signed-off-by: Anthony D. Mays [email protected]