refactor(task): Move task read logic into package service - #136
Conversation
|
No actionable comments were generated in the recent review. 🎉 WalkthroughRefactors task read logic into a new service package ( Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Route as API Route
participant Service as TaskReadService
participant Repo as TaskReadRepository
participant Prisma as Prisma
Client->>Route: request list/find task(s)
Route->>Service: createTaskReadService(prisma)
Route->>Service: call listTasks / findTaskById / listTasksHistory
Service->>Repo: delegate call with normalized options
Repo->>Prisma: prisma.task.findMany / count / findFirst
Prisma-->>Repo: results
Repo-->>Service: tasks + pagination
Service-->>Route: TaskListResult / Task
Route-->>Client: response (serialized)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
The task package lacked its own vitest.config.ts, causing vitest to fall back to the root config which references a setup file that doesn't exist relative to the package directory.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/task/src/repositories/task-read.repository.ts (1)
1-6: Remove unusedTaskimport.The
Tasktype is imported but not directly used in this file. The return typeTaskListResult(which containsTask[]) is imported fromtypes.server.ts, so the explicitTaskimport here is redundant.♻️ Suggested fix
-import type { Prisma, Task } from "@prisma/client"; +import type { Prisma } from "@prisma/client";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/task/src/repositories/task-read.repository.ts` around lines 1 - 6, Remove the unused Task type import from the top of task-read.repository.ts: eliminate "Task" from the import list that currently reads import type { Prisma, Task } from "@prisma/client"; since the file uses Task only indirectly via TaskListResult (imported from ../types.server), keep the Prisma import if used and adjust the import to import type { Prisma } from "@prisma/client"; so there are no unused imports.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/task/src/repositories/task-read.repository.ts`:
- Around line 1-6: Remove the unused Task type import from the top of
task-read.repository.ts: eliminate "Task" from the import list that currently
reads import type { Prisma, Task } from "@prisma/client"; since the file uses
Task only indirectly via TaskListResult (imported from ../types.server), keep
the Prisma import if used and adjust the import to import type { Prisma } from
"@prisma/client"; so there are no unused imports.
Summary
packages/taskwith a dedicated repository and server read service.TaskSortField,TaskFilter,TaskQueryOptions,TaskListResult) into package exports.createTaskReadServiceinstead of legacylib/tasksread helpers.Testing
Summary by CodeRabbit