icynet-auth-server/src/modules/objects/document/document.entity.ts

41 lines
758 B
TypeScript

import {
Column,
CreateDateColumn,
Entity,
ManyToOne,
PrimaryGeneratedColumn,
UpdateDateColumn,
} from 'typeorm';
import { User } from '../user/user.entity';
@Entity()
export class Document {
@PrimaryGeneratedColumn()
id: number;
@Column({ type: 'text', nullable: false })
title: string;
@Column({ type: 'text', nullable: false })
slug: string;
@Column({ type: 'text', nullable: false })
body: string;
@CreateDateColumn({
type: 'timestamp',
default: () => 'CURRENT_TIMESTAMP(6)',
})
public created_at: Date;
@UpdateDateColumn({
type: 'timestamp',
default: () => 'CURRENT_TIMESTAMP(6)',
onUpdate: 'CURRENT_TIMESTAMP(6)',
})
public updated_at: Date;
@ManyToOne(() => User)
author: User;
}