mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-19 01:35:18 -04:00
refactor(revision): make RevisionDto extend RevisionMetadataDto
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
3ea42fb048
commit
a9f27731bd
1 changed files with 3 additions and 30 deletions
|
@ -4,22 +4,12 @@
|
||||||
* SPDX-License-Identifier: AGPL-3.0-only
|
* SPDX-License-Identifier: AGPL-3.0-only
|
||||||
*/
|
*/
|
||||||
import { ApiProperty } from '@nestjs/swagger';
|
import { ApiProperty } from '@nestjs/swagger';
|
||||||
import { Type } from 'class-transformer';
|
import { IsString, ValidateNested } from 'class-validator';
|
||||||
import { IsDate, IsNumber, IsString, ValidateNested } from 'class-validator';
|
|
||||||
|
|
||||||
import { BaseDto } from '../utils/base.dto.';
|
|
||||||
import { EditDto } from './edit.dto';
|
import { EditDto } from './edit.dto';
|
||||||
import { Revision } from './revision.entity';
|
import { RevisionMetadataDto } from './revision-metadata.dto';
|
||||||
|
|
||||||
export class RevisionDto extends BaseDto {
|
|
||||||
/**
|
|
||||||
* ID of this revision
|
|
||||||
* @example 13
|
|
||||||
*/
|
|
||||||
@IsNumber()
|
|
||||||
@ApiProperty()
|
|
||||||
id: Revision['id'];
|
|
||||||
|
|
||||||
|
export class RevisionDto extends RevisionMetadataDto {
|
||||||
/**
|
/**
|
||||||
* Markdown content of the revision
|
* Markdown content of the revision
|
||||||
* @example "# I am a heading"
|
* @example "# I am a heading"
|
||||||
|
@ -28,14 +18,6 @@ export class RevisionDto extends BaseDto {
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
content: string;
|
content: string;
|
||||||
|
|
||||||
/**
|
|
||||||
* Number of characters in this revision
|
|
||||||
* @example 142
|
|
||||||
*/
|
|
||||||
@IsNumber()
|
|
||||||
@ApiProperty()
|
|
||||||
length: number;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Patch from the preceding revision to this one
|
* Patch from the preceding revision to this one
|
||||||
*/
|
*/
|
||||||
|
@ -43,15 +25,6 @@ export class RevisionDto extends BaseDto {
|
||||||
@ApiProperty()
|
@ApiProperty()
|
||||||
patch: string;
|
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.
|
* All edit objects which are used in the revision.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue