internal: incomplete vault systems behind feature flag (#2340)
This commit is contained in:
38
packages/services/src/Domain/Item/StaticItemCounter.ts
Normal file
38
packages/services/src/Domain/Item/StaticItemCounter.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { ContentType } from '@standardnotes/common'
|
||||
import { SNNote, SNTag, ItemCounts } from '@standardnotes/models'
|
||||
|
||||
export class StaticItemCounter {
|
||||
countNotesAndTags(items: Array<SNNote | SNTag>): ItemCounts {
|
||||
const counts: ItemCounts = {
|
||||
notes: 0,
|
||||
archived: 0,
|
||||
deleted: 0,
|
||||
tags: 0,
|
||||
}
|
||||
|
||||
for (const item of items) {
|
||||
if (item.trashed) {
|
||||
counts.deleted++
|
||||
|
||||
continue
|
||||
}
|
||||
if (item.archived) {
|
||||
counts.archived++
|
||||
|
||||
continue
|
||||
}
|
||||
if (item.content_type === ContentType.Note && !item.conflictOf) {
|
||||
counts.notes++
|
||||
|
||||
continue
|
||||
}
|
||||
if (item.content_type === ContentType.Tag) {
|
||||
counts.tags++
|
||||
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
return counts
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user