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