add content
This commit is contained in:
parent
7fd3bd83f8
commit
db5802d8e6
@ -26,18 +26,20 @@ export class QueryPostDto implements PaginateOptions {
|
|||||||
@IsOptional()
|
@IsOptional()
|
||||||
isPublished?: boolean;
|
isPublished?: boolean;
|
||||||
|
|
||||||
@IsEnum(PostOrder, { message: `` })
|
@IsEnum(PostOrder, {
|
||||||
|
message: `The sorting rule must be one of ${Object.values(PostOrder).join(',')}`,
|
||||||
|
})
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
orderBy: PostOrder;
|
orderBy: PostOrder;
|
||||||
|
|
||||||
@Transform(({ value }) => toNumber(value))
|
@Transform(({ value }) => toNumber(value))
|
||||||
@Min(1, { message: '' })
|
@Min(1, { message: 'The current page must be greater than 1.' })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
page = 1;
|
page = 1;
|
||||||
|
|
||||||
@Transform(({ value }) => toNumber(value))
|
@Transform(({ value }) => toNumber(value))
|
||||||
@Min(1, { message: '' })
|
@Min(1, { message: 'The number of data displayed per page must be greater than 1.' })
|
||||||
@IsNumber()
|
@IsNumber()
|
||||||
@IsOptional()
|
@IsOptional()
|
||||||
limit = 10;
|
limit = 10;
|
||||||
|
@ -65,7 +65,7 @@ export class PostService {
|
|||||||
const { orderBy, isPublished } = options;
|
const { orderBy, isPublished } = options;
|
||||||
if (typeof isPublished === 'boolean') {
|
if (typeof isPublished === 'boolean') {
|
||||||
isPublished
|
isPublished
|
||||||
? qb.where({ publishedAt: Not(IsNull) })
|
? qb.where({ publishedAt: Not(IsNull()) })
|
||||||
: qb.where({ publishedAt: IsNull() });
|
: qb.where({ publishedAt: IsNull() });
|
||||||
}
|
}
|
||||||
this.queryOrderBy(qb, orderBy);
|
this.queryOrderBy(qb, orderBy);
|
||||||
|
Loading…
Reference in New Issue
Block a user