summary refs log tree commit diff
path: root/src/util/entities
diff options
context:
space:
mode:
authorSamuel <34555296+Flam3rboy@users.noreply.github.com>2023-03-18 04:11:48 +0100
committerSamuel <34555296+Flam3rboy@users.noreply.github.com>2023-03-18 04:11:48 +0100
commit366c4935a42d5056c51cdbd7c82c2674f1b8b128 (patch)
tree7c3cdc444536d8b1065c9f98d96355d0f5276704 /src/util/entities
parentfix: package-lock.json (diff)
downloadserver-366c4935a42d5056c51cdbd7c82c2674f1b8b128.tar.xz
feat: Database Query Cache
Diffstat (limited to 'src/util/entities')
-rw-r--r--src/util/entities/Application.ts4
-rw-r--r--src/util/entities/Attachment.ts4
-rw-r--r--src/util/entities/AuditLog.ts4
-rw-r--r--src/util/entities/BackupCodes.ts4
-rw-r--r--src/util/entities/Ban.ts4
-rw-r--r--src/util/entities/BaseClass.ts44
-rw-r--r--src/util/entities/Channel.ts4
-rw-r--r--src/util/entities/ClientRelease.ts4
-rw-r--r--src/util/entities/ConnectedAccount.ts4
-rw-r--r--src/util/entities/EmbedCache.ts4
-rw-r--r--src/util/entities/Emoji.ts4
-rw-r--r--src/util/entities/Encryption.ts4
-rw-r--r--src/util/entities/Guild.ts4
-rw-r--r--src/util/entities/Message.ts4
-rw-r--r--src/util/entities/Note.ts4
-rw-r--r--src/util/entities/RateLimit.ts4
-rw-r--r--src/util/entities/ReadState.ts4
-rw-r--r--src/util/entities/Recipient.ts4
-rw-r--r--src/util/entities/Relationship.ts4
-rw-r--r--src/util/entities/Role.ts4
-rw-r--r--src/util/entities/SecurityKey.ts4
-rw-r--r--src/util/entities/Session.ts4
-rw-r--r--src/util/entities/Sticker.ts4
-rw-r--r--src/util/entities/StickerPack.ts4
-rw-r--r--src/util/entities/Team.ts4
-rw-r--r--src/util/entities/TeamMember.ts4
-rw-r--r--src/util/entities/Template.ts4
-rw-r--r--src/util/entities/User.ts4
-rw-r--r--src/util/entities/VoiceState.ts4
-rw-r--r--src/util/entities/Webhook.ts4
30 files changed, 78 insertions, 82 deletions
diff --git a/src/util/entities/Application.ts b/src/util/entities/Application.ts
index 94709320..5613109e 100644
--- a/src/util/entities/Application.ts
+++ b/src/util/entities/Application.ts
@@ -17,12 +17,12 @@
 */
 
 import { Column, Entity, JoinColumn, ManyToOne, OneToOne } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { Team } from "./Team";
 import { User } from "./User";
 
 @Entity("applications")
-export class Application extends BaseClass {
+export class Application extends EntityCache {
 	@Column()
 	name: string;
 
diff --git a/src/util/entities/Attachment.ts b/src/util/entities/Attachment.ts
index fdc1b3f1..da879fad 100644
--- a/src/util/entities/Attachment.ts
+++ b/src/util/entities/Attachment.ts
@@ -25,11 +25,11 @@ import {
 	RelationId,
 } from "typeorm";
 import { URL } from "url";
+import { EntityCache } from "../cache";
 import { deleteFile } from "../util/cdn";
-import { BaseClass } from "./BaseClass";
 
 @Entity("attachments")
-export class Attachment extends BaseClass {
+export class Attachment extends EntityCache {
 	@Column()
 	filename: string; // name of file attached
 
diff --git a/src/util/entities/AuditLog.ts b/src/util/entities/AuditLog.ts
index 0cc2fc04..0c10c6f0 100644
--- a/src/util/entities/AuditLog.ts
+++ b/src/util/entities/AuditLog.ts
@@ -17,7 +17,7 @@
 */
 
 import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { ChannelPermissionOverwrite } from "./Channel";
 import { User } from "./User";
 
@@ -112,7 +112,7 @@ export enum AuditLogEvents {
 }
 
 @Entity("audit_logs")
-export class AuditLog extends BaseClass {
+export class AuditLog extends EntityCache {
 	@JoinColumn({ name: "target_id" })
 	@ManyToOne(() => User)
 	target?: User;
diff --git a/src/util/entities/BackupCodes.ts b/src/util/entities/BackupCodes.ts
index 467e1fe3..d6a38a63 100644
--- a/src/util/entities/BackupCodes.ts
+++ b/src/util/entities/BackupCodes.ts
@@ -17,12 +17,12 @@
 */
 
 import { Column, Entity, JoinColumn, ManyToOne } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { User } from "./User";
 import crypto from "crypto";
 
 @Entity("backup_codes")
-export class BackupCode extends BaseClass {
+export class BackupCode extends EntityCache {
 	@JoinColumn({ name: "user_id" })
 	@ManyToOne(() => User, { onDelete: "CASCADE" })
 	user: User;
diff --git a/src/util/entities/Ban.ts b/src/util/entities/Ban.ts
index 4ed6e201..7accc153 100644
--- a/src/util/entities/Ban.ts
+++ b/src/util/entities/Ban.ts
@@ -17,12 +17,12 @@
 */
 
 import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { Guild } from "./Guild";
 import { User } from "./User";
 
 @Entity("bans")
-export class Ban extends BaseClass {
+export class Ban extends EntityCache {
 	@Column({ nullable: true })
 	@RelationId((ban: Ban) => ban.user)
 	user_id: string;
diff --git a/src/util/entities/BaseClass.ts b/src/util/entities/BaseClass.ts
index 445b3fc9..87b394c5 100644
--- a/src/util/entities/BaseClass.ts
+++ b/src/util/entities/BaseClass.ts
@@ -25,16 +25,12 @@ import {
 	PrimaryColumn,
 } from "typeorm";
 import { Snowflake } from "../util/Snowflake";
-import { getDatabase } from "../util/Database";
 import { OrmUtils } from "../imports/OrmUtils";
+import { getDatabase } from "../util";
 
 export class BaseClassWithoutId extends BaseEntity {
-	private get construct() {
-		return this.constructor;
-	}
-
-	private get metadata() {
-		return getDatabase()?.getMetadata(this.construct);
+	public get metadata() {
+		return getDatabase()?.getMetadata(this.constructor);
 	}
 
 	assign(props: object) {
@@ -61,8 +57,23 @@ export class BaseClassWithoutId extends BaseEntity {
 				),
 		);
 	}
+}
+
+export const PrimaryIdColumn = process.env.DATABASE?.startsWith("mongodb")
+	? ObjectIdColumn
+	: PrimaryColumn;
+
+export class BaseClassWithId extends BaseClassWithoutId {
+	@PrimaryIdColumn()
+	id: string = Snowflake.generate();
+
+	@BeforeUpdate()
+	@BeforeInsert()
+	_do_validate() {
+		if (!this.id) this.id = Snowflake.generate();
+	}
 
-	static increment<T extends BaseClass>(
+	static increment<T extends BaseClassWithId>(
 		conditions: FindOptionsWhere<T>,
 		propertyPath: string,
 		value: number | string,
@@ -71,7 +82,7 @@ export class BaseClassWithoutId extends BaseEntity {
 		return repository.increment(conditions, propertyPath, value);
 	}
 
-	static decrement<T extends BaseClass>(
+	static decrement<T extends BaseClassWithId>(
 		conditions: FindOptionsWhere<T>,
 		propertyPath: string,
 		value: number | string,
@@ -80,18 +91,3 @@ export class BaseClassWithoutId extends BaseEntity {
 		return repository.decrement(conditions, propertyPath, value);
 	}
 }
-
-export const PrimaryIdColumn = process.env.DATABASE?.startsWith("mongodb")
-	? ObjectIdColumn
-	: PrimaryColumn;
-
-export class BaseClass extends BaseClassWithoutId {
-	@PrimaryIdColumn()
-	id: string = Snowflake.generate();
-
-	@BeforeUpdate()
-	@BeforeInsert()
-	_do_validate() {
-		if (!this.id) this.id = Snowflake.generate();
-	}
-}
diff --git a/src/util/entities/Channel.ts b/src/util/entities/Channel.ts
index 1f128713..1cad928b 100644
--- a/src/util/entities/Channel.ts
+++ b/src/util/entities/Channel.ts
@@ -24,7 +24,7 @@ import {
 	OneToMany,
 	RelationId,
 } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { Guild } from "./Guild";
 import { PublicUserProjection, User } from "./User";
 import { HTTPError } from "lambert-server";
@@ -70,7 +70,7 @@ export enum ChannelType {
 }
 
 @Entity("channels")
-export class Channel extends BaseClass {
+export class Channel extends EntityCache {
 	@Column()
 	created_at: Date;
 
diff --git a/src/util/entities/ClientRelease.ts b/src/util/entities/ClientRelease.ts
index 4b8150fd..57710194 100644
--- a/src/util/entities/ClientRelease.ts
+++ b/src/util/entities/ClientRelease.ts
@@ -17,10 +17,10 @@
 */
 
 import { Column, Entity } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 
 @Entity("client_release")
-export class Release extends BaseClass {
+export class Release extends EntityCache {
 	@Column()
 	name: string;
 
diff --git a/src/util/entities/ConnectedAccount.ts b/src/util/entities/ConnectedAccount.ts
index 9f0ce35e..dabdb944 100644
--- a/src/util/entities/ConnectedAccount.ts
+++ b/src/util/entities/ConnectedAccount.ts
@@ -17,7 +17,7 @@
 */
 
 import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { User } from "./User";
 
 export type PublicConnectedAccount = Pick<
@@ -26,7 +26,7 @@ export type PublicConnectedAccount = Pick<
 >;
 
 @Entity("connected_accounts")
-export class ConnectedAccount extends BaseClass {
+export class ConnectedAccount extends EntityCache {
 	@Column({ nullable: true })
 	@RelationId((account: ConnectedAccount) => account.user)
 	user_id: string;
diff --git a/src/util/entities/EmbedCache.ts b/src/util/entities/EmbedCache.ts
index 800ee4e7..fd6db90e 100644
--- a/src/util/entities/EmbedCache.ts
+++ b/src/util/entities/EmbedCache.ts
@@ -16,12 +16,12 @@
 	along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */
 
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { Entity, Column } from "typeorm";
 import { Embed } from "./Message";
 
 @Entity("embed_cache")
-export class EmbedCache extends BaseClass {
+export class EmbedCache extends EntityCache {
 	@Column()
 	url: string;
 
diff --git a/src/util/entities/Emoji.ts b/src/util/entities/Emoji.ts
index 94ce3d54..c7678361 100644
--- a/src/util/entities/Emoji.ts
+++ b/src/util/entities/Emoji.ts
@@ -18,11 +18,11 @@
 
 import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
 import { User } from ".";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { Guild } from "./Guild";
 
 @Entity("emojis")
-export class Emoji extends BaseClass {
+export class Emoji extends EntityCache {
 	@Column()
 	animated: boolean;
 
diff --git a/src/util/entities/Encryption.ts b/src/util/entities/Encryption.ts
index 016b4331..19cb3987 100644
--- a/src/util/entities/Encryption.ts
+++ b/src/util/entities/Encryption.ts
@@ -17,10 +17,10 @@
 */
 
 import { Column, Entity } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 
 @Entity("security_settings")
-export class SecuritySettings extends BaseClass {
+export class SecuritySettings extends EntityCache {
 	@Column({ nullable: true })
 	guild_id: string;
 
diff --git a/src/util/entities/Guild.ts b/src/util/entities/Guild.ts
index c835f5fc..b08e37d1 100644
--- a/src/util/entities/Guild.ts
+++ b/src/util/entities/Guild.ts
@@ -26,7 +26,7 @@ import {
 } from "typeorm";
 import { Config, handleFile, Snowflake } from "..";
 import { Ban } from "./Ban";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { Channel } from "./Channel";
 import { Emoji } from "./Emoji";
 import { Invite } from "./Invite";
@@ -67,7 +67,7 @@ export const PublicGuildRelations = [
 ];
 
 @Entity("guilds")
-export class Guild extends BaseClass {
+export class Guild extends EntityCache {
 	@Column({ nullable: true })
 	@RelationId((guild: Guild) => guild.afk_channel)
 	afk_channel_id?: string;
diff --git a/src/util/entities/Message.ts b/src/util/entities/Message.ts
index fc8c011c..feee84a7 100644
--- a/src/util/entities/Message.ts
+++ b/src/util/entities/Message.ts
@@ -34,7 +34,7 @@ import {
 	OneToMany,
 	RelationId,
 } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { Guild } from "./Guild";
 import { Webhook } from "./Webhook";
 import { Sticker } from "./Sticker";
@@ -70,7 +70,7 @@ export enum MessageType {
 
 @Entity("messages")
 @Index(["channel_id", "id"], { unique: true })
-export class Message extends BaseClass {
+export class Message extends EntityCache {
 	@Column({ nullable: true })
 	@RelationId((message: Message) => message.channel)
 	@Index()
diff --git a/src/util/entities/Note.ts b/src/util/entities/Note.ts
index 0f2a5ce3..9f13b257 100644
--- a/src/util/entities/Note.ts
+++ b/src/util/entities/Note.ts
@@ -17,12 +17,12 @@
 */
 
 import { Column, Entity, JoinColumn, ManyToOne, Unique } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { User } from "./User";
 
 @Entity("notes")
 @Unique(["owner", "target"])
-export class Note extends BaseClass {
+export class Note extends EntityCache {
 	@JoinColumn({ name: "owner_id" })
 	@ManyToOne(() => User, { onDelete: "CASCADE" })
 	owner: User;
diff --git a/src/util/entities/RateLimit.ts b/src/util/entities/RateLimit.ts
index 79ebbb01..23f0952c 100644
--- a/src/util/entities/RateLimit.ts
+++ b/src/util/entities/RateLimit.ts
@@ -17,10 +17,10 @@
 */
 
 import { Column, Entity } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 
 @Entity("rate_limits")
-export class RateLimit extends BaseClass {
+export class RateLimit extends EntityCache {
 	@Column() // no relation as it also
 	executor_id: string;
 
diff --git a/src/util/entities/ReadState.ts b/src/util/entities/ReadState.ts
index 825beb03..d39bfb4b 100644
--- a/src/util/entities/ReadState.ts
+++ b/src/util/entities/ReadState.ts
@@ -24,7 +24,7 @@ import {
 	ManyToOne,
 	RelationId,
 } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { Channel } from "./Channel";
 import { User } from "./User";
 
@@ -34,7 +34,7 @@ import { User } from "./User";
 
 @Entity("read_states")
 @Index(["channel_id", "user_id"], { unique: true })
-export class ReadState extends BaseClass {
+export class ReadState extends EntityCache {
 	@Column()
 	@RelationId((read_state: ReadState) => read_state.channel)
 	channel_id: string;
diff --git a/src/util/entities/Recipient.ts b/src/util/entities/Recipient.ts
index 1cf028dd..4c301827 100644
--- a/src/util/entities/Recipient.ts
+++ b/src/util/entities/Recipient.ts
@@ -17,10 +17,10 @@
 */
 
 import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 
 @Entity("recipients")
-export class Recipient extends BaseClass {
+export class Recipient extends EntityCache {
 	@Column()
 	@RelationId((recipient: Recipient) => recipient.channel)
 	channel_id: string;
diff --git a/src/util/entities/Relationship.ts b/src/util/entities/Relationship.ts
index 1bf04c2c..48fbc81d 100644
--- a/src/util/entities/Relationship.ts
+++ b/src/util/entities/Relationship.ts
@@ -24,7 +24,7 @@ import {
 	ManyToOne,
 	RelationId,
 } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { User } from "./User";
 
 export enum RelationshipType {
@@ -36,7 +36,7 @@ export enum RelationshipType {
 
 @Entity("relationships")
 @Index(["from_id", "to_id"], { unique: true })
-export class Relationship extends BaseClass {
+export class Relationship extends EntityCache {
 	@Column({})
 	@RelationId((relationship: Relationship) => relationship.from)
 	from_id: string;
diff --git a/src/util/entities/Role.ts b/src/util/entities/Role.ts
index d3275ede..c44fa2b1 100644
--- a/src/util/entities/Role.ts
+++ b/src/util/entities/Role.ts
@@ -18,11 +18,11 @@
 
 import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
 
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { Guild } from "./Guild";
 
 @Entity("roles")
-export class Role extends BaseClass {
+export class Role extends EntityCache {
 	@Column({ nullable: true })
 	@RelationId((role: Role) => role.guild)
 	guild_id: string;
diff --git a/src/util/entities/SecurityKey.ts b/src/util/entities/SecurityKey.ts
index 8f377d9d..86e5531e 100644
--- a/src/util/entities/SecurityKey.ts
+++ b/src/util/entities/SecurityKey.ts
@@ -17,11 +17,11 @@
 */
 
 import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { User } from "./User";
 
 @Entity("security_keys")
-export class SecurityKey extends BaseClass {
+export class SecurityKey extends EntityCache {
 	@Column({ nullable: true })
 	@RelationId((key: SecurityKey) => key.user)
 	user_id: string;
diff --git a/src/util/entities/Session.ts b/src/util/entities/Session.ts
index f416b9f5..f6e16916 100644
--- a/src/util/entities/Session.ts
+++ b/src/util/entities/Session.ts
@@ -17,7 +17,7 @@
 */
 
 import { User } from "./User";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
 import { Status } from "../interfaces/Status";
 import { Activity } from "../interfaces/Activity";
@@ -25,7 +25,7 @@ import { Activity } from "../interfaces/Activity";
 //TODO we need to remove all sessions on server start because if the server crashes without closing websockets it won't delete them
 
 @Entity("sessions")
-export class Session extends BaseClass {
+export class Session extends EntityCache {
 	@Column({ nullable: true })
 	@RelationId((session: Session) => session.user)
 	user_id: string;
diff --git a/src/util/entities/Sticker.ts b/src/util/entities/Sticker.ts
index 513a4c9f..dd3d39dd 100644
--- a/src/util/entities/Sticker.ts
+++ b/src/util/entities/Sticker.ts
@@ -18,7 +18,7 @@
 
 import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
 import { User } from "./User";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { Guild } from "./Guild";
 
 export enum StickerType {
@@ -34,7 +34,7 @@ export enum StickerFormatType {
 }
 
 @Entity("stickers")
-export class Sticker extends BaseClass {
+export class Sticker extends EntityCache {
 	@Column()
 	name: string;
 
diff --git a/src/util/entities/StickerPack.ts b/src/util/entities/StickerPack.ts
index ce8d5e87..ad1a9c0f 100644
--- a/src/util/entities/StickerPack.ts
+++ b/src/util/entities/StickerPack.ts
@@ -25,10 +25,10 @@ import {
 	RelationId,
 } from "typeorm";
 import { Sticker } from ".";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 
 @Entity("sticker_packs")
-export class StickerPack extends BaseClass {
+export class StickerPack extends EntityCache {
 	@Column()
 	name: string;
 
diff --git a/src/util/entities/Team.ts b/src/util/entities/Team.ts
index 82859409..5b86bfa6 100644
--- a/src/util/entities/Team.ts
+++ b/src/util/entities/Team.ts
@@ -24,12 +24,12 @@ import {
 	OneToMany,
 	RelationId,
 } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { TeamMember } from "./TeamMember";
 import { User } from "./User";
 
 @Entity("teams")
-export class Team extends BaseClass {
+export class Team extends EntityCache {
 	@Column({ nullable: true })
 	icon?: string;
 
diff --git a/src/util/entities/TeamMember.ts b/src/util/entities/TeamMember.ts
index df70050c..c8c07ea9 100644
--- a/src/util/entities/TeamMember.ts
+++ b/src/util/entities/TeamMember.ts
@@ -17,7 +17,7 @@
 */
 
 import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { User } from "./User";
 
 export enum TeamMemberState {
@@ -26,7 +26,7 @@ export enum TeamMemberState {
 }
 
 @Entity("team_members")
-export class TeamMember extends BaseClass {
+export class TeamMember extends EntityCache {
 	@Column({ type: "int" })
 	membership_state: TeamMemberState;
 
diff --git a/src/util/entities/Template.ts b/src/util/entities/Template.ts
index 17f26e1c..7349367c 100644
--- a/src/util/entities/Template.ts
+++ b/src/util/entities/Template.ts
@@ -17,12 +17,12 @@
 */
 
 import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { Guild } from "./Guild";
 import { User } from "./User";
 
 @Entity("templates")
-export class Template extends BaseClass {
+export class Template extends EntityCache {
 	@Column({ unique: true })
 	code: string;
 
diff --git a/src/util/entities/User.ts b/src/util/entities/User.ts
index f99a85e7..2b182c16 100644
--- a/src/util/entities/User.ts
+++ b/src/util/entities/User.ts
@@ -34,7 +34,7 @@ import {
 	trimSpecial,
 } from "..";
 import { BitField } from "../util/BitField";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { ConnectedAccount } from "./ConnectedAccount";
 import { Member } from "./Member";
 import { Relationship } from "./Relationship";
@@ -94,7 +94,7 @@ export interface UserPrivate extends Pick<User, PrivateUserKeys> {
 }
 
 @Entity("users")
-export class User extends BaseClass {
+export class User extends EntityCache {
 	@Column()
 	username: string; // username max length 32, min 2 (should be configurable)
 
diff --git a/src/util/entities/VoiceState.ts b/src/util/entities/VoiceState.ts
index f790945f..32d94ed1 100644
--- a/src/util/entities/VoiceState.ts
+++ b/src/util/entities/VoiceState.ts
@@ -17,7 +17,7 @@
 */
 
 import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { Channel } from "./Channel";
 import { Guild } from "./Guild";
 import { User } from "./User";
@@ -25,7 +25,7 @@ import { Member } from "./Member";
 
 //https://gist.github.com/vassjozsef/e482c65df6ee1facaace8b3c9ff66145#file-voice_state-ex
 @Entity("voice_states")
-export class VoiceState extends BaseClass {
+export class VoiceState extends EntityCache {
 	@Column({ nullable: true })
 	@RelationId((voice_state: VoiceState) => voice_state.guild)
 	guild_id: string;
diff --git a/src/util/entities/Webhook.ts b/src/util/entities/Webhook.ts
index 9be86c6d..3e845ddc 100644
--- a/src/util/entities/Webhook.ts
+++ b/src/util/entities/Webhook.ts
@@ -18,7 +18,7 @@
 
 import { Column, Entity, JoinColumn, ManyToOne, RelationId } from "typeorm";
 import { Application } from "./Application";
-import { BaseClass } from "./BaseClass";
+import { EntityCache } from "../cache";
 import { Channel } from "./Channel";
 import { Guild } from "./Guild";
 import { User } from "./User";
@@ -30,7 +30,7 @@ export enum WebhookType {
 }
 
 @Entity("webhooks")
-export class Webhook extends BaseClass {
+export class Webhook extends EntityCache {
 	@Column({ type: "int" })
 	type: WebhookType;