refactor: markdown render stucture

This commit is contained in:
Innei
2021-09-22 21:57:58 +08:00
parent 3087c21f0b
commit ab2dabbdee
9 changed files with 160 additions and 139 deletions

View File

@@ -4,18 +4,16 @@ import {
Get,
HttpCode,
Post,
Req,
} from '@nestjs/common'
import { ApiTags } from '@nestjs/swagger'
import { FastifyReply } from 'fastify'
import { InjectModel } from 'nestjs-typegoose'
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 { RedisKeys } from './constants/cache.constant'
import { OptionModel } from './modules/configs/configs.model'
import { CacheService } from './processors/cache/cache.service'
import { getIp } from './utils/ip.util'
import { getRedisKey } from './utils/redis.util'
@Controller()
@ApiTags('Root')
@@ -55,11 +53,7 @@ export class AppController {
@Post('/like_this')
@HttpCache.disable
@HttpCode(204)
async likeThis(
@Req()
req: FastifyReply,
) {
const ip = getIp(req as any)
async likeThis(@IpLocation() { ip }: IpRecord) {
const redis = this.cacheService.getClient()
const isLikedBefore = await redis.sismember(