mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -04:00
feat: consolidate entities create
This was done to give better typings to the function signatures of entities `create` methods. It also ensures that each field that should be set to `null` is set to `null` and doesn't leave that up to the typeorm handlers. See: #1641 Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
bd902e50d1
commit
d0b8e4cd36
14 changed files with 89 additions and 40 deletions
11
src/seed.ts
11
src/seed.ts
|
@ -57,9 +57,9 @@ createConnection({
|
|||
users.push(User.create('hardcoded_2', 'Test User 2'));
|
||||
users.push(User.create('hardcoded_3', 'Test User 3'));
|
||||
const notes: Note[] = [];
|
||||
notes.push(Note.create(undefined, 'test'));
|
||||
notes.push(Note.create(undefined, 'test2'));
|
||||
notes.push(Note.create(undefined, 'test3'));
|
||||
notes.push(Note.create(undefined, 'test') as Note);
|
||||
notes.push(Note.create(undefined, 'test2') as Note);
|
||||
notes.push(Note.create(undefined, 'test3') as Note);
|
||||
|
||||
for (let i = 0; i < 3; i++) {
|
||||
const author = connection.manager.create(Author, Author.create(1));
|
||||
|
@ -71,8 +71,9 @@ createConnection({
|
|||
const revision = Revision.create(
|
||||
'This is a test note',
|
||||
'This is a test note',
|
||||
);
|
||||
const edit = Edit.create(author, 1, 42);
|
||||
notes[i],
|
||||
) as Revision;
|
||||
const edit = Edit.create(author, 1, 42) as Edit;
|
||||
revision.edits = [edit];
|
||||
notes[i].revisions = Promise.all([revision]);
|
||||
notes[i].userPermissions = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue