Page MenuHomePhabricator

D7123.id23985.diff
No OneTemporary

D7123.id23985.diff

diff --git a/web/database/queries/draft-queries.js b/web/database/queries/draft-queries.js
--- a/web/database/queries/draft-queries.js
+++ b/web/database/queries/draft-queries.js
@@ -1,5 +1,9 @@
// @flow
+import type { ClientDBDraftInfo } from 'lib/types/draft-types.js';
+
+import { parseSQLiteResult } from '../utils/db-utils.js';
+
function removeAllDrafts(db: SqliteDatabase) {
db.exec(`DELETE from drafts`);
}
@@ -31,4 +35,14 @@
db.exec(query, params);
}
-export { removeAllDrafts, updateDraft, moveDraft };
+function getAllDrafts(db: SqliteDatabase): ClientDBDraftInfo[] {
+ const rawDBResult = db.exec(`SELECT * FROM drafts`);
+ const dbResult = parseSQLiteResult<ClientDBDraftInfo>(rawDBResult);
+ if (!dbResult.length) {
+ return [];
+ }
+
+ return dbResult[0];
+}
+
+export { removeAllDrafts, updateDraft, moveDraft, getAllDrafts };

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 27, 11:39 PM (6 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2722100
Default Alt Text
D7123.id23985.diff (866 B)

Event Timeline