Merge pull request #112 from fantasticit/feat/admin

server: use shortId
This commit is contained in:
fantasticit 2022-06-29 00:57:45 +08:00 committed by GitHub
commit 14041c2f74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -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: '是否公开' })