apisculptify
Version:
Apisculptify is a powerful Node.js tool designed to automate the process of generating RESTful APIs for your TypeORM models. With Apisculptify, you can quickly create a new project, define your TypeORM models, and effortlessly generate CRUD (Create, Read,
37 lines (25 loc) • 849 B
Plain Text
import { Column, PrimaryGeneratedColumn, CreateDateColumn, Index, UpdateDateColumn, BeforeUpdate, BeforeInsert, Generated } from "typeorm";
export abstract class BaseEntity {
()
id: number = 0;
("uuid")
({ unique: true, nullable: false })
uid: string;
()
({ name: "update_at", nullable: false })
updateAt: Date;
()
({ name: "create_at", nullable: false, update: false })
createAt: Date;
({ name: "is_active", default: true, nullable: false })
isActive: boolean
()
private beforeUpdate(): void {
this.updateAt = new Date();
}
()
private beforeCreate(): void {
this.updateAt = new Date();
this.createAt = new Date();
}
}