aboutsummaryrefslogtreecommitdiff
path: root/src/lib/models/StickyRole.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/models/StickyRole.ts')
-rw-r--r--src/lib/models/StickyRole.ts40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/lib/models/StickyRole.ts b/src/lib/models/StickyRole.ts
new file mode 100644
index 0000000..597d7c5
--- /dev/null
+++ b/src/lib/models/StickyRole.ts
@@ -0,0 +1,40 @@
+import { Snowflake } from 'discord.js';
+import { DataTypes, Sequelize } from 'sequelize';
+import { BaseModel } from './BaseModel';
+
+export interface StickyRoleModel {
+ user: Snowflake;
+ guild: Snowflake;
+ roles: Snowflake[];
+}
+export interface StickyRoleModelCreationAttributes {
+ user: Snowflake;
+ guild: Snowflake;
+ roles: Snowflake[];
+}
+
+export class StickyRole extends BaseModel<StickyRoleModel, StickyRoleModelCreationAttributes> implements StickyRoleModel {
+ user: Snowflake;
+ guild: Snowflake;
+ roles: Snowflake[];
+ static initModel(sequelize: Sequelize): void {
+ StickyRole.init(
+ {
+ user: {
+ type: DataTypes.STRING,
+ allowNull: false
+ },
+ guild: {
+ type: DataTypes.STRING,
+ allowNull: false
+ },
+
+ roles: {
+ type: DataTypes.ARRAY(DataTypes.STRING),
+ allowNull: false
+ }
+ },
+ { sequelize }
+ );
+ }
+}