Class AdminController

java.lang.Object
callofproject.dev.authentication.controller.AdminController

@RestController @RequestMapping("api/auth/admin") public class AdminController extends Object
Authentication Controller Copyleft (C), 2023, Cal-of-Project-Teams Developers. All Rights free.
  • Constructor Details

    • AdminController

      public AdminController(AdminService adminService)
      Constructor for the AdminController class. It is used to inject dependencies into the controller.
      Parameters:
      adminService - The AdminService object to be injected.
  • Method Details

    • authenticate

      @PostMapping("/login") public org.springframework.http.ResponseEntity<Object> authenticate(@RequestBody AuthenticationRequest request)
      Login operation for admins.
      Parameters:
      request - represent the login information.
      Returns:
      if success returns AuthenticationResponse that include token and status else return ErrorMessage.
    • findAllUserByPage

      @GetMapping("find/all/page") public org.springframework.http.ResponseEntity<Object> findAllUserByPage(@RequestParam("p") int page)
      Find all users page by page
      Parameters:
      page - is page
      Returns:
      UserShowingAdminDTO
    • findUsersByUsernameContainsIgnoreCase

      @GetMapping("find/all/contains/page") public org.springframework.http.ResponseEntity<Object> findUsersByUsernameContainsIgnoreCase(@RequestParam("p") int page, String word)
      Find all users with given parameters are word and page
      Parameters:
      page - is page
      word - contains word
      Returns:
      Users Showing Admin DTO
    • findUsersByUsernameNotContainsIgnoreCase

      @GetMapping("find/all/ignore/page") public org.springframework.http.ResponseEntity<Object> findUsersByUsernameNotContainsIgnoreCase(@RequestParam("p") int page, String word)
      Find all users with given parameters are word and page
      Parameters:
      page - is page
      word - not contains word
      Returns:
      Users Showing Admin DTO
    • removeUserByUsername

      @DeleteMapping("remove/user") public org.springframework.http.ResponseEntity<Object> removeUserByUsername(@RequestParam("uname") String username)
      remove user with given username parameter
      Parameters:
      username - represent the user
      Returns:
      success or not
    • updateUserByUsername

      @PutMapping("update/user") public org.springframework.http.ResponseEntity<Object> updateUserByUsername(@RequestBody UserUpdateDTOAdmin userUpdateDTO)
      Update user with given information.
      Parameters:
      userUpdateDTO - represent the user information.
      Returns:
      the UserShowingAdminDTO.
    • findAllUserCount

      @GetMapping("find/user/all/count") public org.springframework.http.ResponseEntity<Object> findAllUserCount()
      Find Total User Count.
      Returns:
      the total user count
    • findNewUserCount

      @GetMapping("find/user/all/new") public org.springframework.http.ResponseEntity<Object> findNewUserCount(@RequestParam("n") int day)
      Find new user last n day.
      Parameters:
      day - represent the day
      Returns:
      the new user count