add content
This commit is contained in:
parent
34c4ac8f86
commit
6386c3f1b3
11
src/modules/content/constants.ts
Normal file
11
src/modules/content/constants.ts
Normal file
@ -0,0 +1,11 @@
|
||||
export enum PostBodyType {
|
||||
HTML = 'html',
|
||||
MD = 'markdown',
|
||||
}
|
||||
|
||||
export enum PostOrder {
|
||||
CREATED = 'createdAt',
|
||||
UPDATED = 'updatedAt',
|
||||
PUBLISHED = 'publishedAt',
|
||||
CUSTOM = 'custom',
|
||||
}
|
38
src/modules/content/entities/post.entity.ts
Normal file
38
src/modules/content/entities/post.entity.ts
Normal file
@ -0,0 +1,38 @@
|
||||
import { Expose } from 'class-transformer';
|
||||
import { BaseEntity, Column, Entity, PrimaryColumn } from 'typeorm';
|
||||
|
||||
import { PostBodyType } from '@/modules/content/constants';
|
||||
|
||||
@Entity('content_posts')
|
||||
export class PostEntity extends BaseEntity {
|
||||
@PrimaryColumn({ type: 'varchar', generated: 'uuid', length: 36 })
|
||||
id: string;
|
||||
|
||||
@Column({ comment: '文章标题' })
|
||||
title: string;
|
||||
|
||||
@Column({ comment: '文章内容', type: 'text' })
|
||||
body: string;
|
||||
|
||||
@Column({ comment: '文章描述', nullable: true })
|
||||
summary?: string;
|
||||
|
||||
@Expose()
|
||||
@Column({ comment: '关键字', type: 'simple-array', nullable: true })
|
||||
keywords?: [];
|
||||
|
||||
@Column({ comment: '文章类型', type: 'varchar', enum: PostBodyType })
|
||||
type: PostBodyType;
|
||||
|
||||
@Column({ comment: '发布时间', type: 'varchar', nullable: true })
|
||||
publishedAt?: Date | null;
|
||||
|
||||
@Column({ comment: '自定义文章排序', default: 0 })
|
||||
customOrder: number;
|
||||
|
||||
@Column({ comment: '创建时间' })
|
||||
createdAt?: Date;
|
||||
|
||||
@Column({ comment: '更新时间' })
|
||||
updatedAt?: Date;
|
||||
}
|
Loading…
Reference in New Issue
Block a user