mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-01 23:58:58 -04:00
refactor(user): lazy-load relations
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
16c9d6c011
commit
3539216cf3
4 changed files with 17 additions and 17 deletions
|
@ -53,25 +53,25 @@ export class User {
|
|||
email: string | null;
|
||||
|
||||
@OneToMany((_) => Note, (note) => note.owner)
|
||||
ownedNotes: Note[];
|
||||
ownedNotes: Promise<Note[]>;
|
||||
|
||||
@OneToMany((_) => AuthToken, (authToken) => authToken.user)
|
||||
authTokens: AuthToken[];
|
||||
authTokens: Promise<AuthToken[]>;
|
||||
|
||||
@OneToMany((_) => Identity, (identity) => identity.user)
|
||||
identities: Promise<Identity[]>;
|
||||
|
||||
@ManyToMany((_) => Group, (group) => group.members)
|
||||
groups: Group[];
|
||||
groups: Promise<Group[]>;
|
||||
|
||||
@OneToMany((_) => HistoryEntry, (historyEntry) => historyEntry.user)
|
||||
historyEntries: HistoryEntry[];
|
||||
historyEntries: Promise<HistoryEntry[]>;
|
||||
|
||||
@OneToMany((_) => MediaUpload, (mediaUpload) => mediaUpload.user)
|
||||
mediaUploads: MediaUpload[];
|
||||
mediaUploads: Promise<MediaUpload[]>;
|
||||
|
||||
@OneToMany(() => Author, (author) => author.user)
|
||||
authors: Author[];
|
||||
authors: Promise<Author[]>;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
||||
private constructor() {}
|
||||
|
@ -85,13 +85,13 @@ export class User {
|
|||
newUser.displayName = displayName;
|
||||
newUser.photo = null;
|
||||
newUser.email = null;
|
||||
newUser.ownedNotes = [];
|
||||
newUser.authTokens = [];
|
||||
newUser.ownedNotes = Promise.resolve([]);
|
||||
newUser.authTokens = Promise.resolve([]);
|
||||
newUser.identities = Promise.resolve([]);
|
||||
newUser.groups = [];
|
||||
newUser.historyEntries = [];
|
||||
newUser.mediaUploads = [];
|
||||
newUser.authors = [];
|
||||
newUser.groups = Promise.resolve([]);
|
||||
newUser.historyEntries = Promise.resolve([]);
|
||||
newUser.mediaUploads = Promise.resolve([]);
|
||||
newUser.authors = Promise.resolve([]);
|
||||
return newUser;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue