add content
This commit is contained in:
parent
149623c073
commit
afb44f4d0c
@ -4,7 +4,6 @@ import {
|
||||
Delete,
|
||||
Get,
|
||||
Param,
|
||||
ParseIntPipe,
|
||||
ParseUUIDPipe,
|
||||
Patch,
|
||||
Post,
|
||||
@ -24,7 +23,7 @@ export class PostController {
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
async show(@Param('id', new ParseIntPipe()) id: string) {
|
||||
async show(@Param('id') id: string) {
|
||||
return this.postService.detail(id);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Expose } from 'class-transformer';
|
||||
import { BaseEntity, Column, Entity, PrimaryColumn } from 'typeorm';
|
||||
import { BaseEntity, Column, CreateDateColumn, Entity, PrimaryColumn } from 'typeorm';
|
||||
|
||||
import { PostBodyType } from '@/modules/content/constants';
|
||||
|
||||
@ -30,9 +30,9 @@ export class PostEntity extends BaseEntity {
|
||||
@Column({ comment: '自定义文章排序', default: 0 })
|
||||
customOrder: number;
|
||||
|
||||
@Column({ comment: '创建时间' })
|
||||
@CreateDateColumn({ comment: '创建时间' })
|
||||
createdAt?: Date;
|
||||
|
||||
@Column({ comment: '更新时间' })
|
||||
@Column({ comment: '更新时间', nullable: true })
|
||||
updatedAt?: Date;
|
||||
}
|
||||
|
@ -36,8 +36,9 @@ export class PostService {
|
||||
}
|
||||
|
||||
async update(data: RecordAny) {
|
||||
data.updatedAt = new Date();
|
||||
await this.repository.update(data.id, omit(data, ['id']));
|
||||
return this.delete(data.id);
|
||||
return this.detail(data.id);
|
||||
}
|
||||
|
||||
async delete(id: string) {
|
||||
|
Loading…
Reference in New Issue
Block a user