Skip to content

Commit

Permalink
Resume poll service
Browse files Browse the repository at this point in the history
  • Loading branch information
Toxantron committed Sep 27, 2020
1 parent 1ba8844 commit 6038393
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
25 changes: 24 additions & 1 deletion src/app/poll.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Session } from './session';
import { MemberVote } from './card';
import { Observable } from 'rxjs';
import { Observable, of } from 'rxjs';
import { Topic } from './topic';
import { Member } from './member';

export class PollResponse {
name: string;
Expand All @@ -28,4 +30,25 @@ export class PollService {
currentPoll(session: Session) : Observable<PollResponse> {
return this.http.get<PollResponse>('/api/poll/current/' + session.id);
}

getTopic(session: Session) : Observable<Topic> {
return this.http.get<Topic>('/api/poll/topic/' + session.id);
}

setTopic(session: Session, topic: Topic) {
this.http.post('/api/poll/topic/' + session.id, topic)
}

placeVote(session: Session, member: Member, vote: string) {
var wrapper = {
vote: vote
};
var url = '/api/poll/vote/' + session.id + '/' + member.id;
this.http.post(url, wrapper);
}

retractVote(session: Session, member: Member, vote: string) {
var url = '/api/poll/vote/' + session.id + '/' + member.id;
this.http.delete(url);
}
}
4 changes: 3 additions & 1 deletion src/app/topic.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
export class Topic {
id: number;

name: string;
topic: string;

description: string;

url: string;

votable: boolean;

constructor() {

}
Expand Down

0 comments on commit 6038393

Please sign in to comment.