diff --git a/src/notes/note-authorship.dto.ts b/src/notes/note-authorship.dto.ts new file mode 100644 index 000000000..9c9252da0 --- /dev/null +++ b/src/notes/note-authorship.dto.ts @@ -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; +} diff --git a/src/notes/note.dto.ts b/src/notes/note.dto.ts new file mode 100644 index 000000000..40b209644 --- /dev/null +++ b/src/notes/note.dto.ts @@ -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[]; +}