add responses to data object

This commit is contained in:
Andrzej Stepien 2023-09-12 00:00:09 +02:00
parent 8a3f69f6cc
commit fdcaabe416
1 changed files with 5 additions and 0 deletions

View File

@ -13,6 +13,7 @@ export class Data {
this.publications.map(row=>{
row.submissions=this.getSubmissionsByPublicationId(row.id)
})
this.responses = await this.getResponses()
return this
}
async getStories() {
@ -39,6 +40,10 @@ export class Data {
'responses.response'
)
}
async getResponses() {
return this.#db('responses')
.select('*')
}
getSubmissionsByStoryId(id){
return this.submissions.filter(row=>row.story_id==id)