diff --git a/packages/backend/src/models/entities/note.ts b/packages/backend/src/models/entities/note.ts index a31dd7dd46..613fb7b11a 100644 --- a/packages/backend/src/models/entities/note.ts +++ b/packages/backend/src/models/entities/note.ts @@ -296,7 +296,7 @@ export class Note { nullable: true, comment: "The updated date of the Note.", }) - public updatedAt: Date; + public updatedAt: Date | null; //#endregion constructor(data: Partial) { diff --git a/packages/backend/src/server/api/endpoints/notes/edit.ts b/packages/backend/src/server/api/endpoints/notes/edit.ts index f8a7a626b7..6a699ee25c 100644 --- a/packages/backend/src/server/api/endpoints/notes/edit.ts +++ b/packages/backend/src/server/api/endpoints/notes/edit.ts @@ -606,13 +606,13 @@ export default define(meta, paramDef, async (ps, user) => { update.updatedAt = new Date(); await Notes.update(note.id, update); - // Add NoteEdit history + // Add NoteEdit history for the previous one await NoteEdits.insert({ id: genId(), noteId: note.id, - text: ps.text || undefined, - cw: ps.cw, - fileIds: ps.fileIds, + text: note.text || undefined, + cw: note.cw, + fileIds: note.fileIds, updatedAt: new Date(), });