diff --git a/src/api/utils/markdownbody-decorator.ts b/src/api/utils/markdownbody-decorator.ts index 9ab99b948..289367ffd 100644 --- a/src/api/utils/markdownbody-decorator.ts +++ b/src/api/utils/markdownbody-decorator.ts @@ -17,21 +17,24 @@ import * as getRawBody from 'raw-body'; * * Implementation inspired by https://stackoverflow.com/questions/52283713/how-do-i-pass-plain-text-as-my-request-body-using-nestjs */ -export const MarkdownBody = createParamDecorator(async (_, context: ExecutionContext) => { - // we have to check req.readable because of raw-body issue #57 - // https://github.com/stream-utils/raw-body/issues/57 - const req = context.switchToHttp().getRequest(); - // Here the 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. - if (req.get('Content-Type') === 'text/markdown') { - if (req.readable) { - return (await getRawBody(req)).toString().trim(); +export const MarkdownBody = createParamDecorator( + async (_, context: ExecutionContext) => { + // we have to check req.readable because of raw-body issue #57 + // https://github.com/stream-utils/raw-body/issues/57 + const req = context.switchToHttp().getRequest(); + // Here the 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. + if (req.get('Content-Type') === 'text/markdown') { + if (req.readable) { + return (await getRawBody(req)).toString().trim(); + } else { + throw new InternalServerErrorException('Failed to parse request body!'); + } } else { - throw new InternalServerErrorException('Failed to parse request body!'); + throw new BadRequestException( + 'Body Content-Type has to be text/markdown!', + ); } - } else { - throw new BadRequestException('Body Content-Type has to be text/markdown!'); - } - -}); + }, +); diff --git a/src/monitoring/monitoring.service.ts b/src/monitoring/monitoring.service.ts index 97b6ede1c..597e8bb79 100644 --- a/src/monitoring/monitoring.service.ts +++ b/src/monitoring/monitoring.service.ts @@ -25,7 +25,7 @@ async function getServerVersionFromPackageJson() { const packageInfo: { version: string } = JSON.parse(rawFileContent); const versionParts: number[] = packageInfo.version .split('.') - .map((x) => parseInt(x, 10)); + .map(x => parseInt(x, 10)); versionCache = { major: versionParts[0], minor: versionParts[1], diff --git a/src/revisions/authorship.entity.ts b/src/revisions/authorship.entity.ts index 1bd8d1591..9ac5aa874 100644 --- a/src/revisions/authorship.entity.ts +++ b/src/revisions/authorship.entity.ts @@ -5,11 +5,13 @@ */ import { - Column, CreateDateColumn, + Column, + CreateDateColumn, Entity, ManyToMany, ManyToOne, - PrimaryGeneratedColumn, UpdateDateColumn, + PrimaryGeneratedColumn, + UpdateDateColumn, } from 'typeorm/index'; import { User } from '../users/user.entity'; import { Revision } from './revision.entity'; @@ -38,14 +40,14 @@ export class Authorship { user: User; @Column() - startPos: number + startPos: number; @Column() - endPos: number + endPos: number; @CreateDateColumn() - createdAt: Date + createdAt: Date; @UpdateDateColumn() - updatedAt: Date + updatedAt: Date; } diff --git a/test/public-api/users.e2e-spec.ts b/test/public-api/users.e2e-spec.ts index 9c5f2e18d..495f58e12 100644 --- a/test/public-api/users.e2e-spec.ts +++ b/test/public-api/users.e2e-spec.ts @@ -124,7 +124,6 @@ describe('Notes', () => { expect(historyEntry.pinStatus).toEqual(true); }); - it.skip(`GET /me/notes/`, async () => { // TODO use function from HistoryService to add an History Entry await notesService.createNote('This is a test note.', 'test7');