refactor(alias): lazy-load relations

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-11-18 18:53:39 +01:00
parent 296d73c121
commit d761ff7f4f
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

View file

@ -49,7 +49,7 @@ export class Alias {
@ManyToOne((_) => Note, (note) => note.aliases, {
onDelete: 'CASCADE', // This deletes the Alias, when the associated Note is deleted
})
note: Note;
note: Promise<Note>;
// eslint-disable-next-line @typescript-eslint/no-empty-function
private constructor() {}
@ -58,7 +58,7 @@ export class Alias {
const alias = new Alias();
alias.name = name;
alias.primary = primary;
alias.note = note;
alias.note = Promise.resolve(note);
return alias;
}
}