Created
February 17, 2024 15:05
-
-
Save asror797/efdfb67f66d825171a77550d80215304 to your computer and use it in GitHub Desktop.
TaskController manages HTTP requests for tasks, logging with APILogger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { APILogger } from '../logger/api.logger'; | |
import { TaskService } from '../service/task.service'; | |
export class TaskController { | |
private taskService: TaskService; | |
private logger: APILogger; | |
constructor() { | |
this.taskService = new TaskService(); | |
this.logger = new APILogger() | |
} | |
async getTasks() { | |
this.logger.info('Controller: getTasks', null) | |
return await this.taskService.getTasks(); | |
} | |
async createTask(task) { | |
this.logger.info('Controller: createTask', task); | |
return await this.taskService.createTask(task); | |
} | |
async updateTask(task) { | |
this.logger.info('Controller: updateTask', task); | |
return await this.taskService.updateTask(task); | |
} | |
async deleteTask(taskId) { | |
this.logger.info('Controller: deleteTask', taskId); | |
return await this.taskService.deleteTask(taskId); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment