Commit graph

1532 commits

Author SHA1 Message Date
Philip Molares
4ad7ad368c feat: add error-mapping
The ErrorExceptionMapping class maps internal error to nestjs's appropriate HttpException.
The object returned by those HttpExceptions is now changed to include the name of the intern error code and error message instead of statusCode and error message as is default. This makes it possible to more easily programmatically distinguish between two errors that map to the same HttpException and only differ in the error message.
The statusCode was unnecessary, because any user of the api gets this information already by which HttpException was used.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-02-07 00:08:41 +01:00
Philip Molares
451dedef15 refactor: getNoteByIdOrAlias throws NotInDBError instead of ForbiddenIdError for an id on the forbidden list
It's not really necessary to tell the user via get that this id is forbidden, it will not be there and as such NotInDBError is the correct message to the user

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-02-07 00:08:41 +01:00
Philip Molares
4500caf882 refactor: move error messages from controller to service
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-02-07 00:08:41 +01:00
Philip Molares
f672c5179f test: remove controller tests
These test files are only autogenerated and don't have any benefit. Any behaviour one would test with them are (or at least should) already be covered by our e2e tests.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-02-06 20:57:34 +01:00
Renovate Bot
d2db5a0cb8 chore(deps): update dependency mkdocs-material to v8.1.10
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-02-06 12:14:58 +00:00
Renovate Bot
4b34f94730 chore(deps): update dependency jest to v27.5.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-02-05 12:27:24 +01:00
Renovate Bot
39eab69c6c chore(deps): update dependency @types/node to v16.11.22
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-02-05 11:34:48 +01:00
Renovate Bot
c0f7178891 chore(deps): update linters to v5.10.2
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-02-05 11:34:25 +01:00
Renovate Bot
cde9a2f66a chore(deps): update dependency @trivago/prettier-plugin-sort-imports to v3.2.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-02-05 11:34:09 +01:00
Yannick Bungers
42ad99e20b Replace fs.rmdir recursive by fs.rm recursive
fs.rmdir(path, { recursive: true}) is deprecated and
is replaced by fs.rm(path, { recursive: true}).

Signed-off-by: Yannick Bungers <git@innay.de>
2022-01-31 08:55:42 +01:00
Renovate Bot
e4a9562455 chore(deps): lock file maintenance
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-01-31 02:19:21 +00:00
Philip Molares
2d8d29cf20 refactor(config): type config mocks
To minimize type errors, when the config objects are changed, this commit introduces types to the mock config object accordingly.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-01-30 22:19:50 +01:00
Philip Molares
6c82b95ea2 refactor(config): introduce new interface MediaBackendConfig
This interface is needed to help to use types in some cases, where it didn't work before.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-01-30 22:19:50 +01:00
Philip Molares
f4a580cf2a refactor(config): extract note config from app config
This commit separates the app config object from a new note config object. This was done to separate different concerns in different config files. Especially if the number of settings that are about notes increase, it is a good idea to keep them separate from the app config.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2022-01-30 22:19:50 +01:00
Renovate Bot
baa6606729 chore(deps): update dependency mkdocs-material to v8.1.9
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-01-30 11:20:21 +00:00
Renovate Bot
407bd27617 chore(deps): update dependency eslint-plugin-jest to v26
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-01-29 17:21:30 +01:00
Renovate Bot
84320f6203 fix(deps): update dependency @nestjs/swagger to v5.2.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-01-29 17:20:42 +01:00
Renovate Bot
d249263632 chore(deps): update dependency eslint to v8.8.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-01-29 17:20:13 +01:00
Renovate Bot
18b265cf09 fix(deps): update dependency joi to v17.6.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-01-29 17:13:18 +01:00
Renovate Bot
472452115d fix(deps): update dependency @types/minio to v7.0.12
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-01-29 05:35:47 +00:00
Renovate Bot
bb81873229 chore(deps): update linters to v5.10.1
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-01-29 03:58:46 +00:00
David Mehren
ac1cdc63e0 style(e2e-tests): remove unused imports
Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-27 21:05:17 +01:00
David Mehren
4499ad4d96 test(e2e/public/alias): code cleanup
Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-27 21:05:17 +01:00
David Mehren
54eefa9f6b feat(test-setup): create notes in withUsers
Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-27 21:05:17 +01:00
David Mehren
d1dbd1bb22 feat(test-setup): restructure to synchronous builder
The previous pattern used async methods for the builder pattern,
which were hideous to use when chained multiple times.

This extracts the builder into a separate class
and uses normal functions in the builder.
These queue async functions in arrays, which are executed
at the correct time, when the new async `build` function is called.

Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-27 21:05:17 +01:00
David Mehren
8f1aeab934 test(e2e/public/alias): test all error scenarios
Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-27 21:05:17 +01:00
David Mehren
64b136fb8b test(e2e/public/alias): use real authentication
Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-27 21:05:17 +01:00
David Mehren
28bd07597a test: create auth tokens in testSetup
Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-27 21:05:17 +01:00
David Mehren
ff500f1be0 test: allow disabling mocked authentication
This adds a (default true) parameter `withMockAuth` to the
TestSetup class.
If it is false, the TokenAuthGuard is not overridden with a mock
implementation, allowing to test with the real authentication.

Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-27 21:05:17 +01:00
David Mehren
bcb75a1d04 build(eslint): allow numbered agent objects
Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-27 21:05:17 +01:00
David Mehren
ae52f70ef9 test(e2e/private/alias): test all error scenarios
Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-27 21:05:17 +01:00
David Mehren
b2802d4c29 test(e2e/private/alias): use testSetup with users
Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-27 21:05:17 +01:00
David Mehren
2096e23e35 test: allow creating testSetup with users
Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-27 21:05:17 +01:00
David Mehren
8cfe4896bc test: cleanup test_uploads folders
Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-27 21:05:17 +01:00
Renovate Bot
90cc5b3f9f chore(deps): lock file maintenance
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-01-24 01:34:17 +00:00
David Mehren
8ea28bf1c7 ci(eslint): fail on warnings
Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-23 23:01:45 +01:00
David Mehren
bf743b4266 build(eslint): disable return type warnings in tests
Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-23 23:01:45 +01:00
David Mehren
898abc08f3 style: remove unused variables
Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-23 23:01:45 +01:00
David Mehren
91eba0d3af
Update mailmap and AUTHORS
Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-23 22:13:54 +01:00
Renovate Bot
d6ebc85ebf
chore(deps): update linters to v5.10.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-01-23 19:34:22 +00:00
Renovate Bot
aa61f7f987
fix(deps): update nestjs packages
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-01-23 19:33:55 +00:00
Renovate Bot
ba883c1ede
chore(deps): update dependency typescript to v4.5.5
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-01-23 19:33:38 +00:00
Renovate Bot
e4a906a525
chore(deps): update dependency supertest to v6.2.2
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-01-23 19:32:03 +00:00
Renovate Bot
886eac2b13
chore(deps): update dependency http-proxy-middleware to v2.0.2
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-01-23 19:31:43 +00:00
Renovate Bot
4b048cb62f
chore(deps): update dependency mkdocs-material to v8.1.8
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-01-23 19:31:48 +00:00
Renovate Bot
2706eff8ce
chore(deps): update dependency @types/node to v16.11.21
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2022-01-23 19:24:27 +00:00
David Mehren
7eba4bf83b
style(note-metadata): remove unused imports
Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-17 11:58:23 +01:00
David Mehren
08f97209ec
refactor(note-metadata): do not embed User objects
This is part of an effort to consistently not embed User objects
in API responses. Usernames are returned instead.

Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-16 22:54:53 +01:00
David Mehren
96ed5f3cc8
refactor(note-group-permission-update-dto): rename attribute groupName
For consistency with NoteGroupPermissionEntryDto

Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-16 22:46:46 +01:00
David Mehren
b40b2e164f
refactor(note-group-permission-entry-dto): do not embed Group objects
This is part of an effort to consistently not embed Group objects
in API responses. Names are returned instead.

Signed-off-by: David Mehren <git@herrmehren.de>
2022-01-16 22:45:27 +01:00