feat: answer routes en put question
This commit is contained in:
parent
6a1adb0ee3
commit
e8e2466b76
12 changed files with 288 additions and 62 deletions
|
@ -19,10 +19,20 @@ export class AnswerRepository extends DwengoEntityRepository<Answer> {
|
|||
orderBy: { sequenceNumber: 'ASC' },
|
||||
});
|
||||
}
|
||||
public async findAnswer(question: Question, sequenceNumber: number) {
|
||||
return this.findOne({
|
||||
toQuestion: question, sequenceNumber
|
||||
});
|
||||
}
|
||||
public async removeAnswerByQuestionAndSequenceNumber(question: Question, sequenceNumber: number): Promise<void> {
|
||||
return this.deleteWhere({
|
||||
toQuestion: question,
|
||||
sequenceNumber: sequenceNumber,
|
||||
});
|
||||
}
|
||||
public async updateContent(answer: Answer, newContent: string){
|
||||
answer.content = newContent;
|
||||
await this.save(answer);
|
||||
return answer;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,4 +70,10 @@ export class QuestionRepository extends DwengoEntityRepository<Question> {
|
|||
sequenceNumber
|
||||
});
|
||||
}
|
||||
|
||||
public async updateContent(question: Question, newContent: string): Promise<Question> {
|
||||
question.content = newContent;
|
||||
await this.save(question);
|
||||
return question;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue