chore: code style
This commit is contained in:
@@ -7,6 +7,7 @@ module.exports = {
|
||||
'no-unused-vars': 'off', // or "@typescript-eslint/no-unused-vars": "off",
|
||||
'@typescript-eslint/no-unused-vars': 'off',
|
||||
'unused-imports/no-unused-imports': 'error',
|
||||
'@typescript-eslint/consistent-type-imports': 'warn',
|
||||
'unused-imports/no-unused-vars': [
|
||||
'warn',
|
||||
{
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
"lodash": "*",
|
||||
"marked": "4.0.14",
|
||||
"mkdirp": "*",
|
||||
"mongoose": "*",
|
||||
"mongoose": "6.3.0",
|
||||
"mongoose-lean-id": "0.3.0",
|
||||
"mongoose-lean-virtuals": "0.9.0",
|
||||
"mongoose-paginate-v2": "1.6.3",
|
||||
|
||||
71
pnpm-lock.yaml
generated
71
pnpm-lock.yaml
generated
@@ -87,7 +87,7 @@ specifiers:
|
||||
marked: 4.0.14
|
||||
mkdirp: '*'
|
||||
mongodb-memory-server: 8.4.2
|
||||
mongoose: '*'
|
||||
mongoose: 6.3.0
|
||||
mongoose-lean-id: 0.3.0
|
||||
mongoose-lean-virtuals: 0.9.0
|
||||
mongoose-paginate-v2: 1.6.3
|
||||
@@ -137,8 +137,8 @@ dependencies:
|
||||
'@nestjs/websockets': 8.4.4_3014fe44fe56dc306f12143fbc824279
|
||||
'@socket.io/redis-adapter': 7.1.0
|
||||
'@socket.io/redis-emitter': 4.1.1
|
||||
'@typegoose/auto-increment': 1.3.0_mongoose@6.2.4
|
||||
'@typegoose/typegoose': 9.7.1_mongoose@6.2.4
|
||||
'@typegoose/auto-increment': 1.3.0_mongoose@6.3.0
|
||||
'@typegoose/typegoose': 9.7.1_mongoose@6.3.0
|
||||
algoliasearch: 4.13.0
|
||||
axios: 0.26.1
|
||||
axios-retry: 3.2.4
|
||||
@@ -167,9 +167,9 @@ dependencies:
|
||||
lodash: 4.17.21
|
||||
marked: 4.0.14
|
||||
mkdirp: 1.0.4
|
||||
mongoose: 6.2.4
|
||||
mongoose-lean-id: 0.3.0_mongoose@6.2.4
|
||||
mongoose-lean-virtuals: 0.9.0_mongoose@6.2.4
|
||||
mongoose: 6.3.0
|
||||
mongoose-lean-id: 0.3.0_mongoose@6.3.0
|
||||
mongoose-lean-virtuals: 0.9.0_mongoose@6.3.0
|
||||
mongoose-paginate-v2: 1.6.3
|
||||
nanoid: 3.3.2
|
||||
node-machine-id: 1.1.12
|
||||
@@ -1571,18 +1571,18 @@ packages:
|
||||
resolution: {integrity: sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==}
|
||||
dev: true
|
||||
|
||||
/@typegoose/auto-increment/1.3.0_mongoose@6.2.4:
|
||||
/@typegoose/auto-increment/1.3.0_mongoose@6.3.0:
|
||||
resolution: {integrity: sha512-VmBb3RZRBML7n+yscwL9mHR4Kjbjp08qqNRGV2aoJ2mqF3wqYOXVeJ5BUOoYk+YfjElYHcFoSlQ6T7RdPLKddA==}
|
||||
engines: {node: '>=12.22.0'}
|
||||
peerDependencies:
|
||||
mongoose: ~6.3.0
|
||||
dependencies:
|
||||
loglevel: 1.8.0
|
||||
mongoose: 6.2.4
|
||||
mongoose: 6.3.0
|
||||
tslib: 2.3.1
|
||||
dev: false
|
||||
|
||||
/@typegoose/typegoose/9.7.1_mongoose@6.2.4:
|
||||
/@typegoose/typegoose/9.7.1_mongoose@6.3.0:
|
||||
resolution: {integrity: sha512-4KaM/YvoqDTweAlfTryLnHhw608R4a23dZqILbFjskQVZ47hXpo9xAcNdxVBJFwb+nLXg303gQyVMET0ArC5Ng==}
|
||||
engines: {node: '>=12.22.0'}
|
||||
peerDependencies:
|
||||
@@ -1590,7 +1590,7 @@ packages:
|
||||
dependencies:
|
||||
lodash: 4.17.21
|
||||
loglevel: 1.8.0
|
||||
mongoose: 6.2.4
|
||||
mongoose: 6.3.0
|
||||
reflect-metadata: 0.1.13
|
||||
semver: 7.3.5
|
||||
tslib: 2.3.1
|
||||
@@ -2722,6 +2722,13 @@ packages:
|
||||
buffer: 5.7.1
|
||||
dev: false
|
||||
|
||||
/bson/4.6.2:
|
||||
resolution: {integrity: sha512-VeJKHShcu1b/ugl0QiujlVuBepab714X9nNyBdA1kfekuDGecxgpTA2Z6nYbagrWFeiIyzSWIOzju3lhj+RNyQ==}
|
||||
engines: {node: '>=6.9.0'}
|
||||
dependencies:
|
||||
buffer: 5.7.1
|
||||
dev: false
|
||||
|
||||
/buffer-crc32/0.2.13:
|
||||
resolution: {integrity: sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=}
|
||||
dev: false
|
||||
@@ -5615,8 +5622,8 @@ packages:
|
||||
safe-buffer: 5.2.1
|
||||
dev: false
|
||||
|
||||
/kareem/2.3.4:
|
||||
resolution: {integrity: sha512-Vcrt8lcpVl0s8ePx634BxwRqmFo+5DcOhlmNadehxreMTIQi/9hOL/B3hZQQbK5DgMS7Lem3xABXV7/S3jy+7g==}
|
||||
/kareem/2.3.5:
|
||||
resolution: {integrity: sha512-qxCyQtp3ioawkiRNQr/v8xw9KIviMSSNmy+63Wubj7KmMn3g7noRXIZB4vPCAP+ETi2SR8eH6CvmlKZuGpoHOg==}
|
||||
dev: false
|
||||
|
||||
/kleur/3.0.3:
|
||||
@@ -6084,18 +6091,6 @@ packages:
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/mongodb/4.3.1:
|
||||
resolution: {integrity: sha512-sNa8APSIk+r4x31ZwctKjuPSaeKuvUeNb/fu/3B6dRM02HpEgig7hTHM8A/PJQTlxuC/KFWlDlQjhsk/S43tBg==}
|
||||
engines: {node: '>=12.9.0'}
|
||||
dependencies:
|
||||
bson: 4.6.1
|
||||
denque: 2.0.1
|
||||
mongodb-connection-string-url: 2.5.2
|
||||
socks: 2.6.2
|
||||
optionalDependencies:
|
||||
saslprep: 1.0.3
|
||||
dev: false
|
||||
|
||||
/mongodb/4.4.0:
|
||||
resolution: {integrity: sha512-1hPhutJj6yxxu0ymwsO0uEimTo+QTh3oQP6YHxmLneBFBOGydYFdnmDDuLiGWimAlMdRN9WuDXY+JGp47aeOwA==}
|
||||
engines: {node: '>=12.9.0'}
|
||||
@@ -6109,21 +6104,33 @@ packages:
|
||||
dev: false
|
||||
optional: true
|
||||
|
||||
/mongoose-lean-id/0.3.0_mongoose@6.2.4:
|
||||
/mongodb/4.5.0:
|
||||
resolution: {integrity: sha512-A2l8MjEpKojnhbCM0MK3+UOGUSGvTNNSv7AkP1fsT7tkambrkkqN/5F2y+PhzsV0Nbv58u04TETpkaSEdI2zKA==}
|
||||
engines: {node: '>=12.9.0'}
|
||||
dependencies:
|
||||
bson: 4.6.2
|
||||
denque: 2.0.1
|
||||
mongodb-connection-string-url: 2.5.2
|
||||
socks: 2.6.2
|
||||
optionalDependencies:
|
||||
saslprep: 1.0.3
|
||||
dev: false
|
||||
|
||||
/mongoose-lean-id/0.3.0_mongoose@6.3.0:
|
||||
resolution: {integrity: sha512-/eONPzg+tA7/VR4uv0uKxKwH4OCseZShqwbMW572QvlSU0g48zDFTiDuCjZmNykfZgK3ZOwjfLVbXBAAAbXI4Q==}
|
||||
peerDependencies:
|
||||
mongoose: 4.x || 5.x || 6.x
|
||||
dependencies:
|
||||
mongoose: 6.2.4
|
||||
mongoose: 6.3.0
|
||||
dev: false
|
||||
|
||||
/mongoose-lean-virtuals/0.9.0_mongoose@6.2.4:
|
||||
/mongoose-lean-virtuals/0.9.0_mongoose@6.3.0:
|
||||
resolution: {integrity: sha512-14HwSd6l8X8BotvR5/frxFt4mUQ5/aCWAja14Bt4LS4IIUiqG1Sd8dK21hsBecld55OplSLIaQmPXcxy1U5Yeg==}
|
||||
peerDependencies:
|
||||
mongoose: '>=5.11.10'
|
||||
dependencies:
|
||||
array.prototype.flat: 1.2.3
|
||||
mongoose: 6.2.4
|
||||
mongoose: 6.3.0
|
||||
mpath: 0.8.4
|
||||
dev: false
|
||||
|
||||
@@ -6131,13 +6138,13 @@ packages:
|
||||
resolution: {integrity: sha512-wxIOcZL7V3+yHIkdTcDk+MtPxjDacEmrZ/4NpwgvOmmEm9SWWsBKRyPd/EmHlRUzk3ylr7fy4QEje1VMg0qpZA==}
|
||||
engines: {node: '>=4.0.0'}
|
||||
|
||||
/mongoose/6.2.4:
|
||||
resolution: {integrity: sha512-3hA3IGxBzZdlp1+/I9qn53NjEAd01qvKAH2WUCPahjVO8+uAmR0B4m+1bC3x9a4r0ExY8QYQ2ryG3E/v5Tj+jA==}
|
||||
/mongoose/6.3.0:
|
||||
resolution: {integrity: sha512-3x2pEGlZ5SorqcL0/hmUIAzzHIh6a/VIAEv3zAmc93qDtSz3WBbF8PwYYHcXm6Awfck9/zFOV9KIUEE+HjVepA==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
dependencies:
|
||||
bson: 4.6.1
|
||||
kareem: 2.3.4
|
||||
mongodb: 4.3.1
|
||||
kareem: 2.3.5
|
||||
mongodb: 4.5.0
|
||||
mpath: 0.8.4
|
||||
mquery: 4.0.2
|
||||
ms: 2.1.3
|
||||
|
||||
@@ -13,11 +13,12 @@ import { InjectModel } from '~/transformers/model.transformer'
|
||||
import PKG from '../package.json'
|
||||
import { Auth } from './common/decorator/auth.decorator'
|
||||
import { HttpCache } from './common/decorator/cache.decorator'
|
||||
import { IpLocation, IpRecord } from './common/decorator/ip.decorator'
|
||||
import type { IpRecord } from './common/decorator/ip.decorator'
|
||||
import { IpLocation } from './common/decorator/ip.decorator'
|
||||
import { AllowAllCorsInterceptor } from './common/interceptors/allow-all-cors.interceptor'
|
||||
import { RedisKeys } from './constants/cache.constant'
|
||||
import { OptionModel } from './modules/configs/configs.model'
|
||||
import { CacheService } from './processors/cache/cache.service'
|
||||
import type { CacheService } from './processors/cache/cache.service'
|
||||
import { getRedisKey } from './utils/redis.util'
|
||||
|
||||
@Controller()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { MiddlewareConsumer, Module, NestModule, Type } from '@nestjs/common'
|
||||
import type { MiddlewareConsumer, NestModule, Type } from '@nestjs/common'
|
||||
import { Module } from '@nestjs/common'
|
||||
import { APP_FILTER, APP_GUARD, APP_INTERCEPTOR } from '@nestjs/core'
|
||||
|
||||
import { AppController } from './app.controller'
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import cluster from 'cluster'
|
||||
import { performance } from 'perf_hooks'
|
||||
|
||||
import { LogLevel, Logger, RequestMethod, ValidationPipe } from '@nestjs/common'
|
||||
import type { LogLevel } from '@nestjs/common'
|
||||
import { Logger, RequestMethod, ValidationPipe } from '@nestjs/common'
|
||||
import { NestFactory } from '@nestjs/core'
|
||||
import { NestFastifyApplication } from '@nestjs/platform-fastify'
|
||||
import type { NestFastifyApplication } from '@nestjs/platform-fastify'
|
||||
|
||||
import { API_VERSION, CROSS_DOMAIN, PORT, isMainProcess } from './app.config'
|
||||
import { AppModule } from './app.module'
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { FastifyRequest } from 'fastify'
|
||||
import type { FastifyRequest } from 'fastify'
|
||||
|
||||
import { ExecutionContext, createParamDecorator } from '@nestjs/common'
|
||||
import type { ExecutionContext } from '@nestjs/common'
|
||||
import { createParamDecorator } from '@nestjs/common'
|
||||
|
||||
export const Cookies = createParamDecorator(
|
||||
(data: string, ctx: ExecutionContext) => {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { ExecutionContext, createParamDecorator } from '@nestjs/common'
|
||||
import type { ExecutionContext } from '@nestjs/common'
|
||||
import { createParamDecorator } from '@nestjs/common'
|
||||
|
||||
import { getNestExecutionContextRequest } from '~/transformers/get-req.transformer'
|
||||
|
||||
|
||||
@@ -6,9 +6,10 @@
|
||||
* @FilePath: /mx-server/src/core/decorators/ip.decorator.ts
|
||||
* @Coding with Love
|
||||
*/
|
||||
import { FastifyRequest } from 'fastify'
|
||||
import type { FastifyRequest } from 'fastify'
|
||||
|
||||
import { ExecutionContext, createParamDecorator } from '@nestjs/common'
|
||||
import type { ExecutionContext } from '@nestjs/common'
|
||||
import { createParamDecorator } from '@nestjs/common'
|
||||
|
||||
import { getIp } from '~/utils/ip.util'
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { ExecutionContext, createParamDecorator } from '@nestjs/common'
|
||||
import type { ExecutionContext } from '@nestjs/common'
|
||||
import { createParamDecorator } from '@nestjs/common'
|
||||
|
||||
import { getNestExecutionContextRequest } from '~/transformers/get-req.transformer'
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { SetMetadata } from '@nestjs/common'
|
||||
|
||||
import { ArticleType } from '~/constants/article.constant'
|
||||
import type { ArticleType } from '~/constants/article.constant'
|
||||
import { HTTP_RES_UPDATE_DOC_COUNT_TYPE } from '~/constants/meta.constant'
|
||||
|
||||
export const VisitDocument: (
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { HttpException } from '@nestjs/common'
|
||||
|
||||
import { ErrorCode, ErrorCodeEnum } from '~/constants/error-code.constant'
|
||||
import type { ErrorCodeEnum } from '~/constants/error-code.constant'
|
||||
import { ErrorCode } from '~/constants/error-code.constant'
|
||||
|
||||
export class BusinessException extends HttpException {
|
||||
constructor(code: ErrorCodeEnum) {
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
import { FastifyReply, FastifyRequest } from 'fastify'
|
||||
import { WriteStream } from 'fs'
|
||||
import type { FastifyReply, FastifyRequest } from 'fastify'
|
||||
import type { WriteStream } from 'fs'
|
||||
import { resolve } from 'path'
|
||||
|
||||
import type { ArgumentsHost, ExceptionFilter } from '@nestjs/common'
|
||||
import {
|
||||
ArgumentsHost,
|
||||
Catch,
|
||||
ExceptionFilter,
|
||||
HttpException,
|
||||
HttpStatus,
|
||||
Inject,
|
||||
Logger,
|
||||
} from '@nestjs/common'
|
||||
import { Reflector } from '@nestjs/core'
|
||||
import type { Reflector } from '@nestjs/core'
|
||||
|
||||
import { HTTP_REQUEST_TIME } from '~/constants/meta.constant'
|
||||
import { LOG_DIR } from '~/constants/path.constant'
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common'
|
||||
import type { CanActivate, ExecutionContext } from '@nestjs/common'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { AuthGuard as _AuthGuard } from '@nestjs/passport'
|
||||
|
||||
import { isTest } from '~/global/env.global'
|
||||
|
||||
@@ -6,11 +6,12 @@
|
||||
* @FilePath: /server/apps/server/src/auth/roles.guard.ts
|
||||
* Mark: Coding with Love
|
||||
*/
|
||||
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common'
|
||||
import type { CanActivate, ExecutionContext } from '@nestjs/common'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { AuthGuard } from '@nestjs/passport'
|
||||
|
||||
import { isTest } from '~/global/env.global'
|
||||
import { AuthService } from '~/modules/auth/auth.service'
|
||||
import type { AuthService } from '~/modules/auth/auth.service'
|
||||
import { getNestExecutionContextRequest } from '~/transformers/get-req.transformer'
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,14 +3,10 @@
|
||||
* @description 禁止爬虫的守卫
|
||||
* @author Innei <https://innei.ren>
|
||||
*/
|
||||
import { Observable } from 'rxjs'
|
||||
import type { Observable } from 'rxjs'
|
||||
|
||||
import {
|
||||
CanActivate,
|
||||
ExecutionContext,
|
||||
ForbiddenException,
|
||||
Injectable,
|
||||
} from '@nestjs/common'
|
||||
import type { CanActivate, ExecutionContext } from '@nestjs/common'
|
||||
import { ForbiddenException, Injectable } from '@nestjs/common'
|
||||
|
||||
import { isDev } from '~/global/env.global'
|
||||
import { getNestExecutionContextRequest } from '~/transformers/get-req.transformer'
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { FastifyReply } from 'fastify'
|
||||
import type { FastifyReply } from 'fastify'
|
||||
|
||||
import {
|
||||
import type {
|
||||
CallHandler,
|
||||
ExecutionContext,
|
||||
NestInterceptor,
|
||||
RequestMethod,
|
||||
} from '@nestjs/common'
|
||||
import { RequestMethod } from '@nestjs/common'
|
||||
|
||||
export class AllowAllCorsInterceptor implements NestInterceptor {
|
||||
intercept(context: ExecutionContext, next: CallHandler<any>) {
|
||||
|
||||
@@ -5,22 +5,22 @@
|
||||
* @author Innei <https://github.com/Innei>
|
||||
*/
|
||||
import isbot from 'isbot'
|
||||
import { Observable } from 'rxjs'
|
||||
import type { Observable } from 'rxjs'
|
||||
import UAParser from 'ua-parser-js'
|
||||
import { URL } from 'url'
|
||||
|
||||
import {
|
||||
import type {
|
||||
CallHandler,
|
||||
ExecutionContext,
|
||||
Injectable,
|
||||
NestInterceptor,
|
||||
} from '@nestjs/common'
|
||||
import { ReturnModelType } from '@typegoose/typegoose'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import type { ReturnModelType } from '@typegoose/typegoose'
|
||||
|
||||
import { RedisKeys } from '~/constants/cache.constant'
|
||||
import { AnalyzeModel } from '~/modules/analyze/analyze.model'
|
||||
import { OptionModel } from '~/modules/configs/configs.model'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
import { getNestExecutionContextRequest } from '~/transformers/get-req.transformer'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
import { getIp } from '~/utils/ip.util'
|
||||
|
||||
@@ -5,24 +5,23 @@
|
||||
* @author Surmon <https://github.com/surmon-china>
|
||||
* @author Innei <https://innei.ren>
|
||||
*/
|
||||
import { Observable, of } from 'rxjs'
|
||||
import type { Observable } from 'rxjs'
|
||||
import { of } from 'rxjs'
|
||||
import { tap } from 'rxjs/operators'
|
||||
|
||||
import {
|
||||
import type {
|
||||
CallHandler,
|
||||
ExecutionContext,
|
||||
HttpAdapterHost,
|
||||
Inject,
|
||||
Injectable,
|
||||
NestInterceptor,
|
||||
RequestMethod,
|
||||
} from '@nestjs/common'
|
||||
import { Reflector } from '@nestjs/core'
|
||||
import { Inject, Injectable, RequestMethod } from '@nestjs/common'
|
||||
import type { Reflector } from '@nestjs/core'
|
||||
|
||||
import { REDIS } from '~/app.config'
|
||||
import * as META from '~/constants/meta.constant'
|
||||
import * as SYSTEM from '~/constants/system.constant'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
import { getNestExecutionContextRequest } from '~/transformers/get-req.transformer'
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,16 +4,16 @@
|
||||
*/
|
||||
import { map } from 'rxjs'
|
||||
|
||||
import {
|
||||
import type {
|
||||
CallHandler,
|
||||
ExecutionContext,
|
||||
Injectable,
|
||||
NestInterceptor,
|
||||
} from '@nestjs/common'
|
||||
import { Reflector } from '@nestjs/core'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import type { Reflector } from '@nestjs/core'
|
||||
|
||||
import { HTTP_RES_UPDATE_DOC_COUNT_TYPE } from '~/constants/meta.constant'
|
||||
import { CountingService } from '~/processors/helper/helper.counting.service'
|
||||
import type { CountingService } from '~/processors/helper/helper.counting.service'
|
||||
import { getNestExecutionContextRequest } from '~/transformers/get-req.transformer'
|
||||
import { getIp } from '~/utils/ip.util'
|
||||
|
||||
|
||||
@@ -3,16 +3,17 @@
|
||||
* @author Innei
|
||||
*/
|
||||
import { isArrayLike, isObjectLike } from 'lodash'
|
||||
import { Observable, map } from 'rxjs'
|
||||
import type { Observable } from 'rxjs'
|
||||
import { map } from 'rxjs'
|
||||
import snakecaseKeys from 'snakecase-keys'
|
||||
|
||||
import {
|
||||
import type {
|
||||
CallHandler,
|
||||
ExecutionContext,
|
||||
Injectable,
|
||||
NestInterceptor,
|
||||
} from '@nestjs/common'
|
||||
import { Reflector } from '@nestjs/core'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import type { Reflector } from '@nestjs/core'
|
||||
|
||||
import { RESPONSE_PASSTHROUGH_METADATA } from '~/constants/system.constant'
|
||||
|
||||
|
||||
@@ -5,17 +5,15 @@
|
||||
* @author Surmon <https://github.com/surmon-china>
|
||||
* @author Innei <https://github.com/Innei>
|
||||
*/
|
||||
import { Observable } from 'rxjs'
|
||||
import type { Observable } from 'rxjs'
|
||||
import { tap } from 'rxjs/operators'
|
||||
|
||||
import {
|
||||
import type {
|
||||
CallHandler,
|
||||
ExecutionContext,
|
||||
Injectable,
|
||||
Logger,
|
||||
NestInterceptor,
|
||||
SetMetadata,
|
||||
} from '@nestjs/common'
|
||||
import { Injectable, Logger, SetMetadata } from '@nestjs/common'
|
||||
|
||||
import { HTTP_REQUEST_TIME } from '~/constants/meta.constant'
|
||||
import { getNestExecutionContextRequest } from '~/transformers/get-req.transformer'
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import qs from 'qs'
|
||||
import { Observable } from 'rxjs'
|
||||
import type { Observable } from 'rxjs'
|
||||
|
||||
import {
|
||||
import type {
|
||||
CallHandler,
|
||||
ExecutionContext,
|
||||
Injectable,
|
||||
NestInterceptor,
|
||||
} from '@nestjs/common'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
|
||||
import { getNestExecutionContextRequest } from '~/transformers/get-req.transformer'
|
||||
|
||||
|
||||
@@ -3,16 +3,16 @@
|
||||
* @author Innei
|
||||
*/
|
||||
import { isArrayLike } from 'lodash'
|
||||
import { Observable } from 'rxjs'
|
||||
import type { Observable } from 'rxjs'
|
||||
import { map } from 'rxjs/operators'
|
||||
|
||||
import {
|
||||
import type {
|
||||
CallHandler,
|
||||
ExecutionContext,
|
||||
Injectable,
|
||||
NestInterceptor,
|
||||
} from '@nestjs/common'
|
||||
import { Reflector } from '@nestjs/core'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import type { Reflector } from '@nestjs/core'
|
||||
|
||||
import { HTTP_RES_TRANSFORM_PAGINATE } from '~/constants/meta.constant'
|
||||
import * as SYSTEM from '~/constants/system.constant'
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
* 把 URL Search 上的 `token` 附加到 Header Authorization 上
|
||||
* @author Innei <https://innei.ren>
|
||||
*/
|
||||
import { IncomingMessage, ServerResponse } from 'http'
|
||||
import type { IncomingMessage, ServerResponse } from 'http'
|
||||
|
||||
import { Injectable, NestMiddleware } from '@nestjs/common'
|
||||
import type { NestMiddleware } from '@nestjs/common'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
|
||||
import { parseRelativeUrl } from '~/utils/ip.util'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { UserModel } from '~/modules/user/user.model'
|
||||
import type { UserModel } from '~/modules/user/user.model'
|
||||
|
||||
export const mockUser1: UserModel = {
|
||||
id: '1',
|
||||
|
||||
@@ -8,10 +8,10 @@ import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { IsMaster } from '~/common/decorator/role.decorator'
|
||||
import { CacheKeys } from '~/constants/cache.constant'
|
||||
|
||||
import { AnalyzeService } from '../analyze/analyze.service'
|
||||
import { ConfigsService } from '../configs/configs.service'
|
||||
import { TimelineQueryDto, TopQueryDto } from './aggregate.dto'
|
||||
import { AggregateService } from './aggregate.service'
|
||||
import type { AnalyzeService } from '../analyze/analyze.service'
|
||||
import type { ConfigsService } from '../configs/configs.service'
|
||||
import type { TimelineQueryDto, TopQueryDto } from './aggregate.dto'
|
||||
import type { AggregateService } from './aggregate.service'
|
||||
|
||||
@Controller('aggregate')
|
||||
@ApiName
|
||||
|
||||
@@ -1,36 +1,36 @@
|
||||
import dayjs from 'dayjs'
|
||||
import { pick } from 'lodash'
|
||||
import { FilterQuery } from 'mongoose'
|
||||
import type { FilterQuery } from 'mongoose'
|
||||
import { URL } from 'url'
|
||||
|
||||
import { Inject, Injectable, forwardRef } from '@nestjs/common'
|
||||
import { OnEvent } from '@nestjs/event-emitter'
|
||||
import { DocumentType, ReturnModelType } from '@typegoose/typegoose'
|
||||
import { AnyParamConstructor } from '@typegoose/typegoose/lib/types'
|
||||
import type { DocumentType, ReturnModelType } from '@typegoose/typegoose'
|
||||
import type { AnyParamConstructor } from '@typegoose/typegoose/lib/types'
|
||||
|
||||
import { CacheKeys, RedisKeys } from '~/constants/cache.constant'
|
||||
import { EventBusEvents } from '~/constants/event-bus.constant'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import { WebEventsGateway } from '~/processors/gateway/web/events.gateway'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { WebEventsGateway } from '~/processors/gateway/web/events.gateway'
|
||||
import { addYearCondition } from '~/transformers/db-query.transformer'
|
||||
import { getRedisKey } from '~/utils/redis.util'
|
||||
import { getShortDate } from '~/utils/time.util'
|
||||
|
||||
import { CategoryModel } from '../category/category.model'
|
||||
import type { CategoryModel } from '../category/category.model'
|
||||
import { CategoryService } from '../category/category.service'
|
||||
import { CommentState } from '../comment/comment.model'
|
||||
import { CommentService } from '../comment/comment.service'
|
||||
import { ConfigsService } from '../configs/configs.service'
|
||||
import type { ConfigsService } from '../configs/configs.service'
|
||||
import { LinkState } from '../link/link.model'
|
||||
import { LinkService } from '../link/link.service'
|
||||
import { NoteModel } from '../note/note.model'
|
||||
import type { NoteModel } from '../note/note.model'
|
||||
import { NoteService } from '../note/note.service'
|
||||
import { PageService } from '../page/page.service'
|
||||
import { PostService } from '../post/post.service'
|
||||
import { RecentlyService } from '../recently/recently.service'
|
||||
import { SayService } from '../say/say.service'
|
||||
import { TimelineType } from './aggregate.dto'
|
||||
import { RSSProps } from './aggregate.interface'
|
||||
import type { RSSProps } from './aggregate.interface'
|
||||
|
||||
@Injectable()
|
||||
export class AggregateService {
|
||||
|
||||
@@ -6,13 +6,13 @@ import { Auth } from '~/common/decorator/auth.decorator'
|
||||
import { Paginator } from '~/common/decorator/http.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { RedisKeys } from '~/constants/cache.constant'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import { PagerDto } from '~/shared/dto/pager.dto'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { PagerDto } from '~/shared/dto/pager.dto'
|
||||
import { getRedisKey } from '~/utils/redis.util'
|
||||
import { getTodayEarly, getWeekStart } from '~/utils/time.util'
|
||||
|
||||
import { AnalyzeDto } from './analyze.dto'
|
||||
import { AnalyzeService } from './analyze.service'
|
||||
import type { AnalyzeDto } from './analyze.dto'
|
||||
import type { AnalyzeService } from './analyze.service'
|
||||
|
||||
@Controller({ path: 'analyze', scope: Scope.REQUEST })
|
||||
@ApiName
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import dayjs from 'dayjs'
|
||||
import { merge } from 'lodash'
|
||||
import { PipelineStage } from 'mongoose'
|
||||
import type { PipelineStage } from 'mongoose'
|
||||
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { ReturnModelType } from '@typegoose/typegoose'
|
||||
import type { ReturnModelType } from '@typegoose/typegoose'
|
||||
|
||||
import { RedisKeys } from '~/constants/cache.constant'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
import { getRedisKey } from '~/utils/redis.util'
|
||||
|
||||
|
||||
@@ -17,16 +17,16 @@ import {
|
||||
Query,
|
||||
Scope,
|
||||
} from '@nestjs/common'
|
||||
import { EventEmitter2 } from '@nestjs/event-emitter'
|
||||
import type { EventEmitter2 } from '@nestjs/event-emitter'
|
||||
import { ApiBearerAuth, ApiOperation } from '@nestjs/swagger'
|
||||
|
||||
import { Auth } from '~/common/decorator/auth.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { IsMaster as Master } from '~/common/decorator/role.decorator'
|
||||
import { EventBusEvents } from '~/constants/event-bus.constant'
|
||||
import { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
import type { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
|
||||
import { AuthService } from './auth.service'
|
||||
import type { AuthService } from './auth.service'
|
||||
|
||||
export class TokenDto {
|
||||
@IsDate()
|
||||
|
||||
@@ -3,20 +3,20 @@ import { isDate, omit } from 'lodash'
|
||||
import { customAlphabet } from 'nanoid/async'
|
||||
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { JwtService } from '@nestjs/jwt'
|
||||
import { ReturnModelType } from '@typegoose/typegoose'
|
||||
import type { JwtService } from '@nestjs/jwt'
|
||||
import type { ReturnModelType } from '@typegoose/typegoose'
|
||||
|
||||
import { MasterLostException } from '~/common/exceptions/master-lost.exception'
|
||||
import {
|
||||
import type {
|
||||
TokenModel,
|
||||
UserModel as User,
|
||||
UserDocument,
|
||||
UserModel,
|
||||
} from '~/modules/user/user.model'
|
||||
import { UserModel as User } from '~/modules/user/user.model'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
|
||||
import { TokenDto } from './auth.controller'
|
||||
import { JwtPayload } from './interfaces/jwt-payload.interface'
|
||||
import type { TokenDto } from './auth.controller'
|
||||
import type { JwtPayload } from './interfaces/jwt-payload.interface'
|
||||
|
||||
@Injectable()
|
||||
export class AuthService {
|
||||
|
||||
@@ -6,14 +6,15 @@
|
||||
* @FilePath: /mx-server/src/auth/jwt.strategy.ts
|
||||
* @Coding with Love
|
||||
*/
|
||||
import { ExtractJwt, Strategy, StrategyOptions } from 'passport-jwt'
|
||||
import type { StrategyOptions } from 'passport-jwt'
|
||||
import { ExtractJwt, Strategy } from 'passport-jwt'
|
||||
|
||||
import { Injectable, UnauthorizedException } from '@nestjs/common'
|
||||
import { PassportStrategy } from '@nestjs/passport'
|
||||
|
||||
import { __secret } from './auth.module'
|
||||
import { AuthService } from './auth.service'
|
||||
import { JwtPayload } from './interfaces/jwt-payload.interface'
|
||||
import type { AuthService } from './auth.service'
|
||||
import type { JwtPayload } from './interfaces/jwt-payload.interface'
|
||||
|
||||
@Injectable()
|
||||
export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { FastifyRequest } from 'fastify'
|
||||
import type { FastifyRequest } from 'fastify'
|
||||
import { Readable } from 'stream'
|
||||
|
||||
import {
|
||||
@@ -20,10 +20,10 @@ import { ApiProperty, ApiResponseProperty } from '@nestjs/swagger'
|
||||
import { Auth } from '~/common/decorator/auth.decorator'
|
||||
import { HTTPDecorators } from '~/common/decorator/http.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { UploadService } from '~/processors/helper/helper.upload.service'
|
||||
import type { UploadService } from '~/processors/helper/helper.upload.service'
|
||||
import { getMediumDateTime } from '~/utils'
|
||||
|
||||
import { BackupService } from './backup.service'
|
||||
import type { BackupService } from './backup.service'
|
||||
|
||||
@Controller({ path: 'backups', scope: Scope.REQUEST })
|
||||
@ApiName
|
||||
|
||||
@@ -15,12 +15,12 @@ import {
|
||||
import { MONGO_DB } from '~/app.config'
|
||||
import { BusinessEvents, EventScope } from '~/constants/business-event.constant'
|
||||
import { BACKUP_DIR, DATA_DIR } from '~/constants/path.constant'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import { EventManagerService } from '~/processors/helper/helper.event.service'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { EventManagerService } from '~/processors/helper/helper.event.service'
|
||||
import { getMediumDateTime } from '~/utils'
|
||||
import { getFolderSize } from '~/utils/system.util'
|
||||
|
||||
import { ConfigsService } from '../configs/configs.service'
|
||||
import type { ConfigsService } from '../configs/configs.service'
|
||||
|
||||
@Injectable()
|
||||
export class BackupService {
|
||||
|
||||
@@ -21,20 +21,17 @@ import { Auth } from '~/common/decorator/auth.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { IsMaster } from '~/common/decorator/role.decorator'
|
||||
import { CannotFindException } from '~/common/exceptions/cant-find.exception'
|
||||
import { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
import type { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
|
||||
import { PostService } from '../post/post.service'
|
||||
import {
|
||||
import type {
|
||||
MultiCategoriesQueryDto,
|
||||
MultiQueryTagAndCategoryDto,
|
||||
SlugOrIdDto,
|
||||
} from './category.dto'
|
||||
import {
|
||||
CategoryModel,
|
||||
CategoryType,
|
||||
PartialCategoryModel,
|
||||
} from './category.model'
|
||||
import { CategoryService } from './category.service'
|
||||
import type { CategoryModel, PartialCategoryModel } from './category.model'
|
||||
import { CategoryType } from './category.model'
|
||||
import type { CategoryService } from './category.service'
|
||||
|
||||
@Controller({ path: 'categories' })
|
||||
@ApiName
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { IsEnum, IsNotEmpty, IsOptional, IsString } from 'class-validator'
|
||||
|
||||
import { PartialType } from '@nestjs/mapped-types'
|
||||
import { DocumentType, index, modelOptions, prop } from '@typegoose/typegoose'
|
||||
import type { DocumentType } from '@typegoose/typegoose'
|
||||
import { index, modelOptions, prop } from '@typegoose/typegoose'
|
||||
|
||||
import { BaseModel } from '~/shared/model/base.model'
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { omit } from 'lodash'
|
||||
import { FilterQuery } from 'mongoose'
|
||||
import type { FilterQuery } from 'mongoose'
|
||||
|
||||
import { Inject, Injectable, forwardRef } from '@nestjs/common'
|
||||
import { DocumentType, ReturnModelType } from '@typegoose/typegoose'
|
||||
import type { DocumentType, ReturnModelType } from '@typegoose/typegoose'
|
||||
|
||||
import { CannotFindException } from '~/common/exceptions/cant-find.exception'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
|
||||
import { PostModel } from '../post/post.model'
|
||||
import type { PostModel } from '../post/post.model'
|
||||
import { PostService } from '../post/post.service'
|
||||
import { CategoryModel, CategoryType } from './category.model'
|
||||
|
||||
|
||||
@@ -13,31 +13,33 @@ import {
|
||||
UseInterceptors,
|
||||
} from '@nestjs/common'
|
||||
import { ApiOperation, ApiParam } from '@nestjs/swagger'
|
||||
import { DocumentType } from '@typegoose/typegoose'
|
||||
import type { DocumentType } from '@typegoose/typegoose'
|
||||
|
||||
import { Auth } from '~/common/decorator/auth.decorator'
|
||||
import { CurrentUser } from '~/common/decorator/current-user.decorator'
|
||||
import { IpLocation, IpRecord } from '~/common/decorator/ip.decorator'
|
||||
import type { IpRecord } from '~/common/decorator/ip.decorator'
|
||||
import { IpLocation } from '~/common/decorator/ip.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { IsMaster } from '~/common/decorator/role.decorator'
|
||||
import { CannotFindException } from '~/common/exceptions/cant-find.exception'
|
||||
import { BusinessEvents, EventScope } from '~/constants/business-event.constant'
|
||||
import { ReplyMailType } from '~/processors/helper/helper.email.service'
|
||||
import { EventManagerService } from '~/processors/helper/helper.event.service'
|
||||
import { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
import { PagerDto } from '~/shared/dto/pager.dto'
|
||||
import type { EventManagerService } from '~/processors/helper/helper.event.service'
|
||||
import type { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
import type { PagerDto } from '~/shared/dto/pager.dto'
|
||||
import { transformDataToPaginate } from '~/transformers/paginate.transformer'
|
||||
|
||||
import { UserModel } from '../user/user.model'
|
||||
import {
|
||||
import type { UserModel } from '../user/user.model'
|
||||
import type {
|
||||
CommentDto,
|
||||
CommentRefTypesDto,
|
||||
StateDto,
|
||||
TextOnlyDto,
|
||||
} from './comment.dto'
|
||||
import { CommentFilterEmailInterceptor } from './comment.interceptor'
|
||||
import { CommentModel, CommentState } from './comment.model'
|
||||
import { CommentService } from './comment.service'
|
||||
import type { CommentModel } from './comment.model'
|
||||
import { CommentState } from './comment.model'
|
||||
import type { CommentService } from './comment.service'
|
||||
|
||||
@Controller({ path: 'comments' })
|
||||
@UseInterceptors(CommentFilterEmailInterceptor)
|
||||
|
||||
@@ -2,12 +2,12 @@ import { isDefined } from 'class-validator'
|
||||
import { cloneDeep, isArrayLike, isObjectLike } from 'lodash'
|
||||
import { map } from 'rxjs'
|
||||
|
||||
import {
|
||||
import type {
|
||||
CallHandler,
|
||||
ExecutionContext,
|
||||
Injectable,
|
||||
NestInterceptor,
|
||||
} from '@nestjs/common'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
|
||||
import { getNestExecutionContextRequest } from '~/transformers/get-req.transformer'
|
||||
import { getAvatar } from '~/utils'
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
import { Query, Types } from 'mongoose'
|
||||
import type { Query } from 'mongoose'
|
||||
import { Types } from 'mongoose'
|
||||
import { URL } from 'url'
|
||||
|
||||
import {
|
||||
DocumentType,
|
||||
Ref,
|
||||
modelOptions,
|
||||
pre,
|
||||
prop,
|
||||
} from '@typegoose/typegoose'
|
||||
import { BeAnObject } from '@typegoose/typegoose/lib/types'
|
||||
import type { DocumentType, Ref } from '@typegoose/typegoose'
|
||||
import { modelOptions, pre, prop } from '@typegoose/typegoose'
|
||||
import type { BeAnObject } from '@typegoose/typegoose/lib/types'
|
||||
|
||||
import { BaseModel } from '~/shared/model/base.model'
|
||||
import { getAvatar } from '~/utils'
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
import { LeanDocument, Types } from 'mongoose'
|
||||
import type { LeanDocument } from 'mongoose'
|
||||
import { Types } from 'mongoose'
|
||||
import { URL } from 'url'
|
||||
|
||||
import { BadRequestException, Injectable, Logger } from '@nestjs/common'
|
||||
import { DocumentType } from '@typegoose/typegoose'
|
||||
import { BeAnObject } from '@typegoose/typegoose/lib/types'
|
||||
import type { DocumentType } from '@typegoose/typegoose'
|
||||
import type { BeAnObject } from '@typegoose/typegoose/lib/types'
|
||||
|
||||
import { CannotFindException } from '~/common/exceptions/cant-find.exception'
|
||||
import { MasterLostException } from '~/common/exceptions/master-lost.exception'
|
||||
import { DatabaseService } from '~/processors/database/database.service'
|
||||
import {
|
||||
EmailService,
|
||||
ReplyMailType,
|
||||
} from '~/processors/helper/helper.email.service'
|
||||
import { WriteBaseModel } from '~/shared/model/base.model'
|
||||
import type { DatabaseService } from '~/processors/database/database.service'
|
||||
import type { EmailService } from '~/processors/helper/helper.email.service'
|
||||
import { ReplyMailType } from '~/processors/helper/helper.email.service'
|
||||
import type { WriteBaseModel } from '~/shared/model/base.model'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
import { hasChinese } from '~/utils'
|
||||
|
||||
import { ConfigsService } from '../configs/configs.service'
|
||||
import { UserService } from '../user/user.service'
|
||||
import type { ConfigsService } from '../configs/configs.service'
|
||||
import type { UserService } from '../user/user.service'
|
||||
import BlockedKeywords from './block-keywords.json'
|
||||
import { CommentModel, CommentRefTypes } from './comment.model'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { JSONSchema } from 'class-validator-jsonschema'
|
||||
import { DecoratorSchema } from 'class-validator-jsonschema/build/decorators'
|
||||
import type { DecoratorSchema } from 'class-validator-jsonschema/build/decorators'
|
||||
|
||||
export const JSONSchemaPasswordField = (
|
||||
title: string,
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import camelcaseKeys from 'camelcase-keys'
|
||||
import { ClassConstructor, plainToInstance } from 'class-transformer'
|
||||
import { ValidatorOptions, validateSync } from 'class-validator'
|
||||
import type { ClassConstructor } from 'class-transformer'
|
||||
import { plainToInstance } from 'class-transformer'
|
||||
import type { ValidatorOptions } from 'class-validator'
|
||||
import { validateSync } from 'class-validator'
|
||||
import cluster from 'cluster'
|
||||
import { cloneDeep, mergeWith } from 'lodash'
|
||||
import { LeanDocument } from 'mongoose'
|
||||
import type { LeanDocument } from 'mongoose'
|
||||
|
||||
import {
|
||||
BadRequestException,
|
||||
@@ -11,26 +13,24 @@ import {
|
||||
Logger,
|
||||
ValidationPipe,
|
||||
} from '@nestjs/common'
|
||||
import { EventEmitter2 } from '@nestjs/event-emitter'
|
||||
import { DocumentType, ReturnModelType } from '@typegoose/typegoose'
|
||||
import { BeAnObject } from '@typegoose/typegoose/lib/types'
|
||||
import type { EventEmitter2 } from '@nestjs/event-emitter'
|
||||
import type { DocumentType, ReturnModelType } from '@typegoose/typegoose'
|
||||
import type { BeAnObject } from '@typegoose/typegoose/lib/types'
|
||||
|
||||
import { RedisKeys } from '~/constants/cache.constant'
|
||||
import { EventBusEvents } from '~/constants/event-bus.constant'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
import { sleep } from '~/utils'
|
||||
import { getRedisKey } from '~/utils/redis.util'
|
||||
|
||||
import * as optionDtos from '../configs/configs.dto'
|
||||
import { UserModel } from '../user/user.model'
|
||||
import { UserService } from '../user/user.service'
|
||||
import {
|
||||
AlgoliaSearchOptionsDto,
|
||||
BackupOptionsDto,
|
||||
MailOptionsDto,
|
||||
} from './configs.dto'
|
||||
import { IConfig, IConfigKeys } from './configs.interface'
|
||||
import type { UserModel } from '../user/user.model'
|
||||
import type { UserService } from '../user/user.service'
|
||||
import type { BackupOptionsDto } from './configs.dto'
|
||||
import { AlgoliaSearchOptionsDto, MailOptionsDto } from './configs.dto'
|
||||
import type { IConfigKeys } from './configs.interface'
|
||||
import { IConfig } from './configs.interface'
|
||||
import { OptionModel } from './configs.model'
|
||||
|
||||
const allOptionKeys: Set<IConfigKeys> = new Set()
|
||||
|
||||
@@ -9,12 +9,13 @@ import {
|
||||
} from '@nestjs/common'
|
||||
|
||||
import { HTTPDecorators } from '~/common/decorator/http.decorator'
|
||||
import { BusinessEvents, EventScope } from '~/constants/business-event.constant'
|
||||
import { EventManagerService } from '~/processors/helper/helper.event.service'
|
||||
import { PagerDto } from '~/shared/dto/pager.dto'
|
||||
import type { BusinessEvents } from '~/constants/business-event.constant'
|
||||
import { EventScope } from '~/constants/business-event.constant'
|
||||
import type { EventManagerService } from '~/processors/helper/helper.event.service'
|
||||
import type { PagerDto } from '~/shared/dto/pager.dto'
|
||||
|
||||
import { createMockedContextResponse } from '../serverless/mock-response.util'
|
||||
import { ServerlessService } from '../serverless/serverless.service'
|
||||
import type { ServerlessService } from '../serverless/serverless.service'
|
||||
import { SnippetModel, SnippetType } from '../snippet/snippet.model'
|
||||
|
||||
@Controller('debug')
|
||||
|
||||
@@ -6,9 +6,9 @@ import { HTTPDecorators } from '~/common/decorator/http.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { CacheKeys } from '~/constants/cache.constant'
|
||||
|
||||
import { AggregateService } from '../aggregate/aggregate.service'
|
||||
import { ConfigsService } from '../configs/configs.service'
|
||||
import { MarkdownService } from '../markdown/markdown.service'
|
||||
import type { AggregateService } from '../aggregate/aggregate.service'
|
||||
import type { ConfigsService } from '../configs/configs.service'
|
||||
import type { MarkdownService } from '../markdown/markdown.service'
|
||||
|
||||
@Controller('feed')
|
||||
@ApiName
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { FastifyReply } from 'fastify'
|
||||
import { isFunction, isString } from 'lodash'
|
||||
import { resolve } from 'path'
|
||||
import { Readable } from 'stream'
|
||||
import type { Readable } from 'stream'
|
||||
|
||||
import {
|
||||
BadRequestException,
|
||||
@@ -15,8 +15,8 @@ import {
|
||||
Scope,
|
||||
UnprocessableEntityException,
|
||||
} from '@nestjs/common'
|
||||
import { Reflector } from '@nestjs/core'
|
||||
import { SchedulerRegistry } from '@nestjs/schedule'
|
||||
import type { Reflector } from '@nestjs/core'
|
||||
import type { SchedulerRegistry } from '@nestjs/schedule'
|
||||
|
||||
import { Auth } from '~/common/decorator/auth.decorator'
|
||||
import { HTTPDecorators } from '~/common/decorator/http.decorator'
|
||||
@@ -25,11 +25,11 @@ import { CRON_DESCRIPTION } from '~/constants/meta.constant'
|
||||
import { LOG_DIR } from '~/constants/path.constant'
|
||||
import { SCHEDULE_CRON_OPTIONS } from '~/constants/system.constant'
|
||||
import { getTodayLogFilePath } from '~/global/consola.global'
|
||||
import { CronService } from '~/processors/helper/helper.cron.service'
|
||||
import { TaskQueueService } from '~/processors/helper/helper.tq.service'
|
||||
import type { CronService } from '~/processors/helper/helper.cron.service'
|
||||
import type { TaskQueueService } from '~/processors/helper/helper.tq.service'
|
||||
import { formatByteSize } from '~/utils'
|
||||
|
||||
import { LogQueryDto, LogTypeDto } from './health.dto'
|
||||
import type { LogQueryDto, LogTypeDto } from './health.dto'
|
||||
|
||||
@Controller({
|
||||
path: 'health',
|
||||
|
||||
@@ -12,9 +12,9 @@ import {
|
||||
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
|
||||
import { ConfigsService } from '../configs/configs.service'
|
||||
import { ConfigKeyDto } from '../option/dtos/config.dto'
|
||||
import { InitService } from './init.service'
|
||||
import type { ConfigsService } from '../configs/configs.service'
|
||||
import type { ConfigKeyDto } from '../option/dtos/config.dto'
|
||||
import type { InitService } from './init.service'
|
||||
|
||||
@Controller({
|
||||
path: '/init',
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Injectable, Logger } from '@nestjs/common'
|
||||
|
||||
import { DATA_DIR, TEMP_DIR } from '~/constants/path.constant'
|
||||
|
||||
import { UserService } from '../user/user.service'
|
||||
import type { UserService } from '../user/user.service'
|
||||
|
||||
@Injectable()
|
||||
export class InitService {
|
||||
|
||||
@@ -16,15 +16,13 @@ import { Auth } from '~/common/decorator/auth.decorator'
|
||||
import { Paginator } from '~/common/decorator/http.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { IsMaster } from '~/common/decorator/role.decorator'
|
||||
import { PagerDto } from '~/shared/dto/pager.dto'
|
||||
import {
|
||||
BaseCrudFactory,
|
||||
BaseCrudModuleType,
|
||||
} from '~/transformers/crud-factor.transformer'
|
||||
import type { PagerDto } from '~/shared/dto/pager.dto'
|
||||
import type { BaseCrudModuleType } from '~/transformers/crud-factor.transformer'
|
||||
import { BaseCrudFactory } from '~/transformers/crud-factor.transformer'
|
||||
|
||||
import { LinkDto } from './link.dto'
|
||||
import type { LinkDto } from './link.dto'
|
||||
import { LinkModel, LinkState } from './link.model'
|
||||
import { LinkService } from './link.service'
|
||||
import type { LinkService } from './link.service'
|
||||
|
||||
const paths = ['links', 'friends']
|
||||
@Controller(paths)
|
||||
|
||||
@@ -7,15 +7,13 @@ import {
|
||||
|
||||
import { BusinessEvents, EventScope } from '~/constants/business-event.constant'
|
||||
import { isDev } from '~/global/env.global'
|
||||
import {
|
||||
EmailService,
|
||||
LinkApplyEmailType,
|
||||
} from '~/processors/helper/helper.email.service'
|
||||
import { EventManagerService } from '~/processors/helper/helper.event.service'
|
||||
import { HttpService } from '~/processors/helper/helper.http.service'
|
||||
import type { EmailService } from '~/processors/helper/helper.email.service'
|
||||
import { LinkApplyEmailType } from '~/processors/helper/helper.email.service'
|
||||
import type { EventManagerService } from '~/processors/helper/helper.event.service'
|
||||
import type { HttpService } from '~/processors/helper/helper.http.service'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
|
||||
import { ConfigsService } from '../configs/configs.service'
|
||||
import type { ConfigsService } from '../configs/configs.service'
|
||||
import { LinkModel, LinkState, LinkType } from './link.model'
|
||||
|
||||
@Injectable()
|
||||
|
||||
@@ -28,21 +28,21 @@ import { HTTPDecorators } from '~/common/decorator/http.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { IsMaster } from '~/common/decorator/role.decorator'
|
||||
import { ArticleTypeEnum } from '~/constants/article.constant'
|
||||
import { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
import type { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
import { getShortDateTime } from '~/utils'
|
||||
|
||||
import { CategoryModel } from '../category/category.model'
|
||||
import { ConfigsService } from '../configs/configs.service'
|
||||
import { NoteModel } from '../note/note.model'
|
||||
import { PageModel } from '../page/page.model'
|
||||
import { PostModel } from '../post/post.model'
|
||||
import {
|
||||
import type { CategoryModel } from '../category/category.model'
|
||||
import type { ConfigsService } from '../configs/configs.service'
|
||||
import type { NoteModel } from '../note/note.model'
|
||||
import type { PageModel } from '../page/page.model'
|
||||
import type { PostModel } from '../post/post.model'
|
||||
import type {
|
||||
DataListDto,
|
||||
ExportMarkdownQueryDto,
|
||||
MarkdownPreviewDto,
|
||||
} from './markdown.dto'
|
||||
import { MarkdownYAMLProperty } from './markdown.interface'
|
||||
import { MarkdownService } from './markdown.service'
|
||||
import type { MarkdownYAMLProperty } from './markdown.interface'
|
||||
import type { MarkdownService } from './markdown.service'
|
||||
|
||||
@Controller('markdown')
|
||||
@ApiName
|
||||
|
||||
@@ -11,18 +11,18 @@ import {
|
||||
InternalServerErrorException,
|
||||
Logger,
|
||||
} from '@nestjs/common'
|
||||
import { ReturnModelType } from '@typegoose/typegoose'
|
||||
import type { ReturnModelType } from '@typegoose/typegoose'
|
||||
|
||||
import { DatabaseService } from '~/processors/database/database.service'
|
||||
import { AssetService } from '~/processors/helper/helper.asset.service'
|
||||
import type { DatabaseService } from '~/processors/database/database.service'
|
||||
import type { AssetService } from '~/processors/helper/helper.asset.service'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
|
||||
import { CategoryModel } from '../category/category.model'
|
||||
import { NoteModel } from '../note/note.model'
|
||||
import { PageModel } from '../page/page.model'
|
||||
import { PostModel } from '../post/post.model'
|
||||
import { DatatypeDto } from './markdown.dto'
|
||||
import { MarkdownYAMLProperty } from './markdown.interface'
|
||||
import type { DatatypeDto } from './markdown.dto'
|
||||
import type { MarkdownYAMLProperty } from './markdown.interface'
|
||||
|
||||
@Injectable()
|
||||
export class MarkdownService {
|
||||
|
||||
@@ -16,26 +16,27 @@ import { ApiOperation } from '@nestjs/swagger'
|
||||
|
||||
import { Auth } from '~/common/decorator/auth.decorator'
|
||||
import { Paginator } from '~/common/decorator/http.decorator'
|
||||
import { IpLocation, IpRecord } from '~/common/decorator/ip.decorator'
|
||||
import type { IpRecord } from '~/common/decorator/ip.decorator'
|
||||
import { IpLocation } from '~/common/decorator/ip.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { IsMaster } from '~/common/decorator/role.decorator'
|
||||
import { VisitDocument } from '~/common/decorator/update-count.decorator'
|
||||
import { CannotFindException } from '~/common/exceptions/cant-find.exception'
|
||||
import { CountingService } from '~/processors/helper/helper.counting.service'
|
||||
import { IntIdOrMongoIdDto, MongoIdDto } from '~/shared/dto/id.dto'
|
||||
import type { CountingService } from '~/processors/helper/helper.counting.service'
|
||||
import type { IntIdOrMongoIdDto, MongoIdDto } from '~/shared/dto/id.dto'
|
||||
import {
|
||||
addHidePasswordAndHideCondition,
|
||||
addYearCondition,
|
||||
} from '~/transformers/db-query.transformer'
|
||||
|
||||
import {
|
||||
import type {
|
||||
ListQueryDto,
|
||||
NidType,
|
||||
NoteQueryDto,
|
||||
PasswordQueryDto,
|
||||
} from './note.dto'
|
||||
import { NoteModel, PartialNoteModel } from './note.model'
|
||||
import { NoteService } from './note.service'
|
||||
import type { NoteModel, PartialNoteModel } from './note.model'
|
||||
import type { NoteService } from './note.service'
|
||||
|
||||
@ApiName
|
||||
@Controller({ path: 'notes' })
|
||||
|
||||
@@ -13,7 +13,7 @@ import { PartialType } from '@nestjs/mapped-types'
|
||||
import { AutoIncrementID } from '@typegoose/auto-increment'
|
||||
import { index, modelOptions, plugin, prop } from '@typegoose/typegoose'
|
||||
|
||||
import { Paginator } from '~/shared/interface/paginator.interface'
|
||||
import type { Paginator } from '~/shared/interface/paginator.interface'
|
||||
import { CountMixed, WriteBaseModel } from '~/shared/model/base.model'
|
||||
|
||||
@modelOptions({ schemaOptions: { id: false, _id: false } })
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { isDefined, isMongoId } from 'class-validator'
|
||||
import { FilterQuery } from 'mongoose'
|
||||
import type { FilterQuery } from 'mongoose'
|
||||
|
||||
import { Injectable } from '@nestjs/common'
|
||||
import { EventEmitter2 } from '@nestjs/event-emitter'
|
||||
import { DocumentType } from '@typegoose/typegoose'
|
||||
import type { EventEmitter2 } from '@nestjs/event-emitter'
|
||||
import type { DocumentType } from '@typegoose/typegoose'
|
||||
|
||||
import { CannotFindException } from '~/common/exceptions/cant-find.exception'
|
||||
import { BusinessEvents, EventScope } from '~/constants/business-event.constant'
|
||||
import { EventBusEvents } from '~/constants/event-bus.constant'
|
||||
import { EventManagerService } from '~/processors/helper/helper.event.service'
|
||||
import { ImageService } from '~/processors/helper/helper.image.service'
|
||||
import type { EventManagerService } from '~/processors/helper/helper.event.service'
|
||||
import type { ImageService } from '~/processors/helper/helper.image.service'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
import { deleteKeys } from '~/utils'
|
||||
|
||||
|
||||
@@ -11,10 +11,10 @@ import {
|
||||
|
||||
import { HTTPDecorators } from '~/common/decorator/http.decorator'
|
||||
import { IConfig } from '~/modules/configs/configs.interface'
|
||||
import { ConfigsService } from '~/modules/configs/configs.service'
|
||||
import type { ConfigsService } from '~/modules/configs/configs.service'
|
||||
import { classToJsonSchema } from '~/utils/jsonschema.util'
|
||||
|
||||
import { ConfigKeyDto } from '../dtos/config.dto'
|
||||
import type { ConfigKeyDto } from '../dtos/config.dto'
|
||||
import { OptionController } from '../option.decorator'
|
||||
|
||||
@OptionController()
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { Body, Delete, Get, Put, Query } from '@nestjs/common'
|
||||
|
||||
import {
|
||||
import type {
|
||||
EmailService,
|
||||
EmailTemplateRenderProps,
|
||||
ReplyMailType,
|
||||
} from '~/processors/helper/helper.email.service'
|
||||
import { ReplyMailType } from '~/processors/helper/helper.email.service'
|
||||
|
||||
import { ReplyEmailBodyDto, ReplyEmailTypeDto } from '../dtos/email.dto'
|
||||
import type { ReplyEmailBodyDto, ReplyEmailTypeDto } from '../dtos/email.dto'
|
||||
import { OptionController } from '../option.decorator'
|
||||
|
||||
@OptionController('Email', 'email')
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IsNotEmpty, IsString } from 'class-validator'
|
||||
|
||||
import { IConfig } from '~/modules/configs/configs.interface'
|
||||
import type { IConfig } from '~/modules/configs/configs.interface'
|
||||
|
||||
export class ConfigKeyDto {
|
||||
@IsString()
|
||||
|
||||
@@ -16,11 +16,11 @@ import { Auth } from '~/common/decorator/auth.decorator'
|
||||
import { Paginator } from '~/common/decorator/http.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { CannotFindException } from '~/common/exceptions/cant-find.exception'
|
||||
import { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
import type { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
|
||||
import { PageQueryDto } from './page.dto'
|
||||
import { PageModel, PartialPageModel } from './page.model'
|
||||
import { PageService } from './page.service'
|
||||
import type { PageQueryDto } from './page.dto'
|
||||
import type { PageModel, PartialPageModel } from './page.model'
|
||||
import type { PageService } from './page.service'
|
||||
|
||||
@Controller('pages')
|
||||
@ApiName
|
||||
|
||||
@@ -5,8 +5,8 @@ import slugify from 'slugify'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
|
||||
import { BusinessEvents, EventScope } from '~/constants/business-event.constant'
|
||||
import { EventManagerService } from '~/processors/helper/helper.event.service'
|
||||
import { ImageService } from '~/processors/helper/helper.image.service'
|
||||
import type { EventManagerService } from '~/processors/helper/helper.event.service'
|
||||
import type { ImageService } from '~/processors/helper/helper.image.service'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
|
||||
import { PageModel } from './page.model'
|
||||
|
||||
@@ -19,12 +19,12 @@ import { HTTPDecorators } from '~/common/decorator/http.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { RedisKeys } from '~/constants/cache.constant'
|
||||
import { LOCAL_ADMIN_ASSET_PATH } from '~/constants/path.constant'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
import { getRedisKey } from '~/utils/redis.util'
|
||||
|
||||
import { dashboard } from '../../../package.json'
|
||||
import { PageProxyDebugDto } from './pageproxy.dto'
|
||||
import { PageProxyService } from './pageproxy.service'
|
||||
import type { PageProxyDebugDto } from './pageproxy.dto'
|
||||
import type { PageProxyService } from './pageproxy.service'
|
||||
|
||||
@Controller('/')
|
||||
@ApiName
|
||||
|
||||
@@ -6,8 +6,8 @@ import { Injectable, InternalServerErrorException } from '@nestjs/common'
|
||||
import PKG from '~/../package.json'
|
||||
import { API_VERSION } from '~/app.config'
|
||||
|
||||
import { ConfigsService } from '../configs/configs.service'
|
||||
import { InitService } from '../init/init.service'
|
||||
import type { ConfigsService } from '../configs/configs.service'
|
||||
import type { InitService } from '../init/init.service'
|
||||
|
||||
@Injectable()
|
||||
export class PageProxyService {
|
||||
|
||||
@@ -18,18 +18,19 @@ import { ApiOperation } from '@nestjs/swagger'
|
||||
|
||||
import { Auth } from '~/common/decorator/auth.decorator'
|
||||
import { Paginator } from '~/common/decorator/http.decorator'
|
||||
import { IpLocation, IpRecord } from '~/common/decorator/ip.decorator'
|
||||
import type { IpRecord } from '~/common/decorator/ip.decorator'
|
||||
import { IpLocation } from '~/common/decorator/ip.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { IsMaster } from '~/common/decorator/role.decorator'
|
||||
import { VisitDocument } from '~/common/decorator/update-count.decorator'
|
||||
import { CannotFindException } from '~/common/exceptions/cant-find.exception'
|
||||
import { CountingService } from '~/processors/helper/helper.counting.service'
|
||||
import { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
import type { CountingService } from '~/processors/helper/helper.counting.service'
|
||||
import type { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
import { addYearCondition } from '~/transformers/db-query.transformer'
|
||||
|
||||
import { CategoryAndSlugDto, PostQueryDto } from './post.dto'
|
||||
import { PartialPostModel, PostModel } from './post.model'
|
||||
import { PostService } from './post.service'
|
||||
import type { CategoryAndSlugDto, PostQueryDto } from './post.dto'
|
||||
import type { PartialPostModel, PostModel } from './post.model'
|
||||
import type { PostService } from './post.service'
|
||||
|
||||
@Controller('posts')
|
||||
@ApiName
|
||||
|
||||
@@ -6,22 +6,15 @@ import {
|
||||
IsOptional,
|
||||
IsString,
|
||||
} from 'class-validator'
|
||||
import { Query } from 'mongoose'
|
||||
import type { Query } from 'mongoose'
|
||||
|
||||
import { PartialType } from '@nestjs/mapped-types'
|
||||
import { ApiHideProperty, ApiProperty } from '@nestjs/swagger'
|
||||
import {
|
||||
DocumentType,
|
||||
Ref,
|
||||
Severity,
|
||||
index,
|
||||
modelOptions,
|
||||
pre,
|
||||
prop,
|
||||
} from '@typegoose/typegoose'
|
||||
import { BeAnObject } from '@typegoose/typegoose/lib/types'
|
||||
import type { DocumentType, Ref } from '@typegoose/typegoose'
|
||||
import { Severity, index, modelOptions, pre, prop } from '@typegoose/typegoose'
|
||||
import type { BeAnObject } from '@typegoose/typegoose/lib/types'
|
||||
|
||||
import { Paginator } from '~/shared/interface/paginator.interface'
|
||||
import type { Paginator } from '~/shared/interface/paginator.interface'
|
||||
import { CountMixed as Count, WriteBaseModel } from '~/shared/model/base.model'
|
||||
|
||||
import { CategoryModel as Category } from '../category/category.model'
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { isDefined } from 'class-validator'
|
||||
import { omit } from 'lodash'
|
||||
import { FilterQuery, PaginateOptions } from 'mongoose'
|
||||
import type { FilterQuery, PaginateOptions } from 'mongoose'
|
||||
import slugify from 'slugify'
|
||||
|
||||
import {
|
||||
@@ -14,8 +14,8 @@ import { BusinessException } from '~/common/exceptions/business.exception'
|
||||
import { BusinessEvents, EventScope } from '~/constants/business-event.constant'
|
||||
import { ErrorCodeEnum } from '~/constants/error-code.constant'
|
||||
import { EventBusEvents } from '~/constants/event-bus.constant'
|
||||
import { EventManagerService } from '~/processors/helper/helper.event.service'
|
||||
import { ImageService } from '~/processors/helper/helper.image.service'
|
||||
import type { EventManagerService } from '~/processors/helper/helper.event.service'
|
||||
import type { ImageService } from '~/processors/helper/helper.image.service'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
|
||||
import { CategoryService } from '../category/category.service'
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Controller, Get, Scope } from '@nestjs/common'
|
||||
|
||||
import { Auth } from '~/common/decorator/auth.decorator'
|
||||
|
||||
import { PTYService } from './pty.service'
|
||||
import type { PTYService } from './pty.service'
|
||||
|
||||
@Auth()
|
||||
@Controller({ path: 'pty', scope: Scope.REQUEST })
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
import { isNil } from 'lodash'
|
||||
import { nanoid } from 'nanoid'
|
||||
import { IPty, spawn } from 'node-pty'
|
||||
import { Socket } from 'socket.io'
|
||||
import type { IPty } from 'node-pty'
|
||||
import { spawn } from 'node-pty'
|
||||
import type { Socket } from 'socket.io'
|
||||
|
||||
import { JwtService } from '@nestjs/jwt'
|
||||
import {
|
||||
import type { JwtService } from '@nestjs/jwt'
|
||||
import type {
|
||||
GatewayMetadata,
|
||||
OnGatewayConnection,
|
||||
OnGatewayDisconnect,
|
||||
SubscribeMessage,
|
||||
WebSocketGateway,
|
||||
} from '@nestjs/websockets'
|
||||
import { SubscribeMessage, WebSocketGateway } from '@nestjs/websockets'
|
||||
|
||||
import { BusinessEvents } from '~/constants/business-event.constant'
|
||||
import { RedisKeys } from '~/constants/cache.constant'
|
||||
import { DATA_DIR } from '~/constants/path.constant'
|
||||
import { AuthService } from '~/modules/auth/auth.service'
|
||||
import { ConfigsService } from '~/modules/configs/configs.service'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { AuthService } from '~/modules/auth/auth.service'
|
||||
import type { ConfigsService } from '~/modules/configs/configs.service'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
import { createAuthGateway } from '~/processors/gateway/shared/auth.gateway'
|
||||
import { getIp, getRedisKey } from '~/utils'
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
|
||||
import { RedisKeys } from '~/constants/cache.constant'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
import { getRedisKey } from '~/utils'
|
||||
|
||||
@Injectable()
|
||||
|
||||
@@ -11,11 +11,11 @@ import {
|
||||
|
||||
import { Auth } from '~/common/decorator/auth.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
import { OffsetDto } from '~/shared/dto/pager.dto'
|
||||
import type { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
import type { OffsetDto } from '~/shared/dto/pager.dto'
|
||||
|
||||
import { RecentlyModel } from './recently.model'
|
||||
import { RecentlyService } from './recently.service'
|
||||
import type { RecentlyModel } from './recently.model'
|
||||
import type { RecentlyService } from './recently.service'
|
||||
|
||||
@Controller(['recently', 'shorthand'])
|
||||
@ApiName
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
|
||||
import { BusinessEvents, EventScope } from '~/constants/business-event.constant'
|
||||
import { EventManagerService } from '~/processors/helper/helper.event.service'
|
||||
import type { EventManagerService } from '~/processors/helper/helper.event.service'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
|
||||
import { RecentlyModel } from './recently.model'
|
||||
|
||||
@@ -9,9 +9,9 @@ import {
|
||||
import { HttpCache } from '~/common/decorator/cache.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { IsMaster } from '~/common/decorator/role.decorator'
|
||||
import { SearchDto } from '~/modules/search/search.dto'
|
||||
import type { SearchDto } from '~/modules/search/search.dto'
|
||||
|
||||
import { SearchService } from './search.service'
|
||||
import type { SearchService } from './search.service'
|
||||
|
||||
@Controller('search')
|
||||
@ApiName
|
||||
|
||||
@@ -8,12 +8,12 @@ import {
|
||||
forwardRef,
|
||||
} from '@nestjs/common'
|
||||
|
||||
import { SearchDto } from '~/modules/search/search.dto'
|
||||
import { DatabaseService } from '~/processors/database/database.service'
|
||||
import { Pagination } from '~/shared/interface/paginator.interface'
|
||||
import type { SearchDto } from '~/modules/search/search.dto'
|
||||
import type { DatabaseService } from '~/processors/database/database.service'
|
||||
import type { Pagination } from '~/shared/interface/paginator.interface'
|
||||
import { transformDataToPaginate } from '~/transformers/paginate.transformer'
|
||||
|
||||
import { ConfigsService } from '../configs/configs.service'
|
||||
import type { ConfigsService } from '../configs/configs.service'
|
||||
import { NoteService } from '../note/note.service'
|
||||
import { PostService } from '../post/post.service'
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { FastifyReply } from 'fastify'
|
||||
|
||||
import { HttpException } from '@nestjs/common'
|
||||
|
||||
import { FunctionContextResponse } from './function.types'
|
||||
import type { FunctionContextResponse } from './function.types'
|
||||
|
||||
export const createMockedContextResponse = (
|
||||
reply: FastifyReply,
|
||||
|
||||
@@ -19,8 +19,8 @@ import { IsMaster } from '~/common/decorator/role.decorator'
|
||||
|
||||
import { SnippetType } from '../snippet/snippet.model'
|
||||
import { createMockedContextResponse } from './mock-response.util'
|
||||
import { ServerlessReferenceDto } from './serverless.dto'
|
||||
import { ServerlessService } from './serverless.service'
|
||||
import type { ServerlessReferenceDto } from './serverless.dto'
|
||||
import type { ServerlessService } from './serverless.service'
|
||||
|
||||
@ApiName
|
||||
@Controller('serverless')
|
||||
|
||||
@@ -4,9 +4,10 @@ import { cloneDeep } from 'lodash'
|
||||
import path from 'path'
|
||||
import { nextTick } from 'process'
|
||||
|
||||
import { TransformOptions, parseAsync, transformAsync } from '@babel/core'
|
||||
import type { TransformOptions } from '@babel/core'
|
||||
import { parseAsync, transformAsync } from '@babel/core'
|
||||
import * as t from '@babel/types'
|
||||
import { VariableDeclaration } from '@babel/types'
|
||||
import type { VariableDeclaration } from '@babel/types'
|
||||
import {
|
||||
Injectable,
|
||||
InternalServerErrorException,
|
||||
@@ -16,19 +17,19 @@ import { Interval } from '@nestjs/schedule'
|
||||
|
||||
import { RedisKeys } from '~/constants/cache.constant'
|
||||
import { DATA_DIR, NODE_REQUIRE_PATH } from '~/constants/path.constant'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import { DatabaseService } from '~/processors/database/database.service'
|
||||
import { AssetService } from '~/processors/helper/helper.asset.service'
|
||||
import { HttpService } from '~/processors/helper/helper.http.service'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { DatabaseService } from '~/processors/database/database.service'
|
||||
import type { AssetService } from '~/processors/helper/helper.asset.service'
|
||||
import type { HttpService } from '~/processors/helper/helper.http.service'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
import { UniqueArray } from '~/ts-hepler/unique'
|
||||
import type { UniqueArray } from '~/ts-hepler/unique'
|
||||
import { getRedisKey, safePathJoin } from '~/utils'
|
||||
import { safeEval } from '~/utils/safe-eval.util'
|
||||
import { isBuiltinModule } from '~/utils/system.util'
|
||||
|
||||
import PKG from '../../../package.json'
|
||||
import { SnippetModel } from '../snippet/snippet.model'
|
||||
import {
|
||||
import type {
|
||||
FunctionContextRequest,
|
||||
FunctionContextResponse,
|
||||
} from './function.types'
|
||||
|
||||
@@ -4,7 +4,7 @@ import { HTTPDecorators } from '~/common/decorator/http.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { CacheKeys } from '~/constants/cache.constant'
|
||||
|
||||
import { AggregateService } from '../aggregate/aggregate.service'
|
||||
import type { AggregateService } from '../aggregate/aggregate.service'
|
||||
|
||||
@Controller('sitemap')
|
||||
@ApiName
|
||||
|
||||
@@ -15,14 +15,15 @@ import { HTTPDecorators } from '~/common/decorator/http.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { IsMaster } from '~/common/decorator/role.decorator'
|
||||
import { DATA_DIR } from '~/constants/path.constant'
|
||||
import { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
import { PagerDto } from '~/shared/dto/pager.dto'
|
||||
import type { MongoIdDto } from '~/shared/dto/id.dto'
|
||||
import type { PagerDto } from '~/shared/dto/pager.dto'
|
||||
import { transformDataToPaginate } from '~/transformers/paginate.transformer'
|
||||
import { installPKG } from '~/utils'
|
||||
|
||||
import { SnippetMoreDto } from './snippet.dto'
|
||||
import { SnippetModel, SnippetType } from './snippet.model'
|
||||
import { SnippetService } from './snippet.service'
|
||||
import type { SnippetMoreDto } from './snippet.dto'
|
||||
import type { SnippetModel } from './snippet.model'
|
||||
import { SnippetType } from './snippet.model'
|
||||
import type { SnippetService } from './snippet.service'
|
||||
|
||||
@ApiName
|
||||
@Controller('snippets')
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
} from '@nestjs/common'
|
||||
|
||||
import { RedisKeys } from '~/constants/cache.constant'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
import { getRedisKey } from '~/utils'
|
||||
|
||||
|
||||
@@ -4,12 +4,12 @@ import { Auth } from '~/common/decorator/auth.decorator'
|
||||
import { HttpCache } from '~/common/decorator/cache.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { RedisKeys } from '~/constants/cache.constant'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
import { getRedisKey } from '~/utils/redis.util'
|
||||
|
||||
import { ConfigsService } from '../configs/configs.service'
|
||||
import { GaodeMapLocationDto, GaodeMapSearchDto, IpDto } from './tool.dto'
|
||||
import { ToolService } from './tool.service'
|
||||
import type { ConfigsService } from '../configs/configs.service'
|
||||
import type { GaodeMapLocationDto, GaodeMapSearchDto, IpDto } from './tool.dto'
|
||||
import type { ToolService } from './tool.service'
|
||||
|
||||
@Controller('tools')
|
||||
@ApiName
|
||||
|
||||
@@ -8,10 +8,10 @@ import {
|
||||
UnprocessableEntityException,
|
||||
} from '@nestjs/common'
|
||||
|
||||
import { HttpService } from '~/processors/helper/helper.http.service'
|
||||
import type { HttpService } from '~/processors/helper/helper.http.service'
|
||||
|
||||
import { ConfigsService } from '../configs/configs.service'
|
||||
import { IP } from './tool.interface'
|
||||
import type { ConfigsService } from '../configs/configs.service'
|
||||
import type { IP } from './tool.interface'
|
||||
|
||||
@Injectable()
|
||||
export class ToolService {
|
||||
|
||||
@@ -4,15 +4,16 @@ import { ApiOperation } from '@nestjs/swagger'
|
||||
import { Auth } from '~/common/decorator/auth.decorator'
|
||||
import { HttpCache } from '~/common/decorator/cache.decorator'
|
||||
import { CurrentUser } from '~/common/decorator/current-user.decorator'
|
||||
import { IpLocation, IpRecord } from '~/common/decorator/ip.decorator'
|
||||
import type { IpRecord } from '~/common/decorator/ip.decorator'
|
||||
import { IpLocation } from '~/common/decorator/ip.decorator'
|
||||
import { ApiName } from '~/common/decorator/openapi.decorator'
|
||||
import { IsMaster } from '~/common/decorator/role.decorator'
|
||||
import { getAvatar } from '~/utils'
|
||||
|
||||
import { AuthService } from '../auth/auth.service'
|
||||
import { LoginDto, UserDto, UserPatchDto } from './user.dto'
|
||||
import { UserDocument, UserModel } from './user.model'
|
||||
import { UserService } from './user.service'
|
||||
import type { AuthService } from '../auth/auth.service'
|
||||
import type { LoginDto, UserDto, UserPatchDto } from './user.dto'
|
||||
import type { UserDocument, UserModel } from './user.model'
|
||||
import type { UserService } from './user.service'
|
||||
|
||||
@ApiName
|
||||
@Controller(['master', 'user'])
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
import { hashSync } from 'bcrypt'
|
||||
import { Schema } from 'mongoose'
|
||||
|
||||
import {
|
||||
DocumentType,
|
||||
Severity,
|
||||
modelOptions,
|
||||
prop,
|
||||
} from '@typegoose/typegoose'
|
||||
import type { DocumentType } from '@typegoose/typegoose'
|
||||
import { Severity, modelOptions, prop } from '@typegoose/typegoose'
|
||||
|
||||
import { BaseModel } from '~/shared/model/base.model'
|
||||
|
||||
|
||||
@@ -9,17 +9,18 @@ import {
|
||||
Logger,
|
||||
UnprocessableEntityException,
|
||||
} from '@nestjs/common'
|
||||
import { ReturnModelType } from '@typegoose/typegoose'
|
||||
import type { ReturnModelType } from '@typegoose/typegoose'
|
||||
|
||||
import { MasterLostException } from '~/common/exceptions/master-lost.exception'
|
||||
import { RedisKeys } from '~/constants/cache.constant'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
import { getAvatar, sleep } from '~/utils'
|
||||
import { getRedisKey } from '~/utils/redis.util'
|
||||
|
||||
import { AuthService } from '../auth/auth.service'
|
||||
import { UserDocument, UserModel } from './user.model'
|
||||
import type { AuthService } from '../auth/auth.service'
|
||||
import type { UserDocument } from './user.model'
|
||||
import { UserModel } from './user.model'
|
||||
|
||||
@Injectable()
|
||||
export class UserService {
|
||||
|
||||
9
src/processors/cache/cache.config.service.ts
vendored
9
src/processors/cache/cache.config.service.ts
vendored
@@ -5,13 +5,10 @@
|
||||
* @author Surmon <https://github.com/surmon-china>
|
||||
*/
|
||||
import redisStore from 'cache-manager-ioredis'
|
||||
import { RedisOptions } from 'ioredis'
|
||||
import type { RedisOptions } from 'ioredis'
|
||||
|
||||
import {
|
||||
CacheModuleOptions,
|
||||
CacheOptionsFactory,
|
||||
Injectable,
|
||||
} from '@nestjs/common'
|
||||
import type { CacheModuleOptions, CacheOptionsFactory } from '@nestjs/common'
|
||||
import { Injectable } from '@nestjs/common'
|
||||
|
||||
import { REDIS } from '~/app.config'
|
||||
|
||||
|
||||
4
src/processors/cache/cache.service.ts
vendored
4
src/processors/cache/cache.service.ts
vendored
@@ -1,5 +1,5 @@
|
||||
import { Cache } from 'cache-manager'
|
||||
import { Redis } from 'ioredis'
|
||||
import type { Cache } from 'cache-manager'
|
||||
import type { Redis } from 'ioredis'
|
||||
|
||||
import { CACHE_MANAGER, Inject, Injectable, Logger } from '@nestjs/common'
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Inject, Injectable } from '@nestjs/common'
|
||||
import { ReturnModelType, mongoose } from '@typegoose/typegoose'
|
||||
import type { ReturnModelType, mongoose } from '@typegoose/typegoose'
|
||||
|
||||
import { DB_CONNECTION_TOKEN } from '~/constants/system.constant'
|
||||
import { NoteModel } from '~/modules/note/note.model'
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import { resolve } from 'path'
|
||||
import SocketIO, { Socket } from 'socket.io'
|
||||
import type { Socket } from 'socket.io'
|
||||
import type SocketIO from 'socket.io'
|
||||
|
||||
import { JwtService } from '@nestjs/jwt'
|
||||
import {
|
||||
import type { JwtService } from '@nestjs/jwt'
|
||||
import type {
|
||||
GatewayMetadata,
|
||||
OnGatewayConnection,
|
||||
OnGatewayDisconnect,
|
||||
SubscribeMessage,
|
||||
WebSocketGateway,
|
||||
} from '@nestjs/websockets'
|
||||
import { SubscribeMessage, WebSocketGateway } from '@nestjs/websockets'
|
||||
|
||||
import { LOG_DIR } from '~/constants/path.constant'
|
||||
import { getTodayLogFilePath } from '~/global/consola.global'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
|
||||
import { BusinessEvents } from '../../../constants/business-event.constant'
|
||||
import { AuthService } from '../../../modules/auth/auth.service'
|
||||
import type { AuthService } from '../../../modules/auth/auth.service'
|
||||
import { createAuthGateway } from '../shared/auth.gateway'
|
||||
|
||||
const AuthGateway = createAuthGateway({ namespace: 'admin', authway: 'jwt' })
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Socket } from 'socket.io'
|
||||
import type { Socket } from 'socket.io'
|
||||
|
||||
import { BusinessEvents } from '~/constants/business-event.constant'
|
||||
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { Namespace, Socket } from 'socket.io'
|
||||
import type { Namespace, Socket } from 'socket.io'
|
||||
|
||||
import { OnEvent } from '@nestjs/event-emitter'
|
||||
import { JwtService } from '@nestjs/jwt'
|
||||
import {
|
||||
import type { JwtService } from '@nestjs/jwt'
|
||||
import type {
|
||||
OnGatewayConnection,
|
||||
OnGatewayDisconnect,
|
||||
WebSocketServer,
|
||||
} from '@nestjs/websockets'
|
||||
import { WebSocketServer } from '@nestjs/websockets'
|
||||
import { Emitter } from '@socket.io/redis-emitter'
|
||||
|
||||
import { EventBusEvents } from '~/constants/event-bus.constant'
|
||||
import { AuthService } from '~/modules/auth/auth.service'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { AuthService } from '~/modules/auth/auth.service'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
|
||||
import { BusinessEvents } from '../../../constants/business-event.constant'
|
||||
import { BoardcastBaseGateway } from '../base.gateway'
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Injectable } from '@nestjs/common'
|
||||
|
||||
import { BusinessEvents } from '~/constants/business-event.constant'
|
||||
import type { BusinessEvents } from '~/constants/business-event.constant'
|
||||
|
||||
import { AdminEventsGateway } from '../admin/events.gateway'
|
||||
import { WebEventsGateway } from '../web/events.gateway'
|
||||
import type { AdminEventsGateway } from '../admin/events.gateway'
|
||||
import type { WebEventsGateway } from '../web/events.gateway'
|
||||
|
||||
@Injectable()
|
||||
export class SharedGateway {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { JwtService } from '@nestjs/jwt'
|
||||
import {
|
||||
import type { JwtService } from '@nestjs/jwt'
|
||||
import type {
|
||||
GatewayMetadata,
|
||||
OnGatewayConnection,
|
||||
OnGatewayDisconnect,
|
||||
WebSocketGateway,
|
||||
} from '@nestjs/websockets'
|
||||
import { WebSocketGateway } from '@nestjs/websockets'
|
||||
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
|
||||
import { AuthService } from '../../../modules/auth/auth.service'
|
||||
import type { AuthService } from '../../../modules/auth/auth.service'
|
||||
import { createAuthGateway } from '../shared/auth.gateway'
|
||||
|
||||
const AuthGateway = createAuthGateway({
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
import { plainToClass } from 'class-transformer'
|
||||
import { validate } from 'class-validator'
|
||||
import SocketIO from 'socket.io'
|
||||
import type SocketIO from 'socket.io'
|
||||
|
||||
import {
|
||||
ConnectedSocket,
|
||||
import type {
|
||||
GatewayMetadata,
|
||||
MessageBody,
|
||||
OnGatewayConnection,
|
||||
OnGatewayDisconnect,
|
||||
} from '@nestjs/websockets'
|
||||
import {
|
||||
ConnectedSocket,
|
||||
MessageBody,
|
||||
SubscribeMessage,
|
||||
WebSocketGateway,
|
||||
WebSocketServer,
|
||||
@@ -17,7 +19,7 @@ import { Emitter } from '@socket.io/redis-emitter'
|
||||
|
||||
import { BusinessEvents } from '~/constants/business-event.constant'
|
||||
import { RedisKeys } from '~/constants/cache.constant'
|
||||
import { CacheService } from '~/processors/cache/cache.service'
|
||||
import type { CacheService } from '~/processors/cache/cache.service'
|
||||
import { getRedisKey } from '~/utils/redis.util'
|
||||
import { getShortDate } from '~/utils/time.util'
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { Injectable, Logger } from '@nestjs/common'
|
||||
|
||||
import { USER_ASSET_DIR } from '~/constants/path.constant'
|
||||
|
||||
import { HttpService } from './helper.http.service'
|
||||
import type { HttpService } from './helper.http.service'
|
||||
|
||||
// 先从 ASSET_DIR 找用户自定义的资源, 没有就从默认的 ASSET_DIR 找, 没有就从网上拉取, 存到默认的 ASSET_DIR
|
||||
@Injectable()
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { Injectable, Logger } from '@nestjs/common'
|
||||
|
||||
import { ArticleType } from '~/constants/article.constant'
|
||||
import type { ArticleType } from '~/constants/article.constant'
|
||||
import { RedisKeys } from '~/constants/cache.constant'
|
||||
import { NoteModel } from '~/modules/note/note.model'
|
||||
import { PostModel } from '~/modules/post/post.model'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
import { getRedisKey } from '~/utils/redis.util'
|
||||
|
||||
import { CacheService } from '../cache/cache.service'
|
||||
import { DatabaseService } from '../database/database.service'
|
||||
import type { CacheService } from '../cache/cache.service'
|
||||
import type { DatabaseService } from '../database/database.service'
|
||||
|
||||
@Injectable()
|
||||
export class CountingService {
|
||||
|
||||
@@ -18,7 +18,7 @@ import { LOG_DIR, TEMP_DIR } from '~/constants/path.constant'
|
||||
import { AggregateService } from '~/modules/aggregate/aggregate.service'
|
||||
import { AnalyzeModel } from '~/modules/analyze/analyze.model'
|
||||
import { BackupService } from '~/modules/backup/backup.service'
|
||||
import { ConfigsService } from '~/modules/configs/configs.service'
|
||||
import type { ConfigsService } from '~/modules/configs/configs.service'
|
||||
import { NoteService } from '~/modules/note/note.service'
|
||||
import { PageService } from '~/modules/page/page.service'
|
||||
import { PostService } from '~/modules/post/post.service'
|
||||
@@ -26,8 +26,8 @@ import { SearchService } from '~/modules/search/search.service'
|
||||
import { InjectModel } from '~/transformers/model.transformer'
|
||||
import { getRedisKey } from '~/utils/redis.util'
|
||||
|
||||
import { CacheService } from '../cache/cache.service'
|
||||
import { HttpService } from './helper.http.service'
|
||||
import type { CacheService } from '../cache/cache.service'
|
||||
import type { HttpService } from './helper.http.service'
|
||||
|
||||
@Injectable()
|
||||
export class CronService {
|
||||
|
||||
@@ -7,10 +7,10 @@ import { Injectable, Logger } from '@nestjs/common'
|
||||
import { OnEvent } from '@nestjs/event-emitter'
|
||||
|
||||
import { EventBusEvents } from '~/constants/event-bus.constant'
|
||||
import { ConfigsService } from '~/modules/configs/configs.service'
|
||||
import type { ConfigsService } from '~/modules/configs/configs.service'
|
||||
|
||||
import { CacheService } from '../cache/cache.service'
|
||||
import { AssetService } from './helper.asset.service'
|
||||
import type { CacheService } from '../cache/cache.service'
|
||||
import type { AssetService } from './helper.asset.service'
|
||||
|
||||
export enum ReplyMailType {
|
||||
Owner = 'owner',
|
||||
|
||||
@@ -3,13 +3,14 @@ import { merge } from 'lodash'
|
||||
import { Injectable, Logger } from '@nestjs/common'
|
||||
import { EventEmitter2 } from '@nestjs/event-emitter'
|
||||
|
||||
import { BusinessEvents, EventScope } from '~/constants/business-event.constant'
|
||||
import { EventBusEvents } from '~/constants/event-bus.constant'
|
||||
import type { BusinessEvents } from '~/constants/business-event.constant'
|
||||
import { EventScope } from '~/constants/business-event.constant'
|
||||
import type { EventBusEvents } from '~/constants/event-bus.constant'
|
||||
|
||||
import { AdminEventsGateway } from '../gateway/admin/events.gateway'
|
||||
import type { AdminEventsGateway } from '../gateway/admin/events.gateway'
|
||||
import { BoardcastBaseGateway } from '../gateway/base.gateway'
|
||||
import { SystemEventsGateway } from '../gateway/system/events.gateway'
|
||||
import { WebEventsGateway } from '../gateway/web/events.gateway'
|
||||
import type { SystemEventsGateway } from '../gateway/system/events.gateway'
|
||||
import type { WebEventsGateway } from '../gateway/web/events.gateway'
|
||||
|
||||
export type EventManagerOptions = {
|
||||
scope?: EventScope
|
||||
|
||||
@@ -9,7 +9,7 @@ import { RedisKeys } from '~/constants/cache.constant'
|
||||
import { getRedisKey } from '~/utils'
|
||||
|
||||
import { version } from '../../../package.json'
|
||||
import { CacheService } from '../cache/cache.service'
|
||||
import type { CacheService } from '../cache/cache.service'
|
||||
|
||||
@Injectable()
|
||||
export class HttpService {
|
||||
|
||||
@@ -5,13 +5,16 @@ import {
|
||||
InternalServerErrorException,
|
||||
Logger,
|
||||
} from '@nestjs/common'
|
||||
import { ReturnModelType } from '@typegoose/typegoose'
|
||||
import type { ReturnModelType } from '@typegoose/typegoose'
|
||||
|
||||
import { ConfigsService } from '~/modules/configs/configs.service'
|
||||
import { TextImageRecordType, WriteBaseModel } from '~/shared/model/base.model'
|
||||
import type { ConfigsService } from '~/modules/configs/configs.service'
|
||||
import type {
|
||||
TextImageRecordType,
|
||||
WriteBaseModel,
|
||||
} from '~/shared/model/base.model'
|
||||
import { getAverageRGB, pickImagesFromMarkdown } from '~/utils/pic.util'
|
||||
|
||||
import { HttpService } from './helper.http.service'
|
||||
import type { HttpService } from './helper.http.service'
|
||||
|
||||
@Injectable()
|
||||
export class ImageService {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user