mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 01:35:18 -04:00
refactor(backend): fix nestjs-typed linting errors
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
8daffbb11b
commit
a5d8c9cc33
16 changed files with 60 additions and 20 deletions
|
@ -16,6 +16,8 @@ export class EditDto extends BaseDto {
|
|||
* Is `null` if the user is anonymous
|
||||
* @example "john.smith"
|
||||
*/
|
||||
// nestjs-typed does not detect '| null' types as optional
|
||||
// eslint-disable-next-line @darraghor/nestjs-typed/api-property-matches-property-optionality
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
@ApiPropertyOptional()
|
||||
|
|
|
@ -15,6 +15,7 @@ export class RevisionMetadataDto extends BaseDto {
|
|||
* ID of this revision
|
||||
* @example 13
|
||||
*/
|
||||
@Type(() => Number)
|
||||
@IsNumber()
|
||||
@ApiProperty()
|
||||
id: Revision['id'];
|
||||
|
@ -41,7 +42,7 @@ export class RevisionMetadataDto extends BaseDto {
|
|||
* Does not include anonymous users
|
||||
*/
|
||||
@IsString()
|
||||
@ApiProperty()
|
||||
@ApiProperty({ isArray: true, type: String })
|
||||
authorUsernames: string[];
|
||||
|
||||
/**
|
||||
|
@ -75,6 +76,6 @@ export class RevisionMetadataDto extends BaseDto {
|
|||
*/
|
||||
@IsArray()
|
||||
@IsString({ each: true })
|
||||
@ApiProperty()
|
||||
@ApiProperty({ isArray: true, type: String })
|
||||
tags: string[];
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { ApiProperty } from '@nestjs/swagger';
|
||||
import { Type } from 'class-transformer';
|
||||
import { IsString, ValidateNested } from 'class-validator';
|
||||
|
||||
import { EditDto } from './edit.dto';
|
||||
|
@ -28,7 +29,8 @@ export class RevisionDto extends RevisionMetadataDto {
|
|||
/**
|
||||
* All edit objects which are used in the revision.
|
||||
*/
|
||||
@ValidateNested()
|
||||
@ApiProperty()
|
||||
@Type(() => EditDto)
|
||||
@ValidateNested({ each: true })
|
||||
@ApiProperty({ isArray: true, type: EditDto })
|
||||
edits: EditDto[];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue