Class AdminController
java.lang.Object
callofproject.dev.authentication.controller.AdminController
Authentication Controller
Copyleft (C), 2023, Cal-of-Project-Teams Developers.
All Rights free.
-
Constructor Summary
ConstructorsConstructorDescriptionAdminController(AdminService adminService) Constructor for the AdminController class. -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.http.ResponseEntity<Object>authenticate(AuthenticationRequest request) Login operation for admins.org.springframework.http.ResponseEntity<Object>findAllUserByPage(int page) Find all users page by pageorg.springframework.http.ResponseEntity<Object>Find Total User Count.org.springframework.http.ResponseEntity<Object>findNewUserCount(int day) Find new user last n day.org.springframework.http.ResponseEntity<Object>findUsersByUsernameContainsIgnoreCase(int page, String word) Find all users with given parameters are word and pageorg.springframework.http.ResponseEntity<Object>findUsersByUsernameNotContainsIgnoreCase(int page, String word) Find all users with given parameters are word and pageorg.springframework.http.ResponseEntity<Object>removeUserByUsername(String username) remove user with given username parameterorg.springframework.http.ResponseEntity<Object>updateUserByUsername(UserUpdateDTOAdmin userUpdateDTO) Update user with given information.
-
Constructor Details
-
AdminController
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 pageword- 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 pageword- 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
-