Generate IDs for entities by default
This commit is contained in:
parent
add54e6b68
commit
550b830f46
@ -3,6 +3,7 @@ import {
|
|||||||
BaseEntity,
|
BaseEntity,
|
||||||
BeforeInsert,
|
BeforeInsert,
|
||||||
BeforeUpdate,
|
BeforeUpdate,
|
||||||
|
DeepPartial,
|
||||||
FindOptionsWhere,
|
FindOptionsWhere,
|
||||||
ObjectIdColumn,
|
ObjectIdColumn,
|
||||||
PrimaryColumn,
|
PrimaryColumn,
|
||||||
@ -66,7 +67,7 @@ export const PrimaryIdColumn = process.env.DATABASE?.startsWith("mongodb")
|
|||||||
|
|
||||||
export class BaseClass extends BaseClassWithoutId {
|
export class BaseClass extends BaseClassWithoutId {
|
||||||
@PrimaryIdColumn()
|
@PrimaryIdColumn()
|
||||||
id: string;
|
id: string = Snowflake.generate();
|
||||||
|
|
||||||
@BeforeUpdate()
|
@BeforeUpdate()
|
||||||
@BeforeInsert()
|
@BeforeInsert()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user