From cba341a6d6e739ba1be4362ce03472de57c7d35f Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Wed, 1 Sep 2021 23:34:55 +0200 Subject: :bug: fix entity types and projection --- util/src/entities/BaseClass.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'util/src/entities/BaseClass.ts') diff --git a/util/src/entities/BaseClass.ts b/util/src/entities/BaseClass.ts index 0856ccd1..403a6fc6 100644 --- a/util/src/entities/BaseClass.ts +++ b/util/src/entities/BaseClass.ts @@ -8,19 +8,19 @@ import "missing-native-js-functions"; export class BaseClass extends BaseEntity { @PrimaryColumn() - id: string = Snowflake.generate(); + id: string; // @ts-ignore - constructor(public props?: any) { + constructor(private props?: any) { super(); this.assign(props); } - get construct(): any { + private get construct(): any { return this.constructor; } - get metadata() { + private get metadata() { return this.construct.getRepository().metadata as EntityMetadata; } @@ -48,6 +48,8 @@ export class BaseClass extends BaseEntity { this[key] = props[key]; } } + + if (!this.id) this.id = Snowflake.generate(); } @BeforeUpdate() -- cgit 1.5.1