pnpm update
This commit is contained in:
@@ -16,7 +16,10 @@ import { treePaginate } from '@/modules/database/utils';
|
||||
|
||||
@Injectable()
|
||||
export class CommentService extends BaseService<CommentEntity, CommentRepository> {
|
||||
constructor(protected repository: CommentRepository, protected postRepository: PostRepository) {
|
||||
constructor(
|
||||
protected repository: CommentRepository,
|
||||
protected postRepository: PostRepository,
|
||||
) {
|
||||
super(repository);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { registerDecorator, ValidationArguments, ValidationOptions } from 'class-validator';
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { isMobilePhone, IsMobilePhoneOptions, MobilePhoneLocale } from 'validator';
|
||||
|
||||
export function isMatchPhone(
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
export const CUSTOM_REPOSITORY_METADATA = 'CUSTOM_REPOSITORY_METADATA';
|
||||
|
||||
export enum SelectTrashMode {
|
||||
// ALL: 包含已软删除和未软删除的数据(同时查询正常数据和回收站中的数据)
|
||||
/**
|
||||
* ALL: 包含已软删除和未软删除的数据(同时查询正常数据和回收站中的数据)
|
||||
*/
|
||||
ALL = 'all',
|
||||
// ONLY: 只包含软删除的数据 (只查询回收站中的数据)
|
||||
/**
|
||||
* ONLY: 只包含软删除的数据 (只查询回收站中的数据)
|
||||
*/
|
||||
ONLY = 'only',
|
||||
// NONE: 只包含未软删除的数据 (只查询正常数据)
|
||||
|
||||
/**
|
||||
* NONE: 只包含未软删除的数据 (只查询正常数据)
|
||||
*/
|
||||
NONE = 'none',
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { IsEnum, IsOptional } from 'class-validator';
|
||||
|
||||
import { DtoValidation } from '@/modules/core/decorator/dto.validation.decorator';
|
||||
import { SelectTrashMode } from '@/modules/database/constants';
|
||||
|
||||
import { PaginateDto } from './paginate.dto';
|
||||
|
||||
@DtoValidation({ type: 'query' })
|
||||
export class PaginateWithTrashedDto extends PaginateDto {
|
||||
/**
|
||||
* 根据软删除状态查询
|
||||
*/
|
||||
@IsEnum(SelectTrashMode)
|
||||
@IsOptional()
|
||||
trashed?: SelectTrashMode;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { Transform } from 'class-transformer';
|
||||
import { Min, IsNumber, IsOptional } from 'class-validator';
|
||||
import { toNumber } from 'lodash';
|
||||
|
||||
import { DtoValidation } from '@/modules/core/decorator/dto.validation.decorator';
|
||||
import { PaginateOptions } from '@/modules/database/types';
|
||||
|
||||
/**
|
||||
* 分页数据查询验证
|
||||
*/
|
||||
@DtoValidation({ type: 'query' })
|
||||
export class PaginateDto implements PaginateOptions {
|
||||
/**
|
||||
* 当前页
|
||||
*/
|
||||
@Transform(({ value }) => toNumber(value))
|
||||
@Min(1, { message: '当前页必须大于1' })
|
||||
@IsNumber()
|
||||
@IsOptional()
|
||||
page?: number = 1;
|
||||
|
||||
/**
|
||||
* 每页数据量
|
||||
*/
|
||||
@Transform(({ value }) => toNumber(value))
|
||||
@Min(1, { message: '每页显示数据必须大于1' })
|
||||
@IsNumber()
|
||||
@IsOptional()
|
||||
limit?: number = 10;
|
||||
}
|
||||
+2
-1
@@ -1,3 +1,5 @@
|
||||
import { join } from 'path';
|
||||
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
|
||||
import { FastifyAdapter, NestFastifyApplication } from '@nestjs/platform-fastify';
|
||||
@@ -13,7 +15,6 @@ import { MeiliModule } from './modules/meilisearch/meili.module';
|
||||
import { Restful } from './modules/restful/restful';
|
||||
import { RestfulModule } from './modules/restful/restful.module';
|
||||
import { ApiConfig } from './modules/restful/types';
|
||||
import { join } from 'path';
|
||||
|
||||
export const createOptions: CreateOptions = {
|
||||
config: { factories: configs as any, storage: { enable: true } },
|
||||
|
||||
Reference in New Issue
Block a user