@@ -58,6 +58,7 @@ public UserController(UserService userService, PasswordEncoder passwordEncoder,
58
58
59
59
60
60
@ PostMapping ("/signup" )
61
+ @ Operation (summary = "Create new client-user" )
61
62
public ResponseEntity <?> signup (@ RequestBody AppClientSignUpDto user ){
62
63
System .out .println (user );
63
64
@@ -71,6 +72,7 @@ public ResponseEntity<?> signup(@RequestBody AppClientSignUpDto user){
71
72
72
73
73
74
@ PostMapping ("/register" )
75
+ @ Operation (summary = "Create new business-user" )
74
76
public ResponseEntity <?> registerBusiness (@ RequestBody BusinessRegisterDto business ){
75
77
76
78
if (this .userService .businessExists (business .getBusinessName () ) || this .userService .userExists (business .getUsername (), business .getEmail ())){
@@ -86,20 +88,20 @@ public ResponseEntity<?> registerBusiness(@RequestBody BusinessRegisterDto busin
86
88
87
89
88
90
@ GetMapping ("/client" )
89
- @ Operation (summary = "My endpoint " , security = @ SecurityRequirement (name = "bearerAuth" ))
91
+ @ Operation (summary = "show client-user information " , security = @ SecurityRequirement (name = "bearerAuth" ))
90
92
public AppClient showUserDetails (@ RequestParam String username ) {
91
93
return this .userService .findAppClientByUsername (username );
92
94
}
93
95
94
96
95
97
@ GetMapping ("/business" )
96
- @ Operation (summary = "My endpoint " , security = @ SecurityRequirement (name = "bearerAuth" ))
98
+ @ Operation (summary = "Show business-user information " , security = @ SecurityRequirement (name = "bearerAuth" ))
97
99
public BusinessOwner showBusinessDetails (@ RequestParam String username ) {
98
100
return this .userService .findBusinessByUsername (username );
99
101
}
100
102
101
103
@ PutMapping ("/user" )
102
- @ Operation (summary = "My endpoint " , security = @ SecurityRequirement (name = "bearerAuth" ))
104
+ @ Operation (summary = "Update client-user information (use existing user id) " , security = @ SecurityRequirement (name = "bearerAuth" ))
103
105
public ResponseEntity <?> updateUser (@ RequestBody UpdateAppClientDto user ) {
104
106
105
107
AppClient client = this .userService .findAppClientById (user .getId ());
@@ -113,7 +115,7 @@ public ResponseEntity<?> updateUser(@RequestBody UpdateAppClientDto user) {
113
115
114
116
}
115
117
@ PostMapping ("/notification" )
116
- @ Operation (summary = "My endpoint " , security = @ SecurityRequirement (name = "bearerAuth" ))
118
+ @ Operation (summary = "Send notification with password reset link " , security = @ SecurityRequirement (name = "bearerAuth" ))
117
119
public ResponseEntity <?> sendNotification (@ RequestParam ("email" ) String e ) {
118
120
UserEntity userByEmail = this .userService .findUserByEmail (e );
119
121
@@ -125,8 +127,8 @@ public ResponseEntity<?> sendNotification(@RequestParam("email") String e) {
125
127
}
126
128
return new ResponseEntity <>(userByEmail , HttpStatus .OK );
127
129
}
128
- @ PostMapping ("/password" )
129
- @ Operation (summary = "My endpoint " , security = @ SecurityRequirement (name = "bearerAuth" ))
130
+ @ PutMapping ("/password" )
131
+ @ Operation (summary = "Update password, (use existing user id) " , security = @ SecurityRequirement (name = "bearerAuth" ))
130
132
public ResponseEntity <?> setUpNewPassword (@ RequestParam Long id , String password ) {
131
133
UserEntity userById = this .userService .findUserById (id );
132
134
userById .setPassword (this .passwordEncoder .encode (password ));
@@ -135,7 +137,7 @@ public ResponseEntity<?> setUpNewPassword(@RequestParam Long id, String passwor
135
137
}
136
138
137
139
@ PutMapping ("/business" )
138
- @ Operation (summary = "My endpoint " , security = @ SecurityRequirement (name = "bearerAuth" ))
140
+ @ Operation (summary = "Update business-user, (use existing user id) " , security = @ SecurityRequirement (name = "bearerAuth" ))
139
141
public ResponseEntity <?> updateBusiness (@ RequestBody UpdateBusinessDto business ) {
140
142
141
143
BusinessOwner businessOwner = this .userService .findBusinessOwnerById (business .getId ());
@@ -151,7 +153,7 @@ public ResponseEntity<?> updateBusiness(@RequestBody UpdateBusinessDto business
151
153
152
154
}
153
155
@ DeleteMapping ("/user/{id}" )
154
- @ Operation (summary = "My endpoint " , security = @ SecurityRequirement (name = "bearerAuth" ))
156
+ @ Operation (summary = "Delete user " , security = @ SecurityRequirement (name = "bearerAuth" ))
155
157
public ResponseEntity <Long > deleteUser (@ PathVariable Long id ){
156
158
157
159
boolean isRemoved = this .userService .deleteUser (id );
@@ -163,6 +165,7 @@ public ResponseEntity<Long> deleteUser(@PathVariable Long id){
163
165
}
164
166
165
167
@ PostMapping ("/authenticate" )
168
+ @ Operation (summary = "Authenticate user and get JWT Token" )
166
169
public JwtResponse authenticate (@ RequestBody JwtRequest jwtRequest ) throws Exception {
167
170
168
171
try {
@@ -188,7 +191,7 @@ public JwtResponse authenticate(@RequestBody JwtRequest jwtRequest) throws Excep
188
191
189
192
@ PostMapping ("/login" )
190
193
@ CrossOrigin (origins = "http://localhost:4200" )
191
- @ Operation (summary = "My endpoint " , security = @ SecurityRequirement (name = "bearerAuth" ))
194
+ @ Operation (summary = "Login based on user role after authentication " , security = @ SecurityRequirement (name = "bearerAuth" ))
192
195
public String logInUser (@ RequestParam String username ){
193
196
UserEntity userByUsername = this .userService .findUserByUsername (username );
194
197
if (userByUsername .getRoles ().stream ()
0 commit comments