refactor: note editor relationships (#1821)

This commit is contained in:
Mo
2022-10-18 08:59:24 -05:00
committed by GitHub
parent c83dc48d3f
commit 2b66ff82ee
28 changed files with 357 additions and 299 deletions

View File

@@ -0,0 +1,29 @@
import { ContentType } from '@standardnotes/common'
import * as Models from '@standardnotes/models'
export const createNote = (payload?: Partial<Models.NoteContent>): Models.SNNote => {
return new Models.SNNote(
new Models.DecryptedPayload(
{
uuid: String(Math.random()),
content_type: ContentType.Note,
content: Models.FillItemContent({ ...payload }),
...Models.PayloadTimestampDefaults(),
},
Models.PayloadSource.Constructor,
),
)
}
export const createNoteWithTitle = (title: string) => {
return new Models.SNNote(
new Models.DecryptedPayload({
uuid: String(Math.random()),
content_type: ContentType.Note,
content: Models.FillItemContent<Models.NoteContent>({
title: title,
}),
...Models.PayloadTimestampDefaults(),
}),
)
}