mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -04:00
refactor(note): lazy-load relations
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
d761ff7f4f
commit
235e4f647c
23 changed files with 343 additions and 284 deletions
10
src/seed.ts
10
src/seed.ts
|
@ -76,8 +76,8 @@ createConnection({
|
|||
const edit = Edit.create(author, 1, 42) as Edit;
|
||||
revision.edits = [edit];
|
||||
notes[i].revisions = Promise.all([revision]);
|
||||
notes[i].userPermissions = [];
|
||||
notes[i].groupPermissions = [];
|
||||
notes[i].userPermissions = Promise.resolve([]);
|
||||
notes[i].groupPermissions = Promise.resolve([]);
|
||||
user.ownedNotes = [notes[i]];
|
||||
await connection.manager.save([
|
||||
notes[i],
|
||||
|
@ -99,7 +99,7 @@ createConnection({
|
|||
throw new Error('Could not find freshly seeded notes. Aborting.');
|
||||
}
|
||||
for (const note of foundNotes) {
|
||||
if (!note.aliases[0]) {
|
||||
if (!(await note.aliases)[0]) {
|
||||
throw new Error(
|
||||
'Could not find alias of freshly seeded notes. Aborting.',
|
||||
);
|
||||
|
@ -111,7 +111,7 @@ createConnection({
|
|||
);
|
||||
}
|
||||
for (const note of foundNotes) {
|
||||
console.log(`Created Note '${note.aliases[0].name ?? ''}'`);
|
||||
console.log(`Created Note '${(await note.aliases)[0].name ?? ''}'`);
|
||||
}
|
||||
for (const user of foundUsers) {
|
||||
for (const note of foundNotes) {
|
||||
|
@ -119,7 +119,7 @@ createConnection({
|
|||
await connection.manager.save(historyEntry);
|
||||
console.log(
|
||||
`Created HistoryEntry for user '${user.username}' and note '${
|
||||
note.aliases[0].name ?? ''
|
||||
(await note.aliases)[0].name ?? ''
|
||||
}'`,
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue