Commit graph

1041 commits

Author SHA1 Message Date
David Mehren
f6d430c23f
Adjust tests to new Session and Author entities
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-17 22:28:35 +02:00
David Mehren
3d07c5e443
AuthorshipEntity: Adjust to DB schema
This commit replaces the user property with a author property,
in accordance with the DB schema updated in 0d6c3002.

It also adjusts the NoteService accordingly.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-19 22:12:25 +02:00
David Mehren
8040f47d00
Add Author property to Session & User
The DB schema was updated in 0d6c3002,
this adds the new author property to
the Session and User entities.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-31 18:39:33 +02:00
David Mehren
1dc6db24a9
AuthorEntity: Add create method
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-19 22:12:00 +02:00
David Mehren
4e14053f8f
AuthorEntity: Add missing properties
This adds the missing properties according to the DB PlantUML schema

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-31 18:11:48 +02:00
David Mehren
59a4c72299
UsersModule: Add Session to TypeORM module
This seems to have been missed in
db026d6a57, where the Session entity
was added.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-31 18:15:10 +02:00
David Mehren
283ec673cf
Remove AuthorColor entity
It will be replaced with the Author entity,
that will save the color

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-17 21:08:13 +02:00
David Mehren
fddb7e8c8c
Allow anonymous user colors in DB schema
Every authorship now has an author that saves the color.
The author links to the session and optionally the user.
For anonymous users, the session now can be used to reidentify the user.
 If the user is logged-in, the userId is saved into the author table.
 This allows to identify the user even after the session expired.

 A note created by an anonymous user does not have an owner.
 The cardinality was updated to reflect that.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 18:07:06 +02:00
Renovate Bot
4205856b41
chore(deps): update linters
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-31 17:49:08 +00:00
Sheogorath
3672a42fc0
Fix link is SECURITY.md
Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
2021-05-27 15:18:09 +02:00
David Mehren
9e5d95657d
Move publicID creation to Note.create
Before this commit, `Note.create()` did not return a complete object,
as the `publicId` property was missing.
This adds the generation of the property to the `create` method and
moves the actual generation code from the `NotesService`
to a utility method.

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-19 21:19:08 +02:00
Renovate Bot
0aa27e01b0
chore(deps): update dependency mkdocs-material to v7.1.5
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-19 09:14:00 +00:00
Philip Molares
0f58757858
chore(test): Change test to work with publicId
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-05-16 22:46:02 +02:00
Philip Molares
b7e52f8166
feat(notes): Use publicId in notes service
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-05-16 22:44:43 +02:00
Philip Molares
e1ac2cfa69
chore(dependency): Add base32-encode
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-05-17 07:59:51 +02:00
Philip Molares
ce132f2432
feat(note): Add publicId field
This field is a randomly generated 128-bit value encoded with base32-encode using the crockford variant and converted to lowercase.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-05-16 22:43:42 +02:00
Philip Molares
92066d0746
chore(plantuml): Add publicId to note
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-05-16 22:54:45 +02:00
Philip Molares
875e848b80
refactor: Remove randomString function
This was done because it was only a wrapper for a nodejs function to check if the given parameter is a positive number.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-05-16 22:41:01 +02:00
Renovate Bot
69a2a24511
Update linters to v4.24.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-17 17:58:33 +00:00
Renovate Bot
942abfdc3d
Lock file maintenance
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-17 02:45:24 +00:00
Thomas Snowden
7087135ea4
Add API decorator to reduce clutter
Signed-off-by: Thomas Snowden <zapperchamp1@gmail.com>
2021-04-24 19:10:16 -04:00
David Mehren
eaf1852fe5
Format with Prettier 2.3
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-15 21:13:44 +02:00
Renovate Bot
6658f0d5b4
Update dependency prettier to v2.3.0
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-15 19:06:39 +00:00
Renovate Bot
52d58f2d7e
Lock file maintenance
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-15 20:10:29 +00:00
Renovate Bot
b965d62dc6
Update linters
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-15 19:06:53 +00:00
Renovate Bot
d0d211e7ad
Update dependency rxjs to v7.0.1
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-13 21:31:38 +00:00
Renovate Bot
1b949fce99
Update dependency @types/node to v13.13.52
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-12 20:40:04 +00:00
Philip Molares
f739687b00
Refactor(note): Remove shortid from note
This is a 1.x relict and isn't used anymore in 2.x. All 1.x shortids will be converted to aliases on migration of 1.x to 2.x.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-05-11 22:37:52 +02:00
Philip Molares
f5039791ed
Linting: Fixed wrong logger contexts
Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-05-02 21:53:28 +02:00
Philip Molares
8cc9e12bc3
ESLint: Add custom rule 'correct-logger-context'
This rule ensures, that the correct context is given in any logger statements.

Signed-off-by: Philip Molares <philip.molares@udo.edu>
2021-05-02 19:45:47 +02:00
David Mehren
375cb4eae9
AuthTokenEntity: Make validUntil not nullable
As all tokens are valid for a maximum of 2 years, the
validUntil attribute is always populated.

This updates the database schema and the DTO to reflect that.

Fixes #1256

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 22:05:47 +02:00
David Mehren
6ddaa59e8c
Remove superfluous overrideProvider statements
Fixes #1254

Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-09 21:34:43 +02:00
Renovate Bot
6319b69aee
Update dependency @types/bcrypt to v5
Signed-off-by: Renovate Bot <bot@renovateapp.com>
2021-05-09 19:42:04 +00:00
David Mehren
076c9c502d
Add error handling in seed.ts
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-02 18:35:38 +02:00
David Mehren
6471ba92ef
Fix nullable property types in Note DTOs
Signed-off-by: David Mehren <git@herrmehren.de>
2021-05-02 18:33:07 +02:00
David Mehren
73997d4693
MediaUploadDto: Make noteId optional
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 16:59:40 +02:00
David Mehren
2e5d40432e
E2E Tests: Fix ESLint errors
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 22:06:45 +02:00
David Mehren
d4495a0a62
GroupsService: Remove test obsoleted by strict mode
Signed-off-by: David Mehren <git@herrmehren.de>
2021-04-29 21:53:05 +02:00
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