Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.