add genres to publications and stories

This commit is contained in:
Andrzej Stepien 2023-09-14 16:51:32 +02:00
parent cefd6770de
commit c8cb206971
2 changed files with 10 additions and 7 deletions

View File

@ -4,18 +4,22 @@ export class Data {
this.#db = db
}
async init() {
this.genres = await this.getGenres()
this.submissions = await this.getSubmissions()
this.stories = await this.getStories()
this.stories.map(row=>{
for (const row of this.stories) {
row.submissions=this.getSubmissionsByStoryId(row.id)
})
row.genres= await this.getGenresByStoryId(row.id)
}
//
this.publications = await this.getPublications()
this.publications.map(row=>{
for (const row of this.publications){
row.submissions=this.getSubmissionsByPublicationId(row.id)
})
row.genres= await this.getGenresByPublicationId(row.id)
}
this.responses = await this.getResponses()
this.genres = await this.getGenres()
return this
}
async getStories() {
@ -73,7 +77,6 @@ export class Data {
const res = await this.#db('pubs_genres')
.select('genre_id')
.where('pub_id',id)
console.dir(res)
return this.#makeGenreArray(res)
}

BIN
test.db

Binary file not shown.