2025-07-22 14:04:38 +02:00

30 lines
863 B
TypeScript

import { IEntity } from "./IEntity";
import { IQuery } from "./IQuery";
export class Task implements IEntity {
title: string;
daysToRedo?: number;
lastDone?: number;
id?: number;
category?: number;
constructor(title: string, daysToRedo?: number, category?: number, lastDone?: number, id?: number) {
this.id = id;
this.title = title;
this.daysToRedo = daysToRedo;
this.category = category;
this.lastDone = lastDone ?? Date.now()
}
}
export const TaskQuery: IQuery = {
tableName: "tasks",
tableQuery: `CREATE TABLE IF NOT EXISTS tasks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
title TEXT NOT NULL,
daysToRedo INTEGER NOT NULL,
lastDone number NOT NULL,
category INTEGER NOT NULL,
FOREIGN KEY (category) REFERENCES categories(id)
);`
};