mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 17:55:17 -04:00
Correctly type nullable columns
TypeORM columns with `nullable: true` can be `null` at runtime. This commit ensures that the types of the corresponding properties reflect that. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
16ed12bfd7
commit
b93f01fe57
6 changed files with 14 additions and 14 deletions
|
@ -36,7 +36,7 @@ export class Note {
|
|||
unique: true,
|
||||
nullable: true,
|
||||
})
|
||||
alias?: string;
|
||||
alias: string | null;
|
||||
@OneToMany(
|
||||
(_) => NoteGroupPermission,
|
||||
(groupPermission) => groupPermission.note,
|
||||
|
@ -70,11 +70,11 @@ export class Note {
|
|||
@Column({
|
||||
nullable: true,
|
||||
})
|
||||
description?: string;
|
||||
description: string | null;
|
||||
@Column({
|
||||
nullable: true,
|
||||
})
|
||||
title?: string;
|
||||
title: string | null;
|
||||
|
||||
@ManyToMany((_) => Tag, (tag) => tag.notes, { eager: true, cascade: true })
|
||||
@JoinTable()
|
||||
|
|
|
@ -153,7 +153,7 @@ describe('NotesService', () => {
|
|||
expect(newNote.groupPermissions).toHaveLength(0);
|
||||
expect(newNote.tags).toHaveLength(0);
|
||||
expect(newNote.owner).toBeUndefined();
|
||||
expect(newNote.alias).toBeUndefined();
|
||||
expect(newNote.alias).toBeNull();
|
||||
});
|
||||
it('without alias, with owner', async () => {
|
||||
const newNote = await service.createNote(content, undefined, user);
|
||||
|
@ -166,7 +166,7 @@ describe('NotesService', () => {
|
|||
expect(newNote.groupPermissions).toHaveLength(0);
|
||||
expect(newNote.tags).toHaveLength(0);
|
||||
expect(newNote.owner).toEqual(user);
|
||||
expect(newNote.alias).toBeUndefined();
|
||||
expect(newNote.alias).toBeNull();
|
||||
});
|
||||
it('with alias, without owner', async () => {
|
||||
const newNote = await service.createNote(content, alias);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue