mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 19:49:54 +02:00
common: remove total-notes utility
This commit is contained in:
12
packages/common/package-lock.json
generated
12
packages/common/package-lock.json
generated
@@ -28,6 +28,7 @@
|
||||
"dev": true,
|
||||
"license": "GPL-3.0-or-later",
|
||||
"dependencies": {
|
||||
"@leeoniya/ufuzzy": "^1.0.10",
|
||||
"@microsoft/signalr": "^7.0.10",
|
||||
"@microsoft/signalr-protocol-msgpack": "^7.0.10",
|
||||
"@notesnook/logger": "file:../logger",
|
||||
@@ -38,6 +39,7 @@
|
||||
"html-to-text": "^9.0.5",
|
||||
"htmlparser2": "^8.0.1",
|
||||
"katex": "0.16.2",
|
||||
"kysely": "^0.26.3",
|
||||
"linkedom": "^0.14.17",
|
||||
"liqe": "^1.13.0",
|
||||
"mime-db": "1.52.0",
|
||||
@@ -48,6 +50,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@notesnook/crypto": "file:../crypto",
|
||||
"@types/better-sqlite3": "^7.6.5",
|
||||
"@types/event-source-polyfill": "^1.0.1",
|
||||
"@types/html-to-text": "^9.0.0",
|
||||
"@types/katex": "^0.16.2",
|
||||
@@ -58,6 +61,8 @@
|
||||
"@types/ws": "^8.5.5",
|
||||
"@vitest/coverage-v8": "^0.34.1",
|
||||
"abortcontroller-polyfill": "^1.7.3",
|
||||
"better-sqlite3": "^8.6.0",
|
||||
"bson-objectid": "^2.0.4",
|
||||
"cross-env": "^7.0.3",
|
||||
"dotenv": "^16.0.1",
|
||||
"event-source-polyfill": "^1.0.31",
|
||||
@@ -66,6 +71,7 @@
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"jsdom": "^22.1.0",
|
||||
"mockdate": "^3.0.5",
|
||||
"nanoid": "^5.0.1",
|
||||
"otplib": "^12.0.1",
|
||||
"refractor": "^4.8.1",
|
||||
"vitest": "^0.34.1",
|
||||
@@ -149,11 +155,13 @@
|
||||
"@notesnook/core": {
|
||||
"version": "file:../core",
|
||||
"requires": {
|
||||
"@leeoniya/ufuzzy": "^1.0.10",
|
||||
"@microsoft/signalr": "^7.0.10",
|
||||
"@microsoft/signalr-protocol-msgpack": "^7.0.10",
|
||||
"@notesnook/crypto": "file:../crypto",
|
||||
"@notesnook/logger": "file:../logger",
|
||||
"@streetwriters/showdown": "^3.0.1-alpha.2",
|
||||
"@types/better-sqlite3": "^7.6.5",
|
||||
"@types/event-source-polyfill": "^1.0.1",
|
||||
"@types/html-to-text": "^9.0.0",
|
||||
"@types/katex": "^0.16.2",
|
||||
@@ -165,6 +173,8 @@
|
||||
"@vitest/coverage-v8": "^0.34.1",
|
||||
"abortcontroller-polyfill": "^1.7.3",
|
||||
"async-mutex": "^0.3.2",
|
||||
"better-sqlite3": "^8.6.0",
|
||||
"bson-objectid": "^2.0.4",
|
||||
"cross-env": "^7.0.3",
|
||||
"dayjs": "1.11.9",
|
||||
"dotenv": "^16.0.1",
|
||||
@@ -177,10 +187,12 @@
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"jsdom": "^22.1.0",
|
||||
"katex": "0.16.2",
|
||||
"kysely": "^0.26.3",
|
||||
"linkedom": "^0.14.17",
|
||||
"liqe": "^1.13.0",
|
||||
"mime-db": "1.52.0",
|
||||
"mockdate": "^3.0.5",
|
||||
"nanoid": "^5.0.1",
|
||||
"otplib": "^12.0.1",
|
||||
"prismjs": "^1.29.0",
|
||||
"qclone": "^1.2.0",
|
||||
|
||||
@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
export * from "./file";
|
||||
export * from "./number";
|
||||
export * from "./total-notes";
|
||||
export * from "./time";
|
||||
export * from "./debounce";
|
||||
export * from "./random";
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
This file is part of the Notesnook project (https://notesnook.com/)
|
||||
|
||||
Copyright (C) 2023 Streetwriters (Private) Limited
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { Item } from "@notesnook/core/dist/types";
|
||||
import { database } from "../database";
|
||||
|
||||
export function getTotalNotes(item?: Item) {
|
||||
if (!item || (item.type !== "notebook" && item.type !== "topic")) return 0;
|
||||
if (item.type === "topic") {
|
||||
return (
|
||||
database.notebooks?.notebook(item.notebookId)?.topics.topic(item.id)
|
||||
?.totalNotes || 0
|
||||
);
|
||||
}
|
||||
return database.notebooks?.notebook(item.id)?.totalNotes || 0;
|
||||
}
|
||||
Reference in New Issue
Block a user