add genres to publications and stories
This commit is contained in:
parent
cefd6770de
commit
c8cb206971
|
@ -4,18 +4,22 @@ export class Data {
|
||||||
this.#db = db
|
this.#db = db
|
||||||
}
|
}
|
||||||
async init() {
|
async init() {
|
||||||
|
this.genres = await this.getGenres()
|
||||||
this.submissions = await this.getSubmissions()
|
this.submissions = await this.getSubmissions()
|
||||||
this.stories = await this.getStories()
|
this.stories = await this.getStories()
|
||||||
this.stories.map(row=>{
|
for (const row of this.stories) {
|
||||||
row.submissions=this.getSubmissionsByStoryId(row.id)
|
row.submissions=this.getSubmissionsByStoryId(row.id)
|
||||||
|
row.genres= await this.getGenresByStoryId(row.id)
|
||||||
})
|
}
|
||||||
|
//
|
||||||
this.publications = await this.getPublications()
|
this.publications = await this.getPublications()
|
||||||
this.publications.map(row=>{
|
for (const row of this.publications){
|
||||||
row.submissions=this.getSubmissionsByPublicationId(row.id)
|
row.submissions=this.getSubmissionsByPublicationId(row.id)
|
||||||
})
|
row.genres= await this.getGenresByPublicationId(row.id)
|
||||||
|
}
|
||||||
|
|
||||||
this.responses = await this.getResponses()
|
this.responses = await this.getResponses()
|
||||||
this.genres = await this.getGenres()
|
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
async getStories() {
|
async getStories() {
|
||||||
|
@ -73,7 +77,6 @@ export class Data {
|
||||||
const res = await this.#db('pubs_genres')
|
const res = await this.#db('pubs_genres')
|
||||||
.select('genre_id')
|
.select('genre_id')
|
||||||
.where('pub_id',id)
|
.where('pub_id',id)
|
||||||
console.dir(res)
|
|
||||||
return this.#makeGenreArray(res)
|
return this.#makeGenreArray(res)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue