delv-task-manager
v0.1.7
Published
test task manager sdk
Downloads
1
Readme
Delv Task Manager
Delv Task Manager is a simple task management library. You can create, delete, and list tasks. Currently only supports the use of MongoDb
Installation
To install Delv Task Manager, use the following command:
npm install delv-task-manager
How to Use
import { TaskManager, MongoDB } from 'delv-task-manager';
const db = new MongoDB('your-mongodb-uri', 'your-database-name', 'your-collection-name');
const taskManager = new TaskManager(db);
async function main() {
await db.connect();
const success = await taskManager.createTask('Test Task', 'This is a test task');
console.log(`Did the task creation work? ${success}`);
const tasks = await taskManager.listTasks();
console.log('Got all these tasks:', tasks);
await db.disconnect();
}
main();
API
TaskManager
The TaskManager class is the main interface for managing tasks. It supports the following methods:
- createTask(title: string, description: string): Promise
- getTask(id: string): Promise<Task | null>
- deleteTask(id: string): Promise
- listTasks(): Promise<Task[]>
MongoDB
The MongoDB class implements the Database interface for MongoDB. It supports the following methods:
- connect(): Promise
- disconnect(): Promise
- createTask(task: Task): Promise
- getTask(id: string): Promise<Task | null>
- deleteTask(id: string): Promise
- listTasks(): Promise<Task[]>