Skip to content

Commit

Permalink
commented out inputparseerror block from create todo use case
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolovlazar committed Sep 29, 2024
1 parent 9835436 commit 9ce6465
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/application/use-cases/todos/create-todo.use-case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { startSpan } from "@sentry/nextjs";

import { getInjection } from "@/di/container";
import type { Todo } from "@/src/entities/models/todo";
import { InputParseError } from "@/src/entities/errors/common";

export function createTodoUseCase(
input: {
Expand All @@ -18,9 +17,11 @@ export function createTodoUseCase(

// HINT: this is where you'd do authorization checks - is this user authorized to create a todo
// for example: free users are allowed only 5 todos, throw an UnauthorizedError if more than 5
if (input.todo.length < 4) {
throw new InputParseError("Todo must be at least 4 chars");
}

// Uncomment these lines to test the transactions feature (atomic repositories video)
// if (input.todo.length < 4) {
// throw new InputParseError("Todo must be at least 4 chars");
// }

const newTodo = await todosRepository.createTodo(
{
Expand Down

0 comments on commit 9ce6465

Please sign in to comment.