File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
src/main/java/com/alwinsimon/UserManagementJavaSpringBoot/Controller Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import com .alwinsimon .UserManagementJavaSpringBoot .Model .User ;
4
4
import com .alwinsimon .UserManagementJavaSpringBoot .Service .AdminService ;
5
- import com .alwinsimon .UserManagementJavaSpringBoot .Service .UserService ;
6
5
import lombok .RequiredArgsConstructor ;
7
6
import org .springframework .http .HttpStatus ;
8
7
import org .springframework .http .ResponseEntity ;
9
- import org .springframework .security .access .prepost .PreAuthorize ;
10
8
import org .springframework .web .bind .annotation .*;
11
9
12
10
import java .util .List ;
18
16
public class AdminController {
19
17
20
18
private final AdminService adminService ;
19
+
21
20
@ GetMapping ("/get-users" )
22
21
public ResponseEntity <List <User >> getAllUsers () {
23
22
@@ -28,11 +27,11 @@ public ResponseEntity<List<User>> getAllUsers() {
28
27
}
29
28
30
29
@ DeleteMapping ("/delete-user/{email}" )
31
- public ResponseEntity <String > deleteUser (@ PathVariable ("email" )String email ){
30
+ public ResponseEntity <String > deleteUser (@ PathVariable ("email" ) String email ) {
32
31
try {
33
32
adminService .deleteUserByEmail (email );
34
33
return ResponseEntity .ok ("User deleted." );
35
- }catch (Exception e ){
34
+ } catch (Exception e ) {
36
35
return ResponseEntity .status (HttpStatus .NOT_FOUND ).body ("User deletion Failed." );
37
36
}
38
37
}
You can’t perform that action at this time.
0 commit comments