Commit graph

6412 commits

Author SHA1 Message Date
David Mehren
8388edcd53
UsersService: Remove test obsoleted by strict mode
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 21:52:20 +02:00
David Mehren
0944f07834
Ensure optional properties of AuthTokenDto are initialized
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 21:14:09 +02:00
David Mehren
098ebd0445
Disable strict mode for tests
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 19:09:15 +02:00
David Mehren
246d053b68
Add explicit type annotations to nullable columns
TypeORM can't correctly infer the data type on properties with a `| null` type.
This commit adds explicit type annotations.

See also https://github.com/typeorm/typeorm/issues/2567#issuecomment-408599335

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 19:08:59 +02:00
David Mehren
80d8ce901b
NotesService.toNoteMetadataDto: Handle undefined updateUser
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 18:30:48 +02:00
David Mehren
772263317d
NotesService: Fix type errors
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 18:30:17 +02:00
David Mehren
e217b30d26
Consistently type properties as optional
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 18:29:12 +02:00
David Mehren
bc08493f89
GroupsService: Remove null from toGroupDto return type
toGroupDto won't return null, as TS's strict mode
prevents group from being nullish

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 18:28:32 +02:00
David Mehren
b962e8390a
NotesController: Double-check that req.user is defined
TokenAuthGuard ensures that req.user is always
defined, but thanks to strict mode we have to check again.

In the future, we may add a custom Request type and
a custom param decorator to centralize the check.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 18:12:20 +02:00
David Mehren
0a8dd454ab
NoteEntity: Allow anonymous notes
Notes created by anonymous users don't have an owner.
This commit updates the entity accordingly.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 18:09:22 +02:00
David Mehren
bd56d17663
MediaUploadDto: Make noteId optional
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 16:59:40 +02:00
David Mehren
3b0bbe8b00
MediaService: Handle unexpected backend type
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 16:59:18 +02:00
David Mehren
22702b3390
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>
2021-04-29 16:54:57 +02:00
David Mehren
d63f581a42
MediaController: Double-check that req.user is defined
TokenAuthGuard ensures that req.user is always
defined, but thanks to strict mode we have to check again.

In the future, we may add a custom Request type and
a custom param decorator to centralize the check.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 16:44:27 +02:00
David Mehren
90038cf116
MeController: Double-check that req.user is defined
TokenAuthGuard ensures that req.user is always
defined, but thanks to strict mode we have to check again.

In the future, we may add a custom Request type and
a custom param decorator to centralize the check.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 16:43:16 +02:00
David Mehren
87eb099d34
UsersService: Remove null from toUserDto return type
toUserDto won't return null, as TS's strict mode
prevents user from being nullish

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 16:40:13 +02:00
David Mehren
a453344205
MarkdownBody: Handle error in getOwnPropertyDescriptor
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 16:27:15 +02:00
David Mehren
4959be739a
Handle config initialisation error on app bootstrap
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 16:22:01 +02:00
David Mehren
8357f3072c
HistoryService: Throw NotInDBError on empty DB result
This adds error handling to getEntryByNote, so it throws a
NotInDBError instead of (illegally, according to the type) returning
null.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 16:16:30 +02:00
David Mehren
1a72e3c727
FrontendConfig DTOs: Make properties consistently optional
Some properties already have a IsOptional decorator,
this makes the properties themselves also optional

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 16:13:54 +02:00
David Mehren
56ce66bc8b
ConsoleLoggerService: Fix type of context properties
Nullish values of functionContext and classContext are handled correctly,
so the type can be adjusted

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 16:10:46 +02:00
David Mehren
52bb44a561
AuthService: Fix type of toAuthTokenWithSecretDto
toAuthTokenDto does not return nor accept a nullish value anymore,
so the types can be adjusted.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 16:07:58 +02:00
David Mehren
327f36af94
AuthService.randomString: Throw Error instead of returning null
A string with a negative length is invalid, so we should throw here
instead of complicating the type with a possible null return value.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 16:06:59 +02:00
David Mehren
5ee9b2a7e8
AuthTokenDto: Make properties consistently optional
validUntil and lastUsed already have a IsOptional decorator,
this makes the properties themselves also optional

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 15:55:11 +02:00
David Mehren
ef8b8d985e
AuthService: Throw NotInDBError on empty DB result
This adds error handling to various functions, so they throw a
NotInDBError instead of a TypeError

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 18:27:03 +02:00
David Mehren
52f6310e91
Safely parse numbers from environment vars
This adds the function parseOptionalInt to help parse numbers
from environment variables

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 15:34:59 +02:00
David Mehren
36e721d4a9
Config Utils: Fix type of toArrayConfig
configValue is checked for a nullish value,
the type should reflect that.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 15:26:15 +02:00
David Mehren
dcc09747d2
AuthService: Remove null from toAuthTokenDto return type
toAuthTokenDto won't return null, as TS's strict mode
prevents authToken from being nullish

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 15:07:50 +02:00
David Mehren
d87980ae6d
RevisionsService: Throw NotInDBError on empty DB result
This adds error handling to various getters, so they throw a
NotInDBError instead of (illegally, according to the type) returning
null.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 15:03:44 +02:00
David Mehren
6604a6e499
Enable TypeScript strict mode
This enables strict mode, but sets strictPropertyInitialization to false,
as "the class-validator DTO pattern described in the documentation is
not compatible with strict property initialization" according to
https://github.com/nestjs/typescript-starter/pull/192

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 15:01:00 +02:00
Renovate Bot
b2f0bfa0bf
Update dependency eslint to v7.26.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-09 12:41:30 +00:00
Renovate Bot
618ab0dc9b
Update dependency ts-loader to v9.1.2
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-09 12:41:15 +00:00
Renovate Bot
0e698f6aad
Update dependency pymdown-extensions to v8.2
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-08 19:43:43 +00:00
Renovate Bot
ad8a6d0ebc
Update dependency mkdocs-material to v7.1.4
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-07 09:51:32 +00:00
Renovate Bot
8c0554d40e
Update linters to v4.22.1
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-05 20:27:14 +00:00
Renovate Bot
a6d7fc2c30
Update dependency file-type to v16.4.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-05 20:26:59 +00:00
Renovate Bot
d0f787e3c2
Update dependency ts-jest to v26.5.6
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-05 16:10:56 +00:00
Renovate Bot
c2645472f0
Lock file maintenance
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-03 01:12:21 +00:00
Renovate Bot
2fcd4c141e Update dependency katex to v0.13.3
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-24 23:33:35 +02:00
Erik Michelson
003658dc4d
The History PR: II - Add URL params (#1157)
* Add location state dependency

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Split toolbar state into single location states

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Add CHANGELOG entry

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Pin dependency

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Use react state for view because of side-effects

The locationState was resetted on each search or tags filter update because these updates pushed a change to the location thus resulting in loss of the location state for the view.

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Remove unneeded import

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Change CHANGELOG entry

Signed-off-by: Erik Michelson <github@erik.michelson.eu>

* Removed unnecessary typecast

Signed-off-by: Erik Michelson <github@erik.michelson.eu>
2021-04-24 23:25:01 +02:00
Renovate Bot
d6eabae1b1 Update dependency codemirror to v5.61.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-24 22:03:34 +02:00
Renovate Bot
78497fc4c0 Update dependency abcjs to v6.0.0-beta.33
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-04-24 22:03:06 +02:00
renovate[bot]
94ff43cdf6
Update dependency ts-loader to v9 (#1211)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-04-24 19:38:36 +02:00
renovate[bot]
9346aa4ad7
Update dependency react-use to v17.2.4 (#1208)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-04-24 19:24:54 +02:00
renovate[bot]
d397ad67a0
Update jest (#1210)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-04-24 19:20:33 +02:00
renovate[bot]
d6659f4601
Update dependency eslint-plugin-flowtype to v5.7.2 (#1207)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-04-24 19:18:27 +02:00
renovate[bot]
9b87a7a0fb
Update definitely typed (#1204)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-04-24 15:32:05 +02:00
Erik Michelson
8e5a667d18
The History PR: I - Move to redux (#1156) 2021-04-22 22:46:24 +02:00
Philip Molares
bba2b207c4
TablePicker: Change table cells in picker (#1202)
- Fix error that the border of table cells was invisible in dark mode
- Add margin to table cells
- Add full border to table cells
- Change border-color while hovering over table cells

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-04-22 12:55:51 +02:00
renovate[bot]
9d8ce946e8
Lock file maintenance (#1200)
Signed-off-by: Renovate Bot <bot@renovateapp.com>

Co-authored-by: Renovate Bot <bot@renovateapp.com>
2021-04-19 13:25:50 +02:00