File tree Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Expand file tree Collapse file tree 4 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import {
19
19
readFileTypeFromBuffer ,
20
20
} from '../../lib/electronOnly'
21
21
import { join } from 'path'
22
- import { NoteDocEditibleProps } from '../../lib/db/types'
22
+ import { NoteDocImportableProps } from '../../lib/db/types'
23
23
import { isFolderPathnameValid } from '../../lib/db/utils'
24
24
import { useDb } from '../../lib/db'
25
25
import { JsonObject } from 'type-fest'
@@ -112,6 +112,8 @@ const ImportLegacyNotesForm = ({ storageId }: ImportLegacyNotesFormProps) => {
112
112
const title = normalizeString ( note . title )
113
113
const tags = normalizeTags ( note . tags )
114
114
const data = { }
115
+ const createdAt = normalizeString ( note . createdAt )
116
+ const updatedAt = normalizeString ( note . updatedAt )
115
117
switch ( note . type ) {
116
118
case 'MARKDOWN_NOTE' : {
117
119
const legacyNoteId = noteFileName . replace ( / .c s o n $ / , '' )
@@ -164,12 +166,14 @@ const ImportLegacyNotesForm = ({ storageId }: ImportLegacyNotesFormProps) => {
164
166
)
165
167
}
166
168
167
- const noteProps : NoteDocEditibleProps = {
169
+ const noteProps : NoteDocImportableProps = {
168
170
folderPathname,
169
171
title,
170
172
content,
171
173
tags,
172
174
data,
175
+ createdAt,
176
+ updatedAt,
173
177
}
174
178
return noteProps
175
179
}
@@ -186,12 +190,14 @@ const ImportLegacyNotesForm = ({ storageId }: ImportLegacyNotesFormProps) => {
186
190
. map ( stringifySnippet )
187
191
. join ( '\n\n' ) } `
188
192
189
- const noteProps : NoteDocEditibleProps = {
193
+ const noteProps : NoteDocImportableProps = {
190
194
folderPathname,
191
195
title,
192
196
content,
193
197
tags,
194
198
data,
199
+ createdAt,
200
+ updatedAt,
195
201
}
196
202
return noteProps
197
203
}
Original file line number Diff line number Diff line change 7
7
Attachment ,
8
8
FolderDocEditibleProps ,
9
9
NoteDocEditibleProps ,
10
+ NoteDocImportableProps ,
10
11
TagDocEditibleProps ,
11
12
TagDoc ,
12
13
PopulatedFolderDoc ,
@@ -257,7 +258,7 @@ class FSNoteDb implements NoteDb {
257
258
await unlinkFile ( attachmentPathname )
258
259
}
259
260
260
- async createNote ( noteProps : Partial < NoteDocEditibleProps > ) {
261
+ async createNote ( noteProps : Partial < NoteDocEditibleProps | NoteDocImportableProps > ) {
261
262
const now = getNow ( )
262
263
const noteDoc : NoteDoc = {
263
264
_id : generateNoteId ( ) ,
@@ -266,9 +267,9 @@ class FSNoteDb implements NoteDb {
266
267
tags : [ ] ,
267
268
folderPathname : '/' ,
268
269
data : { } ,
269
- ...noteProps ,
270
270
createdAt : now ,
271
271
updatedAt : now ,
272
+ ...noteProps ,
272
273
trashed : false ,
273
274
_rev : generateId ( ) ,
274
275
}
Original file line number Diff line number Diff line change 4
4
ObjectMap ,
5
5
NoteDoc ,
6
6
NoteDocEditibleProps ,
7
+ NoteDocImportableProps ,
7
8
PopulatedFolderDoc ,
8
9
PopulatedTagDoc ,
9
10
Attachment ,
@@ -262,7 +263,7 @@ export function createDbStoreCreator(
262
263
[ setStorageMap , syncStorage ]
263
264
)
264
265
const createNote = useCallback (
265
- async ( storageId : string , noteProps : Partial < NoteDocEditibleProps > ) => {
266
+ async ( storageId : string , noteProps : Partial < NoteDocEditibleProps | NoteDocImportableProps > ) => {
266
267
const storage = storageMap [ storageId ]
267
268
if ( storage == null ) {
268
269
return
Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ export type NoteDocEditibleProps = {
43
43
data : JsonObject
44
44
}
45
45
46
+ export type NoteDocImportableProps = {
47
+ createdAt : string
48
+ updatedAt : string
49
+ } & NoteDocEditibleProps
50
+
46
51
export type NoteDoc = {
47
52
_id : string
48
53
createdAt : string
You can’t perform that action at this time.
0 commit comments