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 #10

Merged
merged 9 commits into from
Sep 11, 2024
129 changes: 0 additions & 129 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 @@ -323,54 +275,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 @@ -627,45 +531,13 @@ components:
AliasMessageDTO:
type: object
properties:
forwardMessageDTO:
$ref: '#/components/schemas/ForwardMessageDTO'
videoCallMessageDTO:
$ref: '#/components/schemas/VideoCallMessageDTO'
messageType:
$ref: '#/components/schemas/MessageType'
content:
type: string

ForwardMessageDTO:
type: object
required:
- message
- timestamp
- username
- rcUserId
properties:
message:
type: string
example: "Lorem ipsum dolor sit amet, consetetur..."
org:
type: string
example: "Lorem ipsum dolor sit amet, consetetur..."
description: "Legacy fallback for stringified messages"
timestamp:
type: string
description: "Full qualified timestamp"
example: "2018-11-15T09:33:00.057Z"
username:
type: string
example: "asker23"
displayName:
type: string
rcUserId:
type: string
example: "ag89h3tjkerg94t"
t:
type: string

VideoCallMessageDTO:
type: object
required:
Expand Down Expand Up @@ -706,7 +578,6 @@ components:
- "APPOINTMENT_CANCELLED"
- "APPOINTMENT_RESCHEDULED"
- "FINISHED_CONVERSATION"
- "FORWARD"
- "FURTHER_STEPS"
- "UPDATE_SESSION_DATA"
- "VIDEOCALL"
Expand Down
63 changes: 0 additions & 63 deletions services/userservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -538,33 +538,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/consultants:
get:
tags:
Expand Down Expand Up @@ -1211,10 +1184,6 @@ components:
type: string
example: xGklslk2JJKK
description: Rocket.Chat room ID
feedbackGroupId:
type: string
example: 8ertjlasdKJA
description: Rocket.Chat feedback room ID
askerRcId:
type: string
example: 8ertjlasdKJA
Expand All @@ -1229,9 +1198,6 @@ components:
messagesRead:
type: boolean
example: false
feedbackRead:
type: boolean
example: true
isTeamSession:
type: boolean
example: false
Expand Down Expand Up @@ -1262,35 +1228,11 @@ components:
AliasMessageDTO:
type: object
properties:
forwardMessageDTO:
$ref: '#/components/schemas/ForwardMessageDTO'
videoCallMessageDTO:
$ref: '#/components/schemas/VideoCallMessageDTO'
messageType:
$ref: '#/components/schemas/MessageType'

ForwardMessageDTO:
type: object
required:
- message
- timestamp
- username
- rcUserId
properties:
message:
type: string
example: "Lorem ipsum dolor sit amet, consetetur..."
timestamp:
type: string
description: "Full qualified timestamp"
example: "2018-11-15T09:33:00.057Z"
username:
type: string
example: "asker23"
rcUserId:
type: string
example: "ag89h3tjkerg94t"

VideoCallMessageDTO:
type: object
required:
Expand All @@ -1314,7 +1256,6 @@ components:
enum:
- "FURTHER_STEPS"
- "UPDATE_SESSION_DATA"
- "FORWARD"
- "VIDEOCALL"

ConsultantSessionDTO:
Expand Down Expand Up @@ -1343,10 +1284,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
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ void resolve_should_ResolveTechnicalTenantId_ForTechnicalUserRole() {
void resolve_should_NotResolveTenantId_When_NonTechnicalUserRole() {
// given
givenUserIsAuthenticated();
when(mockAuthentication.getPrincipal()).thenReturn(buildJwtWithRealmRole("another-role"));
when(mockAuthentication.getPrincipal())
.thenReturn((Object) buildJwtWithRealmRole("another-role"));
var resolved = technicalUserTenantResolver.resolve(authenticatedRequest);
// then
assertThat(resolved).isEmpty();
Expand All @@ -78,7 +79,11 @@ private Jwt buildJwtWithRealmRole(String realmRole) {
headers.put("alg", "HS256"); // Signature algorithm
headers.put("typ", "JWT"); // Token type
return new Jwt(
"token", Instant.now(), Instant.now(), headers, givenClaimMapContainingRole(realmRole));
"token",
Instant.now(),
Instant.now().plusSeconds(1),
headers,
givenClaimMapContainingRole(realmRole));
}

private HashMap<String, Object> givenClaimMapContainingRole(String realmRole) {
Expand Down
Loading