mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-12-30 22:20:48 +00:00
Add DTOs for notes and note authorship
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
5ce8a532a8
commit
d7fe7a95c7
2 changed files with 32 additions and 0 deletions
17
src/notes/note-authorship.dto.ts
Normal file
17
src/notes/note-authorship.dto.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import { IsDate, IsNumber, IsString, Min } from 'class-validator';
|
||||
import { UserInfoDto } from '../users/user-info.dto';
|
||||
|
||||
export class NoteAuthorshipDto {
|
||||
@IsString()
|
||||
userName: UserInfoDto['userName'];
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
startPos: number;
|
||||
@IsNumber()
|
||||
@Min(0)
|
||||
endPos: number;
|
||||
@IsDate()
|
||||
createdAt: Date;
|
||||
@IsDate()
|
||||
updatedAt: Date;
|
||||
}
|
15
src/notes/note.dto.ts
Normal file
15
src/notes/note.dto.ts
Normal file
|
@ -0,0 +1,15 @@
|
|||
import { IsArray, IsString, ValidateNested } from 'class-validator';
|
||||
import { NoteAuthorshipDto } from './note-authorship.dto';
|
||||
import { NoteMetadataDto } from './note-metadata.dto';
|
||||
|
||||
export class NoteDto {
|
||||
@IsString()
|
||||
content: string;
|
||||
|
||||
@ValidateNested()
|
||||
metdata: NoteMetadataDto;
|
||||
|
||||
@IsArray()
|
||||
@ValidateNested({ each: true })
|
||||
editedByAtPosition: NoteAuthorshipDto[];
|
||||
}
|
Loading…
Reference in a new issue