Last active
August 15, 2018 13:14
-
-
Save bmelnychuk/a2d9684cac331aec77fe328cd9fe6923 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getQuestions, getQuestion } from '../../../question-store'; | |
export default class QuestionStoreRepository implements QuestionRepository { | |
async getAvailableQuestions(categoryId: string): Promise<Question[]> { | |
const rawQuestions = await getQuestions(categoryId); | |
return rawQuestions.map(rawQuestion => new Question( | |
rawQuestion.id, | |
rawQuestion.question, | |
rawQuestion.answer | |
)); | |
} | |
async getById(questionId: string): Promise<Question> { | |
const rawQuestion = await getQuestion(questionId); | |
return new Question( | |
rawQuestion.id, | |
rawQuestion.question, | |
rawQuestion.answer | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment