chore: fix ContentType usage (#2353)

* chore: fix ContentType usage

* chore: fix specs
This commit is contained in:
Karol Sójko
2023-07-12 13:53:29 +02:00
committed by GitHub
parent d057cdff84
commit 325737bfbd
247 changed files with 1092 additions and 1060 deletions

View File

@@ -2,11 +2,11 @@ import { MutatorClientInterface } from '@standardnotes/services'
import { SNTag, TagMutator, TagFolderDelimitter } from '@standardnotes/models'
import { ItemManager } from '@Lib/Services'
import { lastElement, sortByKey, withoutLastElement } from '@standardnotes/utils'
import { ContentType } from '@standardnotes/common'
import { ContentType } from '@standardnotes/domain-core'
export class TagsToFoldersMigrationApplicator {
public static isApplicableToCurrentData(itemManager: ItemManager): boolean {
const tags = itemManager.getItems<SNTag>(ContentType.Tag)
const tags = itemManager.getItems<SNTag>(ContentType.TYPES.Tag)
for (const tag of tags) {
if (tag.title.includes(TagFolderDelimitter) && !tag.parentId) {
return true
@@ -17,7 +17,7 @@ export class TagsToFoldersMigrationApplicator {
}
public static async run(itemManager: ItemManager, mutator: MutatorClientInterface): Promise<void> {
const tags = itemManager.getItems(ContentType.Tag) as SNTag[]
const tags = itemManager.getItems(ContentType.TYPES.Tag) as SNTag[]
const sortedTags = sortByKey(tags, 'title')
for (const tag of sortedTags) {