Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caritas 243 remove legacy code #15

Merged
merged 66 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from 55 commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
3e42859
CARITAS-243 - Adapt messageservice.yaml to remove feedback and forwar…
Leandro13Silva13 Jul 25, 2024
3dadd7d
CARITAS-243 - Remove sendNewFeedbackMessageNotification api code
Leandro13Silva13 Jul 26, 2024
e88fabf
CARITAS-243 - Fix sendLiveEvent api as a result of the removal of the…
Leandro13Silva13 Jul 26, 2024
f336c57
CARITAS-243 - Remove sendNewFeedbackMessageNotification api tests and…
Leandro13Silva13 Jul 26, 2024
1b5e3b1
CARITAS-243 - Remove NEW_FEEDBACK_MESSAGE_FROM_ADVICE_SEEKER
Leandro13Silva13 Jul 26, 2024
40a42ae
CARITAS-243 - Fix tests as a result of the removal of NEW_FEEDBACK_ME…
Leandro13Silva13 Jul 26, 2024
7bf3148
CARITAS-243 - Fix tests as a result of the removal of NEW_FEEDBACK_ME…
Leandro13Silva13 Jul 26, 2024
f5a4763
CARITAS-243 - Fix tests as a result of the removal of NEW_FEEDBACK_ME…
Leandro13Silva13 Jul 26, 2024
3759edd
CARITAS-243 - Remove feeback related DTOs
Leandro13Silva13 Jul 26, 2024
9d7d21c
CARITAS-243 - Fix tests related to the removal of feedback related DTOs
Leandro13Silva13 Jul 26, 2024
cb1ef6d
Merge branch 'develop' into CARITAS-243-remove-legacy-code
Leandro13Silva13 Jul 29, 2024
b970061
CARITAS-243 - Merge dev to this branch
Leandro13Silva13 Jul 29, 2024
6b65e3f
CARITAS-243 - Remove canViewFeedbackSessions method
Leandro13Silva13 Jul 29, 2024
aed17fb
CARITAS-243 - Remove VIEW_ALL_FEEDBACK_SESSIONS authority
Leandro13Silva13 Jul 29, 2024
10e4a5b
CARITAS-243 - Remove VIEW_ALL_FEEDBACK_SESSIONS authority and part of…
Leandro13Silva13 Jul 29, 2024
11de951
CARITAS-243 - Remove feedback group id
Leandro13Silva13 Jul 31, 2024
d296e97
CARITAS-243 - Remove FEEDBACK_GROUP_SUFFIX from RocketChatRoomNameGen…
Leandro13Silva13 Jul 31, 2024
d0c5383
CARITAS-243 - Remove RC_FEEDBACK_GROUP_ID
Leandro13Silva13 Jul 31, 2024
d579fa5
CARITAS-243 - fix tests
Leandro13Silva13 Jul 31, 2024
22f22ef
CARITAS-243 - run spotless:apply
Leandro13Silva13 Jul 31, 2024
1dab09f
CARITAS-243 - tests fixing
Leandro13Silva13 Aug 1, 2024
3ceb330
CARITAS-243 - tests fixing
Leandro13Silva13 Aug 1, 2024
0e79765
CARITAS-243 - tests fixing
Leandro13Silva13 Aug 1, 2024
799313e
CARITAS-243 - tests fixing
Leandro13Silva13 Aug 1, 2024
aac65bc
CARITAS-243 - tests fixing
Leandro13Silva13 Aug 1, 2024
62bce63
CARITAS-243 - tests fixing
Leandro13Silva13 Aug 2, 2024
2746bf5
CARITAS-243 - tests fixing
Leandro13Silva13 Aug 2, 2024
ceb1efe
CARITAS-243 - tests fixing
Leandro13Silva13 Aug 2, 2024
84cc67f
CARITAS-243 - tests fixing
Leandro13Silva13 Aug 2, 2024
514dd9a
CARITAS-243 - tests fixing
Leandro13Silva13 Aug 2, 2024
5478732
CARITAS-243 - tests fixing
Leandro13Silva13 Aug 2, 2024
9c36346
CARITAS-243 - tests fixing and remove NewFeedbackEmailSupplier.java
Leandro13Silva13 Aug 2, 2024
dc134ea
CARITAS-243 - tests fixing and remove NewFeedbackEmailSupplier.java
Leandro13Silva13 Aug 5, 2024
a9b8660
CARITAS-243 - tests fixing and remove NewFeedbackEmailSupplier.java
Leandro13Silva13 Aug 5, 2024
f1b32ce
CARITAS-243 - Remove FEEDBACK from SessionFilter
Leandro13Silva13 Aug 5, 2024
e2583bd
CARITAS-243 - Remove TEMPLATE_NEW_FEEDBACK_MESSAGE_NOTIFICATION from …
Leandro13Silva13 Aug 5, 2024
b1c2d2f
CARITAS-243 - Remove feedback ids from comments
Leandro13Silva13 Aug 5, 2024
e2080b9
CARITAS-243 - Remove unused UpdateFeedbackGroupIdException
Leandro13Silva13 Aug 5, 2024
ff03c9f
CARITAS-243 - Remove feedback from the comments
Leandro13Silva13 Aug 5, 2024
d8ae9ea
CARITAS-243 - Remove initializeFeedbackChat and isPeerChat from Exten…
Leandro13Silva13 Aug 5, 2024
64c0096
CARITAS-243 - Remove feedback comments
Leandro13Silva13 Aug 5, 2024
eb93049
CARITAS-243 - Remove feedback comments
Leandro13Silva13 Aug 6, 2024
bfe7720
CARITAS-243 - Remove USE_FEEDBACK Authority
Leandro13Silva13 Aug 6, 2024
d99b630
CARITAS-243 - Remove feedback comments
Leandro13Silva13 Aug 6, 2024
ec2f9b5
CARITAS-243 - Remove addition of the peer chat to session from the te…
Leandro13Silva13 Aug 6, 2024
3033d57
CARITAS-243 - Remove feedback from tests
Leandro13Silva13 Aug 6, 2024
a26677a
CARITAS-243 - Remove VIEW_ALL_PEER_SESSIONS
Leandro13Silva13 Aug 6, 2024
67a46af
CARITAS-243 - Remove ASSIGN_CONSULTANT_TO_PEER_SESSION
Leandro13Silva13 Aug 6, 2024
a124cab
CARITAS-243 - Remove VIEW_ALL_PEER_SESSIONS
Leandro13Silva13 Aug 6, 2024
213978c
CARITAS-243 - Remove isPeerChat from sessionDTO
Leandro13Silva13 Aug 6, 2024
79191a8
CARITAS-243 - Remove PEER_CONSULTANT
Leandro13Silva13 Aug 6, 2024
acbfee5
CARITAS-243 - Remove isPeerChat from Session
Leandro13Silva13 Aug 6, 2024
4136b92
CARITAS-243 - Fix tests
Leandro13Silva13 Aug 6, 2024
215c1e5
CARITAS-243 - Fix tests
Leandro13Silva13 Aug 6, 2024
400f9d5
CARITAS-243 - Remove MAIN_CONSULTANT role and Authority
Leandro13Silva13 Aug 6, 2024
cbc77f2
CARITAS-243 - remove rc_feedback_group_id from userservice.session table
Leandro13Silva13 Aug 14, 2024
be0d8a5
Revert "CARITAS-243 - remove rc_feedback_group_id from userservice.se…
Leandro13Silva13 Aug 14, 2024
85ead4c
Revert "CARITAS-243 - Remove addition of the peer chat to session fro…
Leandro13Silva13 Aug 14, 2024
abe2245
CARITAS-243 - revert old migration changes deletion, added new migrat…
Leandro13Silva13 Aug 14, 2024
31d38e4
fix: CARITAS-243 - fix test name
Leandro13Silva13 Aug 14, 2024
165f7b9
fix: CARITAS-243 - fixed the changeSet id
Leandro13Silva13 Aug 16, 2024
dfa28aa
fix: CARITAS-243 - remove unhelpfull rollback procedures
Leandro13Silva13 Aug 19, 2024
01f0109
fix: CARITAS-243 - remove forwardMessageDTO
Leandro13Silva13 Aug 26, 2024
6f77fec
fix: CARITAS-243 - remove forwardMessage logic
Leandro13Silva13 Aug 26, 2024
644b056
Merge branch 'develop' into CARITAS-243-remove-legacy-code
Leandro13Silva13 Sep 11, 2024
daf08f1
fix: CARITAS-243
Leandro13Silva13 Sep 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 2 additions & 44 deletions api/userservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,9 @@ paths:
get:
tags:
- user-controller
summary: 'Returns sessions for given RocketChat group or feedback group IDs.
summary: 'Returns sessions for given RocketChat group IDs.
[Authorization: Role: user, consultant]'
operationId: getSessionsForGroupOrFeedbackGroupIds
operationId: getSessionsForGroupIds
parameters:
- name: RCToken
in: header
Expand Down Expand Up @@ -877,33 +877,6 @@ paths:
description: INTERNAL SERVER ERROR - server encountered unexpected condition
security:
- Bearer: [ ]
/users/mails/messages/feedback/new:
post:
tags:
- user-controller
summary: 'Sends a notification e-mail that a new feedback message/answer has
been written [Authorization: Role: consultant with authority for feedback
chat]'
operationId: sendNewFeedbackMessageNotification
requestBody:
content:
'application/json':
schema:
$ref: '#/components/schemas/NewMessageNotificationDTO'
required: true
responses:
200:
description: successful operation
400:
description: BAD REQUEST - invalid/incomplete request or body object
401:
description: UNAUTHORIZED - invalid token
409:
description: CONFLICT - no user e-mail address in db given
500:
description: INTERNAL SERVER ERROR - server encountered unexpected condition
security:
- Bearer: [ ]
/users/mails/reassignment:
post:
tags:
Expand Down Expand Up @@ -2058,13 +2031,6 @@ components:
type: string
example: xGklslk2JJKK
description: Rocket.Chat room ID
feedbackGroupId:
type: string
example: 8ertjlasdKJA
description: Rocket.Chat feedback room ID
isPeerChat:
type: boolean
example: false
askerRcId:
type: string
example: 8ertjlasdKJA
Expand All @@ -2082,9 +2048,6 @@ components:
messagesRead:
type: boolean
example: false
feedbackRead:
type: boolean
example: true
isTeamSession:
type: boolean
example: false
Expand Down Expand Up @@ -2248,10 +2211,6 @@ components:
type: string
example: xGklslk2JJKK
description: Rocket.Chat room ID
feedbackGroupId:
type: string
example: 8ertjlasdKJA
description: Rocket.Chat feedback room ID
consultantId:
type: string
example: 926b9777-4eef-443d-925a-4aa534797bd7
Expand Down Expand Up @@ -3117,7 +3076,6 @@ components:
enum:
- DAILY_ENQUIRY
- NEW_CHAT_MESSAGE_FROM_ADVICE_SEEKER
- NEW_FEEDBACK_MESSAGE_FROM_ADVICE_SEEKER

securitySchemes:
Bearer:
Expand Down
9 changes: 0 additions & 9 deletions services/consultingtypeservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,6 @@ components:
lockedAgencies:
type: boolean
example: false
excludeNonMainConsultantsFromTeamSessions:
type: boolean
example: true
whiteSpot:
allOf:
- $ref: '#/components/schemas/WhiteSpotDTO'
Expand All @@ -225,12 +222,6 @@ components:
sessionDataInitializing:
allOf:
- $ref: '#/components/schemas/SessionDataInitializingDTO'
initializeFeedbackChat:
type: boolean
example: true
isPeerChat:
type: boolean
example: true
roles:
$ref: '#/components/schemas/RolesDTO'
notifications:
Expand Down
97 changes: 0 additions & 97 deletions services/messageservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,54 +82,6 @@ paths:
- Bearer: []
x-codegen-request-body-name: Message

/messages/feedback/new:
post:
tags:
- message-controller
summary: 'Add new Rocket.Chat message to feedback chat [Authorization: authority
for feedback chat]'
operationId: createFeedbackMessage
parameters:
- name: rcToken
in: header
required: true
schema:
type: string
- name: rcUserId
in: header
required: true
schema:
type: string
- name: rcFeedbackGroupId
in: header
required: true
schema:
type: string
requestBody:
content:
'application/json':
schema:
$ref: '#/components/schemas/MessageDTO'
required: true
responses:
201:
description: CREATED - message was successfully created
content:
'application/json':
schema:
$ref: '#/components/schemas/MessageResponseDTO'
400:
description: BAD REQUEST - invalid/incomplete request or body object
401:
description: UNAUTHORIZED - no/invalid Keycloak token
403:
description: FORBIDDEN - no/invalid role/authorization
500:
description: INTERNAL SERVER ERROR - server encountered unexpected condition
security:
- Bearer: []
x-codegen-request-body-name: Message

/messages/videohint/new:
post:
tags:
Expand Down Expand Up @@ -209,54 +161,6 @@ paths:
security:
- Bearer: []

/messages/forward:
post:
tags:
- message-controller
summary: 'Forward a Rocket.Chat message to another group [Authorization: Role:
u25-consultant]'
operationId: forwardMessage
parameters:
- name: rcToken
in: header
required: true
schema:
type: string
- name: rcUserId
in: header
required: true
schema:
type: string
- name: rcGroupId
in: header
required: true
schema:
type: string
requestBody:
description: Body description
content:
'application/json':
schema:
$ref: '#/components/schemas/ForwardMessageDTO'
required: true
responses:
201:
description: CREATED - message was successfully created
content:
'application/json':
schema:
$ref: '#/components/schemas/MessageResponseDTO'
400:
description: BAD REQUEST - invalid/incomplete request or body object
401:
description: UNAUTHORIZED - no/invalid Keycloak token
403:
description: FORBIDDEN - no/invalid role/authorization
500:
description: INTERNAL SERVER ERROR - server encountered unexpected condition
security:
- Bearer: []

/messages/draft:
post:
tags:
Expand Down Expand Up @@ -592,7 +496,6 @@ components:
type: string
enum:
- "FINISHED_CONVERSATION"
- "FORWARD"
- "FURTHER_STEPS"
- "UPDATE_SESSION_DATA"
- "VIDEOCALL"
Expand Down
14 changes: 0 additions & 14 deletions src/main/java/de/caritas/cob/userservice/api/IdentityManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
@RequiredArgsConstructor
public class IdentityManager implements IdentityManaging {

private static final String VIEW_ALL_PEER_SESSIONS = "AUTHORIZATION_VIEW_ALL_PEER_SESSIONS";
private static final String VIEW_ALL_FEEDBACK_SESSIONS =
"AUTHORIZATION_VIEW_ALL_FEEDBACK_SESSIONS";

private final IdentityClient identityClient;

@Override
Expand Down Expand Up @@ -74,14 +70,4 @@ public boolean isEmailAvailableOrOwn(String username, String email) {
|| user.get("encodedUsername").equals(username)
|| user.get("decodedUsername").equals(username);
}

@Override
public boolean canViewPeerSessions(String consultantId) {
return identityClient.userHasAuthority(consultantId, VIEW_ALL_PEER_SESSIONS);
}

@Override
public boolean canViewFeedbackSessions(String consultantId) {
return identityClient.userHasAuthority(consultantId, VIEW_ALL_FEEDBACK_SESSIONS);
}
}
24 changes: 1 addition & 23 deletions src/main/java/de/caritas/cob/userservice/api/Messenger.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import de.caritas.cob.userservice.api.model.Chat;
import de.caritas.cob.userservice.api.model.Consultant;
import de.caritas.cob.userservice.api.model.Session;
import de.caritas.cob.userservice.api.port.in.IdentityManaging;
import de.caritas.cob.userservice.api.port.in.Messaging;
import de.caritas.cob.userservice.api.port.out.ChatRepository;
import de.caritas.cob.userservice.api.port.out.ConsultantRepository;
Expand Down Expand Up @@ -37,7 +36,6 @@ public class Messenger implements Messaging {
private final SessionRepository sessionRepository;
private final UserServiceMapper mapper;
private final StringConverter stringConverter;
private final IdentityManaging identityManager;
private final AgencyService agencyService;

@Override
Expand Down Expand Up @@ -141,17 +139,9 @@ public boolean removeUserFromSession(String chatUserId, String chatId) {
var removedOrIgnored = new AtomicBoolean(true);

if (!session.isAdvisedBy(consultant) && !isResponsible(session, consultant)) {
if (isInChat(chatId, chatUserId)
&& !isTeaming(session, consultant)
&& !isPeering(session, consultant)) {
if (isInChat(chatId, chatUserId)) {
removedOrIgnored.set(messageClient.removeUserFromSession(chatUserId, chatId));
}

var feedbackChatId = session.getFeedbackGroupId();
if (isInChat(feedbackChatId, chatUserId) && !isMain(consultant)) {
removedOrIgnored.compareAndExchange(
true, messageClient.removeUserFromSession(chatUserId, feedbackChatId));
}
}

return removedOrIgnored.get();
Expand All @@ -161,18 +151,6 @@ private boolean isResponsible(Session session, Consultant consultant) {
return session.isTeamSession() && consultant.isInAgency(session.getAgencyId());
}

private boolean isTeaming(Session session, Consultant consultant) {
return !session.hasFeedbackChat() && consultant.isTeamConsultant();
}

private boolean isPeering(Session session, Consultant consultant) {
return session.hasFeedbackChat() && identityManager.canViewPeerSessions(consultant.getId());
}

private boolean isMain(Consultant consultant) {
return identityManager.canViewFeedbackSessions(consultant.getId());
}

public boolean isInChat(String chatId, String chatUserId) {
if (isNull(chatId)) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ public Map<String, Object> mapOf(Consultant consultant, Map<String, Object> addi
map.put(
"notifyNewChatMessageFromAdviceSeeker",
consultant.getNotifyNewChatMessageFromAdviceSeeker());
map.put(
"notifyNewFeedbackMessageFromAdviceSeeker",
consultant.getNotifyNewFeedbackMessageFromAdviceSeeker());
map.put("walkThroughEnabled", consultant.getWalkThroughEnabled());
map.put("chatUserId", consultant.getRocketChatId());
map.put("preferredLanguage", consultant.getLanguageCode().toString());
Expand Down Expand Up @@ -380,10 +377,6 @@ public Consultant consultantOf(Consultant consultant, Map<String, Object> patchM
var notify = (Boolean) patchMap.get("notifyNewChatMessageFromAdviceSeeker");
consultant.setNotifyNewChatMessageFromAdviceSeeker(notify);
}
if (patchMap.containsKey("notifyNewFeedbackMessageFromAdviceSeeker")) {
var notify = (Boolean) patchMap.get("notifyNewFeedbackMessageFromAdviceSeeker");
consultant.setNotifyNewFeedbackMessageFromAdviceSeeker(notify);
}
if (patchMap.containsKey("termsAndConditionsConfirmation")
&& (patchMap.get("termsAndConditionsConfirmation") instanceof Boolean)) {
consultant.setTermsAndConditionsConfirmation(LocalDateTime.now());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class SetRocketChatRoomReadOnlyActionCommand implements ActionCommand<Ses
public void execute(Session session) {
if (nonNull(session)) {
setRoomReadOnly(session.getGroupId());
setRoomReadOnly(session.getFeedbackGroupId());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
import de.caritas.cob.userservice.api.facade.userdata.AskerDataProvider;
import de.caritas.cob.userservice.api.facade.userdata.ConsultantDataFacade;
import de.caritas.cob.userservice.api.facade.userdata.ConsultantDataProvider;
import de.caritas.cob.userservice.api.facade.userdata.EmailNotificationMapper;
import de.caritas.cob.userservice.api.facade.userdata.KeycloakUserDataProvider;
import de.caritas.cob.userservice.api.helper.AuthenticatedUser;
import de.caritas.cob.userservice.api.model.Chat;
Expand Down Expand Up @@ -174,8 +173,6 @@ public class UserController implements UsersApi {

private final @NotNull AdminUserFacade adminUserFacade;

private final @NonNull EmailNotificationMapper emailNotificationMapper;

@Value("${feature.topics.enabled}")
private boolean featureTopicsEnabled;

Expand Down Expand Up @@ -340,13 +337,13 @@ public ResponseEntity<UserSessionListResponseDTO> getSessionsForAuthenticatedUse

/**
* Returns a list of sessions for the currently authenticated/logged in user and given RocketChat
* group, or feedback group IDs.
* group IDs.
*
* @param rcToken Rocket.Chat token (required)
* @return {@link ResponseEntity} of {@link UserSessionListResponseDTO}
*/
@Override
public ResponseEntity<GroupSessionListResponseDTO> getSessionsForGroupOrFeedbackGroupIds(
public ResponseEntity<GroupSessionListResponseDTO> getSessionsForGroupIds(
@RequestHeader String rcToken, @RequestParam List<String> rcGroupIds) {
GroupSessionListResponseDTO groupSessionList;
if (authenticatedUser.isConsultant()) {
Expand Down Expand Up @@ -717,26 +714,6 @@ public ResponseEntity<Void> sendNewMessageNotification(
return new ResponseEntity<>(HttpStatus.OK);
}

/**
* Sends email notifications to the user(s) if there has been a new feedback answer. Uses the
* provided Keycloak authorization token for user verification (user role). This means that the
* user that wrote the answer should also call this method.
*
* @param newMessageNotificationDTO (required)
* @return {@link ResponseEntity} containing {@link HttpStatus}
*/
@Override
public ResponseEntity<Void> sendNewFeedbackMessageNotification(
@RequestBody NewMessageNotificationDTO newMessageNotificationDTO) {

emailNotificationFacade.sendNewFeedbackMessageNotification(
newMessageNotificationDTO.getRcGroupId(),
authenticatedUser.getUserId(),
TenantContext.getCurrentTenantData());

return new ResponseEntity<>(HttpStatus.OK);
}

/**
* Sends email notification for reassign request to advice seeker if the property isConfirmed of
* {@link ReassignmentNotificationDTO} is null or false. Send email confirmation notification to
Expand Down
Loading
Loading