aboutsummaryrefslogtreecommitdiff
path: root/src/lib/models/shared/MemberCount.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-04-24 23:04:49 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2022-04-24 23:04:49 -0400
commit40f9581991e12082a2708fa8fdd454c080f67a4b (patch)
tree99160efeb7eff8835099c6adfd4c6bf0a1dd6342 /src/lib/models/shared/MemberCount.ts
parent5c9ec9e5c5529bae1da0573c9d4edf84ffd986d4 (diff)
downloadtanzanite-40f9581991e12082a2708fa8fdd454c080f67a4b.tar.gz
tanzanite-40f9581991e12082a2708fa8fdd454c080f67a4b.tar.bz2
tanzanite-40f9581991e12082a2708fa8fdd454c080f67a4b.zip
add member ship tracking because I want to make graph
Diffstat (limited to 'src/lib/models/shared/MemberCount.ts')
-rw-r--r--src/lib/models/shared/MemberCount.ts38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/lib/models/shared/MemberCount.ts b/src/lib/models/shared/MemberCount.ts
new file mode 100644
index 0000000..409d1ac
--- /dev/null
+++ b/src/lib/models/shared/MemberCount.ts
@@ -0,0 +1,38 @@
+import { type Sequelize } from 'sequelize';
+const { DataTypes, Model } = (await import('sequelize')).default;
+
+export interface MemberCountModel {
+ timestamp: Date;
+ guildId: string;
+ memberCount: number;
+}
+
+export interface MemberCountCreationAttributes {
+ timestamp?: Date;
+ guildId: string;
+ memberCount: number;
+}
+
+/**
+ * Data specific to a certain instance of the bot.
+ */
+export class MemberCount extends Model<MemberCountModel, MemberCountCreationAttributes> implements MemberCountModel {
+ public declare timestamp: Date;
+ public declare guildId: string;
+ public declare memberCount: number;
+
+ /**
+ * Initializes the model.
+ * @param sequelize The sequelize instance.
+ */
+ public static initModel(sequelize: Sequelize): void {
+ MemberCount.init(
+ {
+ timestamp: { type: DataTypes.DATE, allowNull: false, defaultValue: DataTypes.NOW },
+ guildId: { type: DataTypes.STRING, allowNull: false },
+ memberCount: { type: DataTypes.BIGINT, allowNull: false }
+ },
+ { sequelize, timestamps: false }
+ );
+ }
+}