Class UserDataDTOService

java.lang.Object
edu.ucsb.cs156.dining.services.UserDataDTOService

@Service public class UserDataDTOService extends Object
Builds pages of UserDTOs (users plus their admin/moderator flags) for the admin users page.

Modeled on UserDataDTOService in proj-frontiers. The admin and moderator emails are loaded once per page instead of being looked up once per user.

  • Constructor Details

  • 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