Skip to content

Commit

Permalink
test(service): add code for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
devformatters authored and Zeck Li committed Aug 7, 2020
1 parent 7ff96f2 commit 8c034d7
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions src/connectors/tagService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -550,22 +550,25 @@ export class TagService extends BaseService {
* *
*********************************/
deleteTags = async (tagIds: string[]) => {
const ids = tagIds
.map((tagId) => parseInt(tagId, 10))
.filter((id) => typeof id === 'number')
logger.error(ids)

// delete article tags
await this.knex('article_tag').whereIn('tag_id', tagIds).del()
const deleteArticleTags = this.knex('article_tag')
.whereIn('tag_id', ids)
.del()
await deleteArticleTags
logger.error(deleteArticleTags.toString())

// delete action tag
const deletion = this.knex('action_tag')
.whereIn('target_id', tagIds)
const deleteActionTag = this.knex('action_tag')
.whereIn('target_id', ids)
.andWhere('action', 'follow')
.del()

// for debugging
await deletion
logger.info(deletion.toString())
const testResult = await this.knex('action_tag')
.whereIn('target_id', tagIds)
.andWhere('action', 'follow')
logger.info(testResult)
await deleteActionTag
logger.error(deleteActionTag.toString())

// delete tags
await this.baseBatchDelete(tagIds)
Expand Down

0 comments on commit 8c034d7

Please sign in to comment.