Jonas Zohren
8fbca1bf79
Source version from package.json
...
Signed-off-by: Jonas Zohren <jonas.zohren@adesso.de>
2020-10-09 22:40:45 +02:00
Yannick Bungers
feb42b6d63
Merge pull request #515 from codimd/coverage-for-e2e
...
Collect coverage information for E2E tests
2020-10-05 19:42:20 +02:00
Yannick Bungers
e158982490
Merge pull request #513 from codimd/fix/log-stacktrace
...
Fix stack trace logging
2020-10-03 18:31:39 +02:00
David Mehren
98e2bf106e
Collect coverage information for E2E tests
...
As proposed in https://github.com/nestjs/nest/issues/3169#issuecomment-588287478
Signed-off-by: David Mehren <git@herrmehren.de>
2020-10-03 18:00:12 +02:00
David Mehren
6af4379a27
NestConsoleLoggerService: Propagate trace
parameter to consoleLoggerService
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-10-03 15:54:00 +02:00
David Mehren
9786f07a61
Merge pull request #507 from codimd/routes/notes/plainBody
...
Routes/notes/plain body parsing
2020-10-02 21:43:07 +02:00
Yannick Bungers
258dd1db56
Added markdownbody-decorator
...
which puts the markdown text directly to a variable in the route function.
Content-type of the http request is checked to be text/markdown because we dealing with markdown. Technically by now there can be any content which can be encoded. There could be features in the software which do not work properly if the text can't be parsed as markdown.
Signed-off-by: Yannick Bungers <git@innay.de>
2020-10-02 21:31:10 +02:00
Yannick Bungers
0dec095ed7
Merge pull request #502 from codimd/custom-logger
...
Use custom logger
2020-10-02 21:05:06 +02:00
David Mehren
b299fa553e
Merge pull request #511 from codimd/docs/dev/public_api/fix
...
Fixes types of timestamps and property name
2020-10-02 19:10:21 +02:00
Yannick Bungers
e86898ce18
Fixes types of timestamps and property name
...
Signed-off-by: Yannick Bungers <git@innay.de>
2020-10-01 13:11:47 +02:00
David Mehren
bf2532f7c3
Merge pull request #504 from codimd/routes/user/tests
2020-09-27 21:56:44 +02:00
David Mehren
d7f407da2d
Switch to using the new custom logger
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-27 21:48:42 +02:00
David Mehren
1a2959f6dc
Add logger module and custom logger implementation
...
ConsoleLoggerService is based on the default Nest LoggerService, but adds the ability to give context about the function that is logging something. It also removes the `[Nest]` string and the PID at the beginning of each log line.
NestConsoleLoggerService is a wrapper around ConsoleLoggerService and makes it possible to use our implementation as a default Nest LoggerService
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-27 21:43:52 +02:00
Yannick Bungers
fe66add8e0
Changed let to const to make eslint happy
...
Signed-off-by: Yannick Bungers <git@innay.de>
2020-09-26 23:47:51 +02:00
Yannick Bungers
64a064f9b6
Added await to wait for completion of note creation in tests
...
Signed-off-by: Yannick Bungers <git@innay.de>
2020-09-26 23:40:15 +02:00
Yannick Bungers
bf1081bcf6
Added tests test functions for /me routes
...
Note that they don't contain the functions from the services yet.
Signed-off-by: Yannick Bungers <git@innay.de>
2020-09-26 23:30:49 +02:00
David Mehren
d07d8fe278
Merge pull request #500 from codimd/routes/notes/services
2020-09-26 18:03:42 +02:00
David Mehren
a0740ffdf7
NotesService: Add TODO that createNote
still needs to calculate a proper patch
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-26 16:01:01 +02:00
David Mehren
8fada8809c
UsersService: Merge if-statements and add null
to return type in toUserDto
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-26 16:00:17 +02:00
David Mehren
a028dac448
RevisionsService: Asynchronously inject NotesService to resolve circular dependency while testing
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:40 +02:00
David Mehren
2ce87f3d64
Add various missing imports and provider overrides to fix unit tests.
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:40 +02:00
David Mehren
b06dc5f967
Note E2E tests: Use response.body
to get the note content
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:40 +02:00
David Mehren
c5842d69e1
Note E2E tests: Use the correct revision-id when checking GET /notes/{note}/revisions/{revision-id}
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:40 +02:00
David Mehren
6e4893d179
NotesService: Implement getNoteContent
and getNoteMetdata
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:40 +02:00
David Mehren
8b9a45b738
NotesService: Let createNote
create an actual Note
and introduce createNoteDto
to create & convert in one step.
...
It might be handy to have access to the original `Note` after creating one, so the creation and conversion to a `NoteDto` is now split.
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
881263f2a4
RevisionsService: Get note revision from database
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
a3ba5bccf7
Note E2E tests: The response for the /notes/<id>/revision route does not contain a revisions
property
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
a98c4fbb1b
Note E2E tests: Await all note-creations and fix test for note-deletion.
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
51aec1ea54
RevisionService: Implement getNoteRevisionMetadatas
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
e1079947e1
NotesController: revisionId
is a number
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
4f5bb75766
Public API spec: Update NoteRevisionsMetadata and timestamp definition
...
NoteRevisionsMetadata is an array containing revision data and not an object with a single property containing an array.
Revision timestamps are ISO strings, not UNIX timestamps.
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
7c0e069cbf
RevisionMetadataDto: Rename attribute updatedAt
to createdAt
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
53cea4cb1d
Note E2E tests: Use on-disk sqlite to aid debugging
...
It was helpful to inspect database contents while the code was stopped by the debugger. Therefore the E2E test database is now persisted on disk and cleared before every test-run.
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
47bf8c9c17
NotesService: Use the database for delete and update actions.
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
e43008c627
NotesController: Get text from request body when updating and deleting a note.
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
99dccc0567
RevisionEntity: Change primary key type from UUID to number
...
The precision of sqlites datetime() timestamp is only one second (see https://www.sqlite.org/lang_datefunc.html ). Therefore we could not order revisions of one note that were created in the same second. To remedy this, the primary key was changed to a monotonically increasing number, which solves the ordering problem.
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
1a22f749be
NotesController: Get text from request body when creating a named note.
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
9da1a88e74
Note E2E tests: Set a non-JSON content-type to avoid Nest trying to parse markdown to JSON.
...
Nest automatically tries to parse incoming requests with application/json as content-type and responds with HTTP 400 if the parsing fails. As our test-note-content is not valid JSON, we need to set another content-type.
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
3436990ac6
Restructure test setup in Note E2E tests to not load the whole application
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
eb4278dd73
Update Note E2E tests to use new getNoteDtoByIdOrAlias
method
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
a2a9ad224f
NotesService: Find note by ID or alias in database
...
This commit also introduces the `getNoteDtoByIdOrAlias` method, that converts a `Note` entity to a `NoteDto`
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
e97f9fe174
NoteEntity: Lazy-load revisions
relation
...
Using a `Promise` type in a TypeORM entity automatically enables lazy-loading of that relation.
See https://typeorm.io/#/eager-and-lazy-relations/lazy-relations
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
74b03fc1fd
RevisionsService: Implement getLatestRevision
and createRevision
methods
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
fae8c679a9
UsersService: Add null
check to toUserDto()
converter
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
6805c2a41e
NotesService: Get more note metadata from the database
...
Some previously hardcoded metadata-values are now retrieved from the database.
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
e1e0e45434
UsersService: Add toUserDto()
converter
...
This conversion function makes sure that a photo URL exists.
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
f937042439
NoteUtils: Add methods to parse note metadata
...
These methods are intended to parse metadata details from YAML tags, but not implemented for now.
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:39 +02:00
David Mehren
f5e043b8b1
NoteEntity: Always initialize arrays
...
The `create()` function did not initialize all arrays, which caused them to be `undefined` instead of empty.
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:38 +02:00
David Mehren
5d07481387
RevisionEntity: Add create()
method
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:38 +02:00
David Mehren
2ab90917bc
NotesService: createNote()
now saves new notes to the database
...
Signed-off-by: David Mehren <git@herrmehren.de>
2020-09-25 21:37:38 +02:00