From a3d67b58ed79184abd0381ed73e4a434ee63163e Mon Sep 17 00:00:00 2001 From: Hazel K Date: Sun, 29 Sep 2024 21:52:57 -0400 Subject: [PATCH] add copy constructor to LatestNote --- packages/backend/src/models/LatestNote.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/backend/src/models/LatestNote.ts b/packages/backend/src/models/LatestNote.ts index 9d56b82620..07aee73e03 100644 --- a/packages/backend/src/models/LatestNote.ts +++ b/packages/backend/src/models/LatestNote.ts @@ -34,4 +34,13 @@ export class LatestNote { }) @JoinColumn() public note: MiNote | null; + + + constructor(data: Partial) { + if (data == null) return; + + for (const [k, v] of Object.entries(data)) { + (this as any)[k] = v; + } + } }