Skip to content

Commit

Permalink
feat: added message type to alias
Browse files Browse the repository at this point in the history
  • Loading branch information
mobo4b committed Feb 26, 2021
1 parent d1dc024 commit fdf8ee6
Show file tree
Hide file tree
Showing 5 changed files with 302 additions and 304 deletions.
95 changes: 49 additions & 46 deletions api/messageservice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ paths:
technical]'
operationId: createMessage
parameters:
- name: RCToken
- name: rcToken
in: header
required: true
schema:
type: string
- name: RCUserId
- name: rcUserId
in: header
required: true
schema:
type: string
- name: RCGroupId
- name: rcGroupId
in: header
required: true
schema:
Expand Down Expand Up @@ -89,17 +89,17 @@ paths:
for feedback chat]'
operationId: createFeedbackMessage
parameters:
- name: RCToken
- name: rcToken
in: header
required: true
schema:
type: string
- name: RCUserId
- name: rcUserId
in: header
required: true
schema:
type: string
- name: RCFeedbackGroupId
- name: rcFeedbackGroupId
in: header
required: true
schema:
Expand Down Expand Up @@ -133,7 +133,7 @@ paths:
consultant]'
operationId: createVideoHintMessage
parameters:
- name: RCGroupId
- name: rcGroupId
in: header
required: true
schema:
Expand Down Expand Up @@ -164,12 +164,12 @@ paths:
summary: 'Get Rocket.Chat message stream [Authorization: Role: user, consultant]'
operationId: getMessageStream
parameters:
- name: RCToken
- name: rcToken
in: header
required: true
schema:
type: string
- name: RCUserId
- name: rcUserId
in: header
required: true
schema:
Expand All @@ -180,18 +180,6 @@ paths:
required: true
schema:
type: string
- name: offset
in: query
description: Number of items where to start in the query (0 = first item)
required: true
schema:
type: integer
- name: count
in: query
description: Number of item which are being returned (0 = all)
required: true
schema:
type: integer
responses:
200:
description: OK - successfull operation
Expand Down Expand Up @@ -220,17 +208,17 @@ paths:
u25-consultant]'
operationId: forwardMessage
parameters:
- name: RCToken
- name: rcToken
in: header
required: true
schema:
type: string
- name: RCUserId
- name: rcUserId
in: header
required: true
schema:
type: string
- name: RCGroupId
- name: rcGroupId
in: header
required: true
schema:
Expand Down Expand Up @@ -263,7 +251,7 @@ paths:
summary: 'Save a draft message [Authorization: Role: user, consultant]'
operationId: saveDraftMessage
parameters:
- name: RCGroupId
- name: rcGroupId
in: header
required: true
schema:
Expand Down Expand Up @@ -296,7 +284,7 @@ paths:
summary: 'Get a draft message by user and rocket chat group id [Authorization: Role: user, consultant]'
operationId: findDraftMessage
parameters:
- name: RCGroupId
- name: rcGroupId
in: header
required: true
schema:
Expand All @@ -321,6 +309,32 @@ paths:
security:
- Bearer: []

/messages/furthersteps/new:
post:
tags:
- message-controller
summary: 'Saves a new further steps system message [Authorization: Role: user, consultant]'
operationId: saveFurtherStepsMessage
parameters:
- name: rcGroupId
in: header
required: true
schema:
type: string
responses:
201:
description: CREATED - message was successfully created
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: [ ]

components:
schemas:
MessageDTO:
Expand All @@ -339,31 +353,11 @@ components:
type: object
required:
- messages
- count
- offset
- total
- success
- cleaned
properties:
messages:
type: array
items:
$ref: '#/components/schemas/MessagesDTO'
count:
type: string
example: "2"
offset:
type: string
example: "0"
total:
type: string
example: "2"
success:
type: string
example: "true"
cleaned:
type: string
example: "true"

MessagesDTO:
type: object
Expand Down Expand Up @@ -423,6 +417,8 @@ components:
$ref: '#/components/schemas/ForwardMessageDTO'
videoCallMessageDTO:
$ref: '#/components/schemas/VideoCallMessageDTO'
messageType:
$ref: '#/components/schemas/MessageType'

ForwardMessageDTO:
type: object
Expand Down Expand Up @@ -464,6 +460,13 @@ components:
type: string
example: "ag89h3tjkerg94t"

MessageType:
type: string
enum:
- "FURTHER_STEPS"
- "FORWARD"
- "VIDEOCALL"

UserDTO:
type: object
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ public class MessageController implements MessagesApi {
*/
@Override
public ResponseEntity<MessageStreamDTO> getMessageStream(@RequestHeader String rcToken,
@RequestHeader String rcUserId, @RequestParam String rcGroupId, @RequestParam Integer offset,
@RequestParam Integer count) {
@RequestHeader String rcUserId, @RequestParam String rcGroupId) {

MessageStreamDTO message =
rocketChatService.getGroupMessages(rcToken, rcUserId, rcGroupId, offset, count);
rocketChatService.getGroupMessages(rcToken, rcUserId, rcGroupId);

return (message != null) ? new ResponseEntity<>(message, HttpStatus.OK)
: new ResponseEntity<>(HttpStatus.NO_CONTENT);
Expand Down
Loading

0 comments on commit fdf8ee6

Please sign in to comment.