fix:post can custom created fixes #1410
Signed-off-by: Innei <i@innei.in>
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user