Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
01cd71a
updating main
bscott519 Aug 20, 2025
c4f01ed
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Aug 20, 2025
07cd146
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Aug 20, 2025
0f069d0
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Aug 24, 2025
679067f
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Aug 25, 2025
064560c
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Aug 27, 2025
acb9d5a
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Aug 27, 2025
0a5c684
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Aug 28, 2025
a856d55
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Sep 1, 2025
4427712
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Sep 4, 2025
add9ed5
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Sep 4, 2025
a758076
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Sep 5, 2025
603074a
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Sep 8, 2025
56c45b2
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Sep 9, 2025
6a1d48d
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Sep 11, 2025
61d6181
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Sep 14, 2025
b93d894
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Sep 23, 2025
a8bf019
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Sep 25, 2025
a5951ee
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Sep 26, 2025
8554585
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Sep 30, 2025
78c872b
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Oct 1, 2025
5e81c04
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Oct 2, 2025
a58c860
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Oct 3, 2025
86bbe89
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Oct 6, 2025
b58053e
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Oct 6, 2025
03a070c
Merge branch 'main' of https://github.com/bscott519/code-society-25-2
bscott519 Oct 9, 2025
be72436
deleted extra files on my main that shouldnt be there
bscott519 Oct 9, 2025
3ff9512
completed SQL queries
bscott519 Oct 10, 2025
10fd28c
Delete lesson_04/benjaminscott/bscottREADME.md
bscott519 Oct 10, 2025
dead470
pushing current progress on assignment
bscott519 Oct 10, 2025
5c28647
Merge branch 'feat/lesson25' of https://github.com/bscott519/code-soc…
bscott519 Oct 10, 2025
92a392d
app builds successfully
bscott519 Oct 13, 2025
8d680a5
added sample data and made sure the build runs correctly
bscott519 Oct 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.codedifferently.lesson25.models.LibraryDataModel;
import com.codedifferently.lesson25.repository.LibraryGuestRepository;
import com.codedifferently.lesson25.repository.LibraryUserRepository;
import com.codedifferently.lesson25.repository.MediaItemRepository;
import java.io.IOException;
import org.springframework.beans.factory.annotation.Autowired;
Expand All @@ -13,13 +14,15 @@ public final class LibraryDbDataLoader implements LibraryDataLoader {

@Autowired private MediaItemRepository mediaItemsRepository;
@Autowired private LibraryGuestRepository libraryGuestRepository;
@Autowired private LibraryUserRepository libraryUserRepository;

@Override
public LibraryDataModel loadData() throws IOException {
var model = new LibraryDataModel();

model.mediaItems = mediaItemsRepository.findAll();
model.guests = libraryGuestRepository.findAll();
model.users = libraryUserRepository.findAll();

return model;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class LibraryDataModel {

public List<MediaItemModel> mediaItems;
public List<LibraryGuestModel> guests;
public List<LibraryUserModel> users;

public List<MediaItem> getMediaItems() {
List<MediaItem> results = new ArrayList<>();
Expand Down Expand Up @@ -59,4 +60,8 @@ public Map<String, List<CheckoutModel>> getCheckoutsByEmail() {
}
return results;
}

public List<LibraryUserModel> getUsers() {
return users;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.codedifferently.lesson25.models;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;

@Entity
@Table(name = "library_users")
public class LibraryUserModel {
@Id public String id;
public String email;
public String firstName;
public String lastName;
public String password;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.codedifferently.lesson25.repository;

import com.codedifferently.lesson25.models.LibraryUserModel;
import java.util.List;
import org.springframework.data.repository.CrudRepository;

public interface LibraryUserRepository extends CrudRepository<LibraryUserModel, String> {
@Override
List<LibraryUserModel> findAll();
}
11 changes: 11 additions & 0 deletions lesson_25/db/db_app/src/main/resources/queries/benjaminscott.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
SELECT type, COUNT(*)
FROM media_items
GROUP BY type;

SELECT SUM(pages)
FROM media_items
JOIN checked_out_items ON media_items.id = checked_out_items.itemId;

SELECT guests.name, guests.email, guests.type, checked_out_items.itemId, checked_out_items.dueDate
FROM guests
LEFT JOIN checked_out_items ON guests.email = checked_out_items.email;
Binary file modified lesson_25/db/db_app/src/main/resources/sqlite/data.db
Binary file not shown.