Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
uphrh-smf-user
Commits
1b108540
Commit
1b108540
authored
2 years ago
by
sarojsingh2021
Browse files
Options
Download
Patches
Plain Diff
fix user-delete
parent
f178087f
delete-user
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/main/java/com/tarento/retail/controller/UserController.java
+4
-7
...in/java/com/tarento/retail/controller/UserController.java
src/main/java/com/tarento/retail/service/impl/UserServiceImpl.java
+2
-1
...java/com/tarento/retail/service/impl/UserServiceImpl.java
src/main/java/com/tarento/retail/util/Sql.java
+1
-1
src/main/java/com/tarento/retail/util/Sql.java
with
7 additions
and
9 deletions
+7
-9
src/main/java/com/tarento/retail/controller/UserController.java
+
4
−
7
View file @
1b108540
...
...
@@ -494,7 +494,7 @@ public class UserController {
return
ResponseGenerator
.
failureResponse
(
"Invalid Token"
);
}
// DELETE user
//
SOFT
DELETE user
@RequestMapping
(
value
=
PathRoutes
.
UserRoutes
.
ADMIN_DELETE_USER
,
method
=
RequestMethod
.
POST
)
public
Object
softDeleteUser
(
@RequestBody
UserDto
userDto
,
@RequestHeader
(
value
=
Constants
.
AUTH_HEADER
)
String
authToken
,
BindingResult
result
)
...
...
@@ -502,13 +502,10 @@ public class UserController {
if
(
result
.
hasErrors
())
{
return
ResponseGenerator
.
failureResponse
(
HttpStatus
.
UNPROCESSABLE_ENTITY
.
toString
());
}
Boolean
userTokenAvailable
=
userService
.
findUserByToken
(
authToken
);
String
username
=
""
;
if
(
userTokenAvailable
)
{
username
=
jwtTokenUtil
.
getUsernameFromToken
(
authToken
);
User
user
=
userService
.
findOne
(
username
);
return
ResponseGenerator
.
successResponse
(
userService
.
softDeleteUser
(
userDto
));
if
(
userService
.
softDeleteUser
(
userDto
))
{
return
ResponseGenerator
.
successResponse
(
true
);
}
return
ResponseGenerator
.
failureResponse
(
"Invalid Token"
);
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/tarento/retail/service/impl/UserServiceImpl.java
+
2
−
1
View file @
1b108540
...
...
@@ -568,7 +568,7 @@ public class UserServiceImpl implements UserDetailsService, UserService {
@Override
public
Boolean
validateUserOTP
(
String
username
,
String
otp
)
{
try
{
LoginAuthentication
loginAuth
=
Cache
.
getUserAuthData
(
username
);
if
(
loginAuth
!=
null
&&
loginAuth
.
getOtpExpiryDate
()
>
DateUtil
.
getCurrentTimestamp
()
...
...
@@ -579,6 +579,7 @@ public class UserServiceImpl implements UserDetailsService, UserService {
LOGGER
.
error
(
String
.
format
(
Constants
.
EXCEPTION_METHOD
,
"validateUserOTP"
,
e
.
getMessage
()));
}
return
Boolean
.
FALSE
;
}
@Override
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/tarento/retail/util/Sql.java
+
1
−
1
View file @
1b108540
...
...
@@ -158,7 +158,7 @@ public interface Sql {
final
String
FETCH_AUTH_TOKEN_REF
=
"SELECT id FROM user_authentication WHERE auth_token = ? "
;
final
String
REMOVE_USER_DEVICE_TOKEN
=
"DELETE from user_device WHERE user_auth_id IN (SELECT id FROM user_authentication WHERE auth_token =?) "
;
final
String
DELETE_USER
=
"DELETE from user WHERE id=?"
;
final
String
SOFT_DELETE_USER
=
"UPDATE user SET deleted=1 WHERE id= ?"
;
final
String
SOFT_DELETE_USER
=
"UPDATE user SET
is_
deleted=1
, is_active = 0
WHERE id= ?"
;
final
String
DELETE_USER_ROLE
=
"DELETE from user_role where user_id=?"
;
final
String
DELETE_COUNTRY_USER
=
"DELETE from country_user where user_id=?"
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets