Refactor to more consistent structure (e.g. "plugins")

This commit is contained in:
2025-07-06 15:23:03 -04:00
parent a6255de889
commit 6fb38d36f3
22 changed files with 567 additions and 600 deletions

41
plugins/remind/models.ts Normal file
View File

@@ -0,0 +1,41 @@
import { BOOLEAN, DATE, INTEGER, Model, Sequelize, TEXT } from "sequelize";
export class Reminder extends Model {
declare id: number;
declare userId: string;
declare text: string | null;
declare trigger: Date;
declare isValid: boolean;
declare requestChannel: string;
declare requestMessage: string;
}
export function initializeModels(sequelize: Sequelize) {
Reminder.init(
{
id: {
type: INTEGER,
primaryKey: true,
autoIncrement: true,
},
userId: {
type: TEXT,
allowNull: false,
},
text: TEXT,
trigger: {
type: DATE,
allowNull: false,
},
isValid: BOOLEAN,
requestChannel: TEXT,
requestMessage: TEXT,
},
{sequelize},
);
// await Reminder.sync(); // TODO
}
export async function syncModels() {
await Reminder.sync();
}