Skip to content

Commit

Permalink
fix(cms): updating json files when deleting elements
Browse files Browse the repository at this point in the history
  • Loading branch information
allardy committed Apr 17, 2019
1 parent 8184b47 commit f98008e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/bp/core/services/cms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,13 @@ export class CMSService implements IDisposeOnExit {
const elements = await this.getContentElements(botId, ids)
await Promise.map(elements, el => this.moduleLoader.onElementChanged(botId, 'delete', el))

return this.memDb(this.contentTable)
await this.memDb(this.contentTable)
.where({ botId })
.whereIn('id', ids)
.del()

const contentTypes = _.uniq(_.map(elements, 'contentType'))
await Promise.mapSeries(contentTypes, contentTypeId => this.dumpDataToFile(botId, contentTypeId))
}

async getAllContentTypes(botId?: string): Promise<ContentType[]> {
Expand Down

0 comments on commit f98008e

Please sign in to comment.