mirror of https://github.com/fantasticit/think.git
Merge pull request #112 from fantasticit/feat/admin
server: use shortId
This commit is contained in:
commit
14041c2f74
|
@ -1,8 +1,14 @@
|
||||||
import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
|
import { getShortId } from '@helpers/shortid.herlper';
|
||||||
|
import { BeforeInsert, Column, CreateDateColumn, Entity, PrimaryColumn, UpdateDateColumn } from 'typeorm';
|
||||||
|
|
||||||
@Entity('template')
|
@Entity('template')
|
||||||
export class TemplateEntity {
|
export class TemplateEntity {
|
||||||
@PrimaryGeneratedColumn('uuid')
|
@BeforeInsert()
|
||||||
|
getShortId() {
|
||||||
|
this.id = getShortId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PrimaryColumn()
|
||||||
public id: string;
|
public id: string;
|
||||||
|
|
||||||
@Column({ type: 'boolean', default: false, comment: '是否公开' })
|
@Column({ type: 'boolean', default: false, comment: '是否公开' })
|
||||||
|
|
Loading…
Reference in New Issue