server: use shortId

This commit is contained in:
fantasticit 2022-06-29 00:56:58 +08:00
parent ce32879386
commit 1b4b33458b
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')
export class TemplateEntity {
@PrimaryGeneratedColumn('uuid')
@BeforeInsert()
getShortId() {
this.id = getShortId();
}
@PrimaryColumn()
public id: string;
@Column({ type: 'boolean', default: false, comment: '是否公开' })