@@ -6,7 +6,7 @@
|
||||
* @FilePath: /mx-server/src/common/decorators/simpleValidatorFactory.ts
|
||||
* @Coding with Love
|
||||
*/
|
||||
import { ValidatorConstraint, registerDecorator } from 'class-validator'
|
||||
import { registerDecorator, ValidatorConstraint } from 'class-validator'
|
||||
import type {
|
||||
ValidationArguments,
|
||||
ValidationOptions,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Logger, createLogger } from '@innei/pretty-logger-nestjs'
|
||||
import { createLogger, Logger } from '@innei/pretty-logger-nestjs'
|
||||
|
||||
import { LOG_DIR } from '~/constants/path.constant'
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
import 'dayjs/locale/zh-cn'
|
||||
|
||||
import duration from 'dayjs/plugin/duration'
|
||||
|
||||
import localizedFormat from 'dayjs/plugin/localizedFormat'
|
||||
import relativeTime from 'dayjs/plugin/relativeTime'
|
||||
import 'dayjs/locale/zh-cn'
|
||||
|
||||
dayjs.locale('zh-cn')
|
||||
dayjs.extend(localizedFormat)
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
/* eslint-disable import/order */
|
||||
import cluster from 'node:cluster'
|
||||
import { mkdirSync } from 'node:fs'
|
||||
|
||||
import { Logger } from '@nestjs/common'
|
||||
|
||||
import { CLUSTER } from '~/app.config'
|
||||
|
||||
import {
|
||||
DATA_DIR,
|
||||
LOG_DIR,
|
||||
@@ -14,15 +15,13 @@ import {
|
||||
} from '~/constants/path.constant'
|
||||
|
||||
import { consola, logger } from './consola.global'
|
||||
import { cwd, isDev } from './env.global'
|
||||
|
||||
import { registerJSONGlobal } from './json.global'
|
||||
|
||||
import './dayjs.global'
|
||||
import '@mx-space/external/zx-global'
|
||||
|
||||
import { CLUSTER } from '~/app.config'
|
||||
|
||||
import { cwd, isDev } from './env.global'
|
||||
import { registerJSONGlobal } from './json.global'
|
||||
|
||||
// 建立目录
|
||||
function mkdirs() {
|
||||
if (!CLUSTER.enable || cluster.isPrimary) {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import pluralize from 'pluralize'
|
||||
|
||||
import {
|
||||
Body,
|
||||
Delete,
|
||||
@@ -11,7 +9,9 @@ import {
|
||||
Put,
|
||||
Query,
|
||||
} from '@nestjs/common'
|
||||
|
||||
import { PartialType } from '@nestjs/mapped-types'
|
||||
import pluralize from 'pluralize'
|
||||
|
||||
import { ApiController } from '~/common/decorators/api-controller.decorator'
|
||||
import { Auth } from '~/common/decorators/auth.decorator'
|
||||
@@ -22,8 +22,8 @@ import { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
import { PagerDto } from '~/shared/dto/pager.dto'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
import type { BaseModel } from '~/shared/model/base.model'
|
||||
import type { AnyParamConstructor } from '@typegoose/typegoose/lib/types'
|
||||
import type { Type } from '@nestjs/common'
|
||||
import type { AnyParamConstructor } from '@typegoose/typegoose/lib/types'
|
||||
|
||||
export type BaseCrudModuleType<T> = {
|
||||
_model: MongooseModel<T>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ExecutionContext } from '@nestjs/common'
|
||||
import type { UserModel } from '~/modules/user/user.model'
|
||||
import type { ExecutionContext } from '@nestjs/common'
|
||||
import type { FastifyRequest } from 'fastify'
|
||||
|
||||
export type FastifyBizRequest = FastifyRequest & {
|
||||
|
||||
@@ -14,8 +14,8 @@ import {
|
||||
DB_CONNECTION_TOKEN,
|
||||
DB_MODEL_TOKEN_SUFFIX,
|
||||
} from '~/constants/system.constant'
|
||||
import type { Connection } from 'mongoose'
|
||||
import type { Provider } from '@nestjs/common'
|
||||
import type { Connection } from 'mongoose'
|
||||
|
||||
export interface TypegooseClass {
|
||||
new (...args: any[])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { mongoose } from '@typegoose/typegoose'
|
||||
import type { Pagination } from '~/shared/interface/paginator.interface'
|
||||
import type { mongoose } from '@typegoose/typegoose'
|
||||
|
||||
export function transformDataToPaginate<T = any>(
|
||||
data: mongoose.PaginateResult<T>,
|
||||
|
||||
@@ -5,11 +5,11 @@ import mongoose from 'mongoose'
|
||||
|
||||
import { MONGO_DB } from '~/app.config'
|
||||
import {
|
||||
type CollectionRefTypes,
|
||||
NOTE_COLLECTION_NAME,
|
||||
PAGE_COLLECTION_NAME,
|
||||
POST_COLLECTION_NAME,
|
||||
RECENTLY_COLLECTION_NAME,
|
||||
type CollectionRefTypes,
|
||||
} from '~/constants/db.constant'
|
||||
import { logger } from '~/global/consola.global'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @ts-ignore
|
||||
import { defaultMetadataStorage } from 'class-transformer/cjs/storage.js'
|
||||
import { ValidationTypes, getMetadataStorage } from 'class-validator'
|
||||
import { getMetadataStorage, ValidationTypes } from 'class-validator'
|
||||
import { targetConstructorToSchema } from 'class-validator-jsonschema'
|
||||
import type { ISchemaConverters } from 'class-validator-jsonschema/build/defaultConverters'
|
||||
import type { IOptions } from 'class-validator-jsonschema/build/options'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import IORedis from 'ioredis'
|
||||
|
||||
import { Logger } from '@nestjs/common'
|
||||
|
||||
import IORedis from 'ioredis'
|
||||
|
||||
import { REDIS } from '~/app.config'
|
||||
|
||||
import { isTest } from '../global/env.global'
|
||||
|
||||
@@ -37,7 +37,7 @@ export const isBuiltinModule = (module: string, ignoreList: string[] = []) => {
|
||||
(builtinModules || (Object.keys(process.binding('natives')) as string[]))
|
||||
.filter(
|
||||
(x) =>
|
||||
!/^_|^(internal|v8|node-inspect)\/|\//.test(x) &&
|
||||
!/^_|^(?:internal|v8|node-inspect)\/|\//.test(x) &&
|
||||
!ignoreList.includes(x),
|
||||
)
|
||||
.includes(module)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { join } from 'node:path'
|
||||
import { createHash } from 'node:crypto'
|
||||
import { join } from 'node:path'
|
||||
import { cloneDeep } from 'lodash'
|
||||
export const md5 = (text: string) =>
|
||||
createHash('md5').update(text).digest('hex') as string
|
||||
|
||||
Reference in New Issue
Block a user