Add plugin

This commit is contained in:
Rakantor committed 2022-10-28 21:47:02 +02:00
1 parent 2053c12eee
commit 58fac72355
5 files changed
+128

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
export class ClosedEndedQuestion {
constructor (id, question, answers, correctAnswer, creator, created, comments, status) {
this.id = id
this.question = question
this.answers = answers
this.correctAnswer = correctAnswer
this.creator = creator
this.created = created
this.comments = comments
this.status = status
}
}
// Firestore data converter
export const ClosedEndedQuestionConverter = {
toFirestore: (closedEndedQuestion) => {
return {
frage: closedEndedQuestion.question,
antworten: closedEndedQuestion.answers,
richtig: closedEndedQuestion.correctAnswer,
ersteller: closedEndedQuestion.creator,
erstellt: closedEndedQuestion.created,
kommentare: closedEndedQuestion.comments,
status: closedEndedQuestion.status
}
},
fromFirestore: (snapshot, options) => {
const data = snapshot.data(options)
return new ClosedEndedQuestion(snapshot.id, data.frage, data.antworten, data.richtig, data.ersteller, data.erstellt, data.kommentare, data.status)
}
}