Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: ♻️ Tasks module #125

Merged
merged 10 commits into from
Dec 17, 2024
Merged

Conversation

zhumeisongsong
Copy link
Owner

@zhumeisongsong zhumeisongsong commented Dec 17, 2024

Summary by CodeRabbit

  • New Features

    • Introduced new use case classes for managing user tasks: GetAllUserTasksUseCase, CreateSomeUserTasksUseCase, and UpdateSomeUserTasksUseCase.
    • Added test suites for CreateSomeUserTasksUseCase and GetAllUserTasksUseCase.
  • Bug Fixes

    • Updated UserTasksService to ensure correct return types for task retrieval methods.
  • Documentation

    • Enhanced export statements in the domain index file for better clarity.
  • Refactor

    • Reorganized dependencies in the UserTasksResolver and TasksResolver classes to utilize use cases instead of services.
  • Tests

    • Improved test coverage for user task functionalities and refined existing test cases for better accuracy.

Copy link

coderabbitai bot commented Dec 17, 2024

Walkthrough

The pull request introduces a significant refactoring of the task retrieval mechanism in the application. The changes involve shifting from a direct repository-based approach to a use case-driven architecture. The TasksService now depends on TasksRepository for task retrieval, while the GetAllTasksUseCase has been introduced to encapsulate this behavior. Additionally, several new use cases for user tasks have been added, along with corresponding updates to test suites and interfaces to reflect the new architectural approach.

Changes

File Change Summary
libs/tasks/application/src/lib/tasks.service.ts Replaced GetAllTasksUseCase with TasksRepository injection, modified findAll method to directly use repository
libs/tasks/application/src/lib/tasks.service.spec.ts Updated test suite to use TasksRepository mock instead of use case
libs/tasks/application/src/lib/use-cases/get-all-tasks.use-case.ts Shifted dependency from TasksRepository to TasksService
libs/tasks/domain/src/index.ts Updated exports, added new repository interface exports
libs/tasks/interface-adapters/src/lib/resolver/tasks.resolver.ts Modified to use GetAllTasksUseCase instead of TasksService
libs/tasks/application/src/lib/use-cases/create-some-user-tasks.use-case.ts Introduced CreateSomeUserTasksUseCase, added execute method
libs/tasks/application/src/lib/use-cases/get-all-user-tasks.use-case.ts Introduced GetAllUserTasksUseCase, added execute method
libs/tasks/application/src/lib/use-cases/update-some-user-tasks.use-case.ts Introduced UpdateSomeUserTasksUseCase, added execute method
libs/tasks/interface-adapters/src/lib/resolver/user-tasks.resolver.ts Updated to use new user task use cases, modified error handling
libs/tasks/interface-adapters/src/lib/resolver/user-tasks.resolver.spec.ts Updated tests to reflect new use case structure for user tasks

Sequence Diagram

sequenceDiagram
    participant Resolver as TasksResolver
    participant UseCase as GetAllTasksUseCase
    participant Service as TasksService
    participant Repository as TasksRepository

    Resolver->>UseCase: execute()
    UseCase->>Service: findAll()
    Service->>Repository: findAll()
    Repository-->>Service: return tasks
    Service-->>UseCase: return tasks
    UseCase-->>Resolver: return tasks
Loading

Possibly related PRs

Poem

🐰 Hopping through code with glee,
Tasks now flow more gracefully!
Use cases dance, repositories sing,
A refactor that makes my rabbit heart swing!
Cleaner paths, simpler design,
Code evolution looks mighty fine! 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (6)
libs/tasks/domain/src/index.ts (1)

1-10: LGTM! Clean organization of domain exports.

The separation of concerns between tasks and user tasks is clear. The shift to interface exports aligns well with the dependency inversion principle.

Consider adding a newline between the task exports (lines 4-5) for consistent spacing with other sections.

libs/tasks/interface-adapters/src/lib/resolver/tasks.resolver.ts (1)

13-15: Consider adding error handling.

The resolver should handle potential errors from the use case execution to ensure proper GraphQL error responses.

 @Query(() => [TaskDto])
 async getTasks(): Promise<TaskDto[]> {
-  return this.getAllTasksUseCase.execute();
+  try {
+    return await this.getAllTasksUseCase.execute();
+  } catch (error) {
+    throw new Error(`Failed to retrieve tasks: ${error.message}`);
+  }
 }
libs/tasks/domain/src/lib/tasks-repository.interface.spec.ts (1)

Line range hint 17-22: Enhance test coverage with more specific assertions.

The current test only verifies the array type and Task instances. Consider adding tests for:

  • Non-empty task arrays
  • Task property validations
  • Error scenarios
 describe('findAll', () => {
   it('should return all tasks', async () => {
     const tasks = await repository.findAll();
     expect(Array.isArray(tasks)).toBe(true);
     expect(tasks.every((task) => task instanceof Task)).toBe(true);
   });
+  
+  it('should return tasks with valid properties', async () => {
+    const mockTask = Task.create('test-id', 'Test Task', 'Description', ['category']);
+    jest.spyOn(repository, 'findAll').mockResolvedValue([mockTask]);
+    
+    const tasks = await repository.findAll();
+    expect(tasks[0].id).toBe('test-id');
+    expect(tasks[0].title).toBe('Test Task');
+    expect(tasks[0].description).toBe('Description');
+    expect(tasks[0].categories).toEqual(['category']);
+  });
 });
libs/tasks/application/src/lib/tasks.service.spec.ts (1)

31-43: Add tests for edge cases and error scenarios.

While the happy path is well tested, consider adding tests for:

  • Empty task list
  • Repository errors
  • Invalid task data
 describe('findMany', () => {
   it('should return all tasks', async () => {
     const mockTasks = [
       Task.create('task-1', 'Task 1', 'Description 1', ['category-1']),
       Task.create('task-2', 'Task 2', 'Description 2', ['category-2']),
     ];
     mockTasksRepository.findAll = jest.fn().mockResolvedValue(mockTasks);

     const result = await service.findAll();

     expect(result).toEqual(mockTasks);
     expect(mockTasksRepository.findAll).toHaveBeenCalled();
   });
+  
+  it('should handle empty task list', async () => {
+    mockTasksRepository.findAll = jest.fn().mockResolvedValue([]);
+    const result = await service.findAll();
+    expect(result).toEqual([]);
+  });
+
+  it('should handle repository errors', async () => {
+    mockTasksRepository.findAll = jest.fn().mockRejectedValue(new Error('DB error'));
+    await expect(service.findAll()).rejects.toThrow('DB error');
+  });
 });
libs/tasks/application/src/lib/use-cases/get-all-tasks.use-case.spec.ts (2)

6-25: Consider enhancing the test setup for better type safety and cleanup.

While the setup is functional, consider these improvements:

 let tasksService: TasksService;
+const mockTasksService = {
+  findAll: jest.fn(),
+} as jest.Mocked<TasksService>;
 
 beforeEach(async () => {
   const module: TestingModule = await Test.createTestingModule({
     providers: [
       GetAllTasksUseCase,
       {
         provide: TasksService,
-        useValue: {
-          findAll: jest.fn(),
-        },
+        useValue: mockTasksService,
       },
     ],
   }).compile();
 
   useCase = module.get<GetAllTasksUseCase>(GetAllTasksUseCase);
   tasksService = module.get<TasksService>(TasksService);
 });
+
+afterEach(() => {
+  jest.clearAllMocks();
+});

27-29: Enhance the initialization test coverage.

Consider adding assertions to verify that the injected dependencies are properly initialized.

 it('should be defined', () => {
   expect(useCase).toBeDefined();
+  expect(tasksService).toBeDefined();
+  expect(tasksService.findAll).toBeDefined();
 });
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 57a6902 and 1a24931.

📒 Files selected for processing (8)
  • libs/tasks/application/src/lib/tasks.service.spec.ts (1 hunks)
  • libs/tasks/application/src/lib/tasks.service.ts (1 hunks)
  • libs/tasks/application/src/lib/use-cases/get-all-tasks.use-case.spec.ts (1 hunks)
  • libs/tasks/application/src/lib/use-cases/get-all-tasks.use-case.ts (1 hunks)
  • libs/tasks/domain/src/index.ts (1 hunks)
  • libs/tasks/domain/src/lib/tasks-repository.interface.spec.ts (1 hunks)
  • libs/tasks/domain/src/lib/user-tasks-repository.interface.spec.ts (1 hunks)
  • libs/tasks/interface-adapters/src/lib/resolver/tasks.resolver.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • libs/tasks/domain/src/lib/user-tasks-repository.interface.spec.ts
🔇 Additional comments (5)
libs/tasks/interface-adapters/src/lib/resolver/tasks.resolver.ts (1)

3-3: LGTM! Good architectural improvement.

The change from TasksService to GetAllTasksUseCase follows clean architecture principles by making the resolver depend directly on its specific use case rather than a general service.

Also applies to: 10-10, 14-14

libs/tasks/domain/src/lib/tasks-repository.interface.spec.ts (1)

2-2: LGTM! Good basic test structure.

The mock implementation and basic interface contract testing are well-structured.

Also applies to: 4-7

libs/tasks/application/src/lib/tasks.service.spec.ts (1)

10-12: LGTM! Good mock setup.

The TasksRepository mock is properly implemented using Jest's mocking capabilities.

libs/tasks/application/src/lib/use-cases/get-all-tasks.use-case.spec.ts (2)

1-5: LGTM! Clean and well-structured imports.

The imports follow NestJS conventions and use path aliases appropriately.


1-50: Verify integration with the new architecture.

The test suite supports the move to a use case-driven architecture. Let's verify the integration with other components:

✅ Verification successful

Let me try another verification strategy with correct command syntax.


The test implementation correctly aligns with the use case-driven architecture

The verification results show proper architectural alignment:

  • The TasksResolver correctly uses GetAllTasksUseCase for task retrieval
  • TasksService is properly decoupled and serves as an application service layer between use cases and repository
  • The repository pattern is consistently implemented with proper dependency injection
  • Other modules (Users, Auth) follow similar architectural patterns with their respective use cases and resolvers
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the architectural changes across the codebase

# Check if TasksService is properly decoupled from use cases
rg -t typescript "class TasksService" -A 10

# Verify that other resolvers follow the same pattern
rg -t typescript "class.*Resolver" -A 10

# Check for any remaining direct repository usage
rg -t typescript "TasksRepository" -A 5

# Look for other use case implementations
fd -e ts "use-case.ts$"

Length of output: 465


Script:

#!/bin/bash
# Check TasksService implementation and its dependencies
rg "class TasksService" --type ts -A 10

# Check resolver implementations
rg "class.*Resolver" --type ts -A 10

# Check for TasksRepository usage
rg "TasksRepository" --type ts -A 5

# Check use case implementations
ast-grep --pattern 'export class $_UseCase {
  $$$
  execute($$$) {
    $$$
  }
}'

Length of output: 16789

@zhumeisongsong zhumeisongsong merged commit 08948f7 into main Dec 17, 2024
4 of 5 checks passed
@zhumeisongsong zhumeisongsong deleted the feature/refactor-task-module branch December 17, 2024 05:57
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

🔭 Outside diff range comments (1)
libs/tasks/application/src/lib/user-tasks.service.ts (1)

Line range hint 10-24: Update return types and implement methods.

Both createSome and updateSome methods need proper implementation and should return more meaningful response types to align with the use case improvements.

Consider this enhancement:

   async createSome(
     userId: string,
     tasks: { id: string; createdAt: Date }[],
-  ): Promise<string> {
+  ): Promise<{ success: boolean; createdCount: number }> {
-    // TODO: Implement this
-    return 'success';
+    const created = await this.userTasksRepository.createMany(userId, tasks);
+    return { success: true, createdCount: created.length };
   }

   async updateSome(
     userId: string,
     userTasks: { id: string; updatedAt: Date }[],
-  ): Promise<string> {
+  ): Promise<{ success: boolean; updatedCount: number }> {
-    // TODO: Implement this
-    return 'success';
+    const updated = await this.userTasksRepository.updateMany(userId, userTasks);
+    return { success: true, updatedCount: updated.length };
   }
🧹 Nitpick comments (14)
libs/tasks/interface-adapters/src/lib/resolver/tasks.resolver.spec.ts (1)

15-18: Consider adding type information to the mock

The mock setup is correct, but could benefit from explicit typing for better maintainability.

Consider this improvement:

  provide: GetAllTasksUseCase,
  useValue: {
-   execute: jest.fn().mockResolvedValue([]),
+   execute: jest.fn<Promise<Task[]>, []>().mockResolvedValue([]),
  },
libs/tasks/interface-adapters/src/lib/resolver/user-tasks.resolver.ts (3)

17-17: Align variable name with class name for consistency.

The variable getUserTasksUseCase in the constructor does not match the class name GetAllUserTasksUseCase. For consistency and readability, consider renaming it to getAllUserTasksUseCase.


30-30: Address the TODO: Implement error codes in exception handling.

The TODO comment indicates an intention to use error codes instead of plain messages. Implementing standardized error codes can improve error handling and client understanding.

Would you like assistance in defining error codes and updating the exception handling?


Line range hint 11-12: Add error handling for use case execution.

Currently, any exceptions thrown by getAllUserTasksUseCase.execute(userId) will bubble up without specific handling. Consider wrapping the call in a try-catch block to handle known exceptions and provide more informative error responses to the client.

libs/tasks/interface-adapters/src/lib/resolver/user-tasks.resolver.spec.ts (1)

85-95: Consider reducing duplication by extracting mapping logic.

In the test, the mapping of mockUserTasks to UserTaskDto mirrors the mapping logic in the resolver. To adhere to the DRY (Don't Repeat Yourself) principle, consider extracting this mapping into a shared utility function used by both the resolver and the test.

libs/tasks/application/src/lib/use-cases/get-all-user-tasks.use-case.ts (1)

11-11: Remove unnecessary await in the return statement.

The await in return await this.userTasksService.findMany(userId); is unnecessary. Since the function is already async, you can directly return the promise, and the caller will handle the resolution.

Apply this change:

-    return await this.userTasksService.findMany(userId);
+    return this.userTasksService.findMany(userId);
libs/tasks/domain/src/lib/user-tasks-repository.interface.ts (1)

4-4: Add JSDoc documentation for findMany method.

For consistency with other methods in the interface, please add documentation explaining the method's purpose and possible exceptions.

+  /**
+   * Retrieves tasks for a specific user
+   * @throws {UserNotFoundError} If user doesn't exist
+   */
   findMany(userId: string): Promise<UserTask[]>;
libs/tasks/interface-adapters/src/lib/tasks.module.ts (1)

7-9: LGTM! Good shift to use case pattern.

The addition of specific use cases (GetAllUserTasks, CreateSomeUserTasks, UpdateSomeUserTasks) aligns well with clean architecture principles and improves separation of concerns.

Consider organizing providers by type for better readability:

 @Module({
   providers: [
+    // Resolvers
     TasksResolver,
-    TasksService,
     UserTasksResolver,
+    
+    // Services
+    TasksService,
     UserTasksService,
+    
+    // Use Cases
     GetAllTasksUseCase,
     GetAllUserTasksUseCase,
     CreateSomeUserTasksUseCase,
     UpdateSomeUserTasksUseCase,
+    
+    // Repositories
     {
       provide: TASKS_REPOSITORY,
       useClass: MongooseTasksRepository,
     },
   ],

Also applies to: 29-31

libs/tasks/domain/src/lib/user-tasks-repository.interface.spec.ts (1)

30-35: Improve test descriptions and add edge cases.

The test description "should return all tasks for a given user" doesn't match the method name findMany. Consider:

  1. Updating test descriptions to match new method names
  2. Adding edge cases such as:
    • Invalid user ID
    • Large number of tasks
    • Error scenarios
-  describe('findAll', () => {
-    it('should return all tasks for a given user', async () => {
+  describe('findMany', () => {
+    it('should return empty array when user has no tasks', async () => {
       const userTasks = await repository.findMany('user-1');
       expect(userTasks).toEqual([]);
     });
+
+    it('should handle invalid user ID', async () => {
+      const userTasks = await repository.findMany('');
+      expect(userTasks).toEqual([]);
+    });
libs/tasks/application/src/lib/use-cases/create-some-user-tasks.use-case.spec.ts (1)

33-36: Consider freezing test dates for consistency.

Using new Date() in test data can lead to inconsistent test results. Consider using a fixed date string or mock date.

     const tasks = [
-      { id: '1', createdAt: new Date() },
-      { id: '2', createdAt: new Date() },
+      { id: '1', createdAt: new Date('2024-01-01T00:00:00.000Z') },
+      { id: '2', createdAt: new Date('2024-01-01T00:00:00.000Z') },
     ];
libs/tasks/application/src/lib/use-cases/get-all-user-tasks.use-case.spec.ts (1)

45-46: Consider using more specific assertions.

Replace toBe with toEqual for object comparison and add type checking.

-      expect(result).toBe(expectedTasks);
+      expect(result).toEqual(expectedTasks);
+      expect(Array.isArray(result)).toBe(true);
+      expect(result[0]).toMatchObject({
+        id: expect.any(String),
+        userId: expect.any(String),
+        status: expect.any(String),
+      });
libs/tasks/application/src/lib/use-cases/update-some-user-tasks.use-case.spec.ts (3)

1-24: Enhance test setup with proper typing and complete mock implementation.

Consider improving the test setup:

  1. Add type safety to the mock implementation
  2. Consider mocking all methods of UserTasksService to prevent undefined behavior
 const module: TestingModule = await Test.createTestingModule({
   providers: [
     UpdateSomeUserTasksUseCase,
     {
       provide: UserTasksService,
-      useValue: {
-        updateSome: jest.fn(),
-      },
+      useValue: {
+        updateSome: jest.fn().mockResolvedValue('success'),
+        // Mock other methods that might be called
+        findMany: jest.fn(),
+        findOne: jest.fn(),
+      } as jest.Mocked<UserTasksService>,
     },
   ],
 }).compile();

26-28: Enhance basic test coverage.

Consider adding tests to verify:

  1. The UserTasksService dependency is properly injected
  2. The use case instance has the expected methods
 it('should be defined', () => {
   expect(useCase).toBeDefined();
+  expect(userTasksService).toBeDefined();
+  expect(useCase.execute).toBeDefined();
 });

1-47: Consider verifying use case independence from implementation details.

The current test structure focuses on functionality but doesn't verify the architectural boundaries. Consider adding tests to ensure:

  1. The use case remains independent of implementation details
  2. The interface contract between the use case and service is properly maintained

This could be achieved by:

  1. Moving the service interface to a separate file
  2. Adding tests to verify the use case only depends on the interface
  3. Adding contract tests to ensure the service implementation matches the interface

Would you like assistance in implementing these architectural improvements?

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a24931 and 73a0eca.

📒 Files selected for processing (18)
  • libs/tasks/application/src/index.ts (1 hunks)
  • libs/tasks/application/src/lib/use-cases/create-some-user-tasks.use-case.spec.ts (1 hunks)
  • libs/tasks/application/src/lib/use-cases/create-some-user-tasks.use-case.ts (1 hunks)
  • libs/tasks/application/src/lib/use-cases/get-all-user-tasks.use-case.spec.ts (1 hunks)
  • libs/tasks/application/src/lib/use-cases/get-all-user-tasks.use-case.ts (1 hunks)
  • libs/tasks/application/src/lib/use-cases/update-some-user-tasks.use-case.spec.ts (1 hunks)
  • libs/tasks/application/src/lib/use-cases/update-some-user-tasks.use-case.ts (1 hunks)
  • libs/tasks/application/src/lib/user-tasks.service.ts (1 hunks)
  • libs/tasks/domain/src/lib/entities/user-task.entity.spec.ts (0 hunks)
  • libs/tasks/domain/src/lib/entities/user-task.entity.ts (0 hunks)
  • libs/tasks/domain/src/lib/user-tasks-repository.interface.spec.ts (2 hunks)
  • libs/tasks/domain/src/lib/user-tasks-repository.interface.ts (1 hunks)
  • libs/tasks/interface-adapters/src/lib/dto/user-task.dto.spec.ts (0 hunks)
  • libs/tasks/interface-adapters/src/lib/dto/user-task.dto.ts (1 hunks)
  • libs/tasks/interface-adapters/src/lib/resolver/tasks.resolver.spec.ts (1 hunks)
  • libs/tasks/interface-adapters/src/lib/resolver/user-tasks.resolver.spec.ts (1 hunks)
  • libs/tasks/interface-adapters/src/lib/resolver/user-tasks.resolver.ts (5 hunks)
  • libs/tasks/interface-adapters/src/lib/tasks.module.ts (2 hunks)
💤 Files with no reviewable changes (3)
  • libs/tasks/domain/src/lib/entities/user-task.entity.spec.ts
  • libs/tasks/interface-adapters/src/lib/dto/user-task.dto.spec.ts
  • libs/tasks/domain/src/lib/entities/user-task.entity.ts
🔇 Additional comments (6)
libs/tasks/interface-adapters/src/lib/resolver/tasks.resolver.spec.ts (2)

2-2: LGTM! Clean dependency injection setup

The changes properly reflect the architectural shift from service-based to use case-based approach, with clear import path and consistent naming conventions.

Also applies to: 8-8


24-24: LGTM! Proper test module initialization

The GetAllTasksUseCase is correctly retrieved from the test module.

libs/tasks/application/src/index.ts (1)

5-9: LGTM! Exports are structured appropriately.

The new exports for user tasks are correctly added and organized under the // user tasks section.

libs/tasks/domain/src/lib/user-tasks-repository.interface.ts (1)

1-1: Verify all consumers of findAll have been updated.

The method rename from findAll to findMany and return type change from Task[] to UserTask[] are breaking changes.

Also applies to: 4-4

libs/tasks/interface-adapters/src/lib/dto/user-task.dto.ts (1)

36-43: LGTM! Clean removal of task property.

The constructor parameters and class properties are properly aligned after removing the task property. All necessary decorators and validations remain intact.

libs/tasks/domain/src/lib/user-tasks-repository.interface.spec.ts (1)

1-2: LGTM! Clean transition to UserTask domain model.

The import changes correctly reflect the new domain model structure, maintaining a clear separation of concerns.

Copy link

🎉 This PR is included in version 1.19.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant