add new module
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { IsNotEmpty, IsOptional, MaxLength } from 'class-validator';
|
||||
|
||||
@Injectable()
|
||||
export class CreatePostDto {
|
||||
@MaxLength(255, { always: true, message: 'the max length of content title is $constraint1' })
|
||||
@IsNotEmpty({ groups: ['create'], message: 'the title of content should not be empty' })
|
||||
@IsOptional({ groups: ['update'] })
|
||||
title: string;
|
||||
|
||||
@IsNotEmpty({ groups: ['create'], message: 'the body of content should not be empty' })
|
||||
@IsOptional({ groups: ['update'] })
|
||||
body: string;
|
||||
|
||||
@MaxLength(500, { always: true, message: 'the max length of content summary is $constraint1' })
|
||||
@IsOptional({ always: true })
|
||||
summary?: string;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { PartialType } from '@nestjs/swagger';
|
||||
|
||||
import { IsDefined, IsNumber } from 'class-validator';
|
||||
|
||||
import { CreatePostDto } from './create-post.dto';
|
||||
|
||||
@Injectable()
|
||||
export class UpdatePostDto extends PartialType(CreatePostDto) {
|
||||
@IsNumber(undefined, { groups: ['update'], message: 'The format of the post ID is incorrect.' })
|
||||
@IsDefined({ groups: ['update'], message: 'The post ID must be specified' })
|
||||
id: number;
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
export interface PostEntity {
|
||||
id: number;
|
||||
title: string;
|
||||
summary?: string;
|
||||
body: string;
|
||||
}
|
||||
Reference in New Issue
Block a user