fix:post can custom created fixes #1410

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2024-01-30 18:30:28 +08:00
parent ee53418124
commit abdf931a00

View File

@@ -22,6 +22,7 @@ import { CountingService } from '~/processors/helper/helper.counting.service'
import { MongoIdDto } from '~/shared/dto/id.dto'
import { PagerDto } from '~/shared/dto/pager.dto'
import { addYearCondition } from '~/transformers/db-query.transformer'
import { getLessThanNow } from '~/utils'
import { CategoryAndSlugDto } from './post.dto'
import { PartialPostModel, PostModel } from './post.model'
@@ -197,9 +198,10 @@ export class PostController {
@Auth()
@HTTPDecorators.Idempotence()
async create(@Body() body: PostModel) {
body.created = getLessThanNow(body.created)
return await this.postService.create({
...body,
created: new Date(),
...body,
modified: null,
slug: body.slug,
related: body.relatedId as any,