diff --git a/src/app/services/websockets/ws-comment-service.service.ts b/src/app/services/websockets/ws-comment-service.service.ts index 76d59cbf900b37c49af7d80a59d5fa966136d1f8..c2ecd60f0e63f1b626686f9616de92da87b1c470 100644 --- a/src/app/services/websockets/ws-comment-service.service.ts +++ b/src/app/services/websockets/ws-comment-service.service.ts @@ -4,8 +4,8 @@ import { RxStompService } from '@stomp/ng2-stompjs'; import { CreateComment } from '../../models/messages/create-comment'; import { PatchComment } from '../../models/messages/patch-comment'; import { TSMap } from 'typescript-map'; -import { Vote } from '../../models/vote'; import { UpVote } from '../../models/messages/up-vote'; +import { DownVote } from '../../models/messages/down-vote'; @Injectable({ @@ -53,6 +53,24 @@ export class WsCommentServiceService { voteUp(comment: Comment): void { const message = new UpVote(comment.userId, comment.id); + this.rxStompService.publish({ + destination: `/queue/comment.command.patch`, + body: JSON.stringify(message), + headers: { + 'content-type': 'application/json' + } + }); + } + + voteDown(comment: Comment): void { + const message = new DownVote(comment.userId, comment.id); + this.rxStompService.publish({ + destination: `/queue/comment.command.patch`, + body: JSON.stringify(message), + headers: { + 'content-type': 'application/json' + } + }); } private patchComment(comment: Comment, changes: TSMap<string, any>): void {