refactor(revision): make RevisionDto extend RevisionMetadataDto

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2022-02-13 19:39:05 +01:00
parent 3ea42fb048
commit a9f27731bd

View file

@ -4,22 +4,12 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { ApiProperty } from '@nestjs/swagger';
import { Type } from 'class-transformer';
import { IsDate, IsNumber, IsString, ValidateNested } from 'class-validator';
import { IsString, ValidateNested } from 'class-validator';
import { BaseDto } from '../utils/base.dto.';
import { EditDto } from './edit.dto';
import { Revision } from './revision.entity';
export class RevisionDto extends BaseDto {
/**
* ID of this revision
* @example 13
*/
@IsNumber()
@ApiProperty()
id: Revision['id'];
import { RevisionMetadataDto } from './revision-metadata.dto';
export class RevisionDto extends RevisionMetadataDto {
/**
* Markdown content of the revision
* @example "# I am a heading"
@ -28,14 +18,6 @@ export class RevisionDto extends BaseDto {
@ApiProperty()
content: string;
/**
* Number of characters in this revision
* @example 142
*/
@IsNumber()
@ApiProperty()
length: number;
/**
* Patch from the preceding revision to this one
*/
@ -43,15 +25,6 @@ export class RevisionDto extends BaseDto {
@ApiProperty()
patch: string;
/**
* Datestring of the time this revision was created
* @example "2020-12-01 12:23:34"
*/
@IsDate()
@Type(() => Date)
@ApiProperty()
createdAt: Date;
/**
* All edit objects which are used in the revision.
*/