Class UserDataDTOService
java.lang.Object
edu.ucsb.cs156.dining.services.UserDataDTOService
-
Constructor Summary
ConstructorsConstructorDescriptionUserDataDTOService(UserRepository userRepository, AdminRepository adminRepository, ModeratorRepository moderatorRepository, List<String> adminEmails) -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.data.domain.Page<UserDTO> getUserDataDTOs(org.springframework.data.domain.Pageable pageable) Returns one page of users, each with its admin and moderator flags.
-
Constructor Details
-
UserDataDTOService
public UserDataDTOService(UserRepository userRepository, AdminRepository adminRepository, ModeratorRepository moderatorRepository, @Value("#{'${app.admin.emails}'.split(',')}") List<String> adminEmails)
-
-
Method Details
-
getUserDataDTOs
public org.springframework.data.domain.Page<UserDTO> getUserDataDTOs(org.springframework.data.domain.Pageable pageable) Returns one page of users, each with its admin and moderator flags.A user is an admin if their email is in ADMIN_EMAILS or in the admins table, and a moderator if their email is in the moderators table (the same rules as GET /api/admin/users).
Pages are always sorted by user id (ascending), whatever sort the caller asks for, so a user stays in the same place on the admin users page when their roles change.
- Parameters:
pageable- which page to return and its size (any sort in it is ignored)- Returns:
- the requested page of users, sorted by id
-