add test case
This commit is contained in:
parent
c283df576b
commit
e26cb841fc
@ -72,6 +72,10 @@ export class CreateCategoryDto {
|
||||
|
||||
@DtoValidation({ groups: ['update'] })
|
||||
export class UpdateCategoryDto extends PartialType(CreateCategoryDto) {
|
||||
@IsDataExist(CategoryEntity, {
|
||||
groups: ['update'],
|
||||
message: 'category id not exist when update',
|
||||
})
|
||||
@IsUUID(undefined, { message: 'The ID format is incorrect', groups: ['update'] })
|
||||
@IsDefined({ groups: ['update'], message: 'The ID must be specified' })
|
||||
id: string;
|
||||
|
@ -22,7 +22,7 @@ import { toBoolean } from '@/modules/core/helpers';
|
||||
import { IsDataExist } from '@/modules/database/constraints/data.exist.constraint';
|
||||
import { PaginateOptions } from '@/modules/database/types';
|
||||
|
||||
import { CategoryEntity, TagEntity } from '../entities';
|
||||
import { CategoryEntity, PostEntity, TagEntity } from '../entities';
|
||||
|
||||
@DtoValidation({ type: 'query' })
|
||||
export class QueryPostDto implements PaginateOptions {
|
||||
@ -129,5 +129,6 @@ export class UpdatePostDto extends PartialType(CreatePostDto) {
|
||||
message: 'The format of the article ID is incorrect.',
|
||||
})
|
||||
@IsDefined({ groups: ['update'], message: 'The article ID must be specified' })
|
||||
@IsDataExist(PostEntity, { groups: ['update'], message: 'post id not exist when update' })
|
||||
id: string;
|
||||
}
|
||||
|
@ -11,9 +11,10 @@ import {
|
||||
} from 'class-validator';
|
||||
import { toNumber } from 'lodash';
|
||||
|
||||
import { DtoValidation } from '@/modules/core/decorator/dto.validation.decorator';
|
||||
import { IsDataExist } from '@/modules/database/constraints';
|
||||
import { IsUnique } from '@/modules/database/constraints/unique.constraint';
|
||||
import { IsUniqueExist } from '@/modules/database/constraints/unique.exist.constraint';
|
||||
import { DtoValidation } from '@/modules/core/decorator/dto.validation.decorator';
|
||||
import { PaginateOptions } from '@/modules/database/types';
|
||||
|
||||
import { TagEntity } from '../entities';
|
||||
@ -55,6 +56,7 @@ export class CreateTagDto {
|
||||
|
||||
@DtoValidation({ groups: ['update'] })
|
||||
export class UpdateTagDto extends PartialType(CreateTagDto) {
|
||||
@IsDataExist(TagEntity, { groups: ['update'], message: 'tag id not exist when update' })
|
||||
@IsUUID(undefined, { message: 'The ID format is incorrect', groups: ['update'] })
|
||||
@IsDefined({ groups: ['update'], message: 'The ID must be specified' })
|
||||
id: string;
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user