-
Notifications
You must be signed in to change notification settings - Fork 577
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
[Feat] Resource Link Entity #8397
Conversation
WalkthroughThe pull request introduces significant changes to several files, primarily focusing on the renaming of the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Service
participant ActivityLog
participant EntityEnum
User->>Service: Create/Update Task
Service->>ActivityLog: Generate Activity Log Description(EntityEnum.Task)
ActivityLog->>EntityEnum: Use EntityEnum for logging
ActivityLog-->>Service: Log Activity
Service-->>User: Return Response
Possibly related PRs
Suggested reviewers
Poem
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
🧹 Outside diff range and nitpick comments (11)
packages/core/src/resource-link/repository/mikro-orm-resource-link.repository.ts (1)
4-4
: Class definition is correct and follows best practices.The
MikroOrmResourceLinkRepository
class is well-defined, extending the appropriate base class with the correct generic type parameter. This approach promotes code reuse and follows the principle of composition over inheritance.Consider adding a brief class-level JSDoc comment to describe the purpose of this repository class. For example:
/** * Repository for managing ResourceLink entities using MikroORM. */ export class MikroOrmResourceLinkRepository extends MikroOrmBaseEntityRepository<ResourceLink> {}packages/contracts/src/resource-link.model.ts (2)
5-13
: LGTM: IResourceLink interface is well-defined.The interface is comprehensive and includes all necessary properties for a resource link. The use of
EntityEnum
for theentity
property ensures type safety, and the optional properties provide flexibility.Consider adding JSDoc comments to describe the purpose of each property, especially for
metaData
which can be of two different types.
1-19
: Overall, excellent implementation of resource link interfaces.This file demonstrates a strong understanding of TypeScript and interface design. The use of utility types (
Omit
,Partial
,Pick
) is particularly noteworthy, ensuring type safety and flexibility in various operations (create, update, find) on resource links.To further enhance the code:
- Consider adding JSDoc comments for each interface to describe their purpose and usage.
- If
EntityEnum
is extensive, consider adding a type guard or validation function to ensure only valid entities are used.- For
metaData
inIResourceLink
, consider using a union type with a custom interface instead ofstring | IURLMetaData
for more precise typing.These suggestions are minor and the current implementation is already of high quality.
packages/contracts/src/activity-log.model.ts (1)
Line range hint
1-42
: Summary of changes and their impactThe changes in this file are part of a larger refactoring effort to consolidate entity enums. The main modifications include:
- Updating the import statement to include
EntityEnum
.- Changing the
entity
property inIActivityLog
to useEntityEnum
.- Removing the
ActivityLogEntityEnum
.These changes should improve code organization and reduce duplication. However, it's crucial to ensure that these modifications are consistently applied across the entire codebase to prevent any potential issues.
Consider documenting this architectural change in the project's documentation or changelog to inform other developers about the consolidation of entity enums and its implications for future development.
packages/core/src/activity-log/activity-log.entity.ts (1)
17-20
: LGTM. Consider minor formatting improvement.The
@IsEnum
decorator and theentity
property type have been correctly updated to useEntityEnum
. These changes maintain type safety and validation consistency.Consider adding a blank line before the
entity
property declaration to improve readability:@IsEnum(EntityEnum) @ColumnIndex() @MultiORMColumn() + entity: EntityEnum;
packages/core/src/tasks/commands/handlers/task-create.handler.ts (2)
78-85
: LGTM! Consider enhancing error logging.The changes correctly implement the use of
EntityEnum.Task
in place ofActivityLogEntityEnum.Task
. The logic for generating and publishing the activity log remains intact.Consider enhancing the error logging in the catch block to include the task details:
} catch (error) { // Handle errors during task creation - this.logger.error(`Error while creating task: ${error.message}`, error.message); + this.logger.error(`Error while creating task: ${error.message}`, error.stack, { input }); throw new HttpException({ message: error?.message, error }, HttpStatus.BAD_REQUEST); }This change would provide more context when debugging task creation errors.
Line range hint
98-107
: LGTM! Consider security implications of logging.The changes correctly implement the use of
EntityEnum.Task
in the console.log statement. The logged information provides a comprehensive view of the created task and its activity log.However, logging detailed task information, including potentially sensitive data, may pose a security risk in production environments. Consider the following improvements:
- Use a logging level (e.g., debug) that can be easily disabled in production.
- Redact or omit sensitive information from the logged data.
Here's a suggested implementation:
if (process.env.NODE_ENV !== 'production') { const logData = { taskId: task.id, entity: EntityEnum.Task, action: ActionTypeEnum.Created, organizationId, tenantId }; this.logger.debug(`Task created: ${JSON.stringify(logData)}`); }This approach ensures that detailed logging only occurs in non-production environments and limits the exposed information.
packages/core/src/core/entities/index.ts (1)
Line range hint
1-300
: Overall assessment: Changes are correct and consistent.The addition of the
ResourceLink
entity to this file is minimal and follows the existing patterns for importing and exporting core entities. The changes maintain the alphabetical order and structure of both the import list and thecoreEntities
array. These modifications should integrate smoothly with the rest of the codebase.As the codebase grows, consider implementing a more automated approach for managing entity imports and exports, such as using barrel files or code generation tools. This could help reduce the likelihood of manual errors and make it easier to maintain consistency across the project.
packages/core/src/organization-sprint/organization-sprint.service.ts (2)
123-123
: LGTM: EntityEnum usage updated correctly.The changes from
ActivityLogEntityEnum
toEntityEnum
are correctly implemented in both thegenerateActivityLogDescription
function call and theActivityLogEvent
constructor. These updates are consistent with the enum renaming.As a minor suggestion, consider updating the comment above the
generateActivityLogDescription
call to reflect the new enum name for improved code documentation.Also applies to: 130-130
199-199
: LGTM: EntityEnum usage updated correctly in update method.The changes from
ActivityLogEntityEnum
toEntityEnum
are correctly implemented in both thegenerateActivityLogDescription
function call and theActivityLogEvent
constructor within theupdate
method. These updates are consistent with the enum renaming and match the changes made in thecreate
method.For consistency with the suggestion made for the
create
method, consider updating the comment above thegenerateActivityLogDescription
call in this method as well to reflect the new enum name.Also applies to: 222-222
packages/core/src/resource-link/resource-link.entity.ts (1)
58-59
: Update the comment to accurately describe thecreator
propertyThe comment currently states
User comment author
, which may not accurately reflect the purpose of thecreator
property in theResourceLink
entity. Consider updating the comment to something likeUser who created the resource link
for clarity.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (19)
- packages/contracts/src/activity-log.model.ts (1 hunks)
- packages/contracts/src/base-entity.model.ts (1 hunks)
- packages/contracts/src/index.ts (2 hunks)
- packages/contracts/src/resource-link.model.ts (1 hunks)
- packages/core/src/activity-log/activity-log.entity.ts (2 hunks)
- packages/core/src/activity-log/activity-log.helper.ts (2 hunks)
- packages/core/src/activity-log/dto/get-activity-logs.dto.ts (3 hunks)
- packages/core/src/core/entities/index.ts (2 hunks)
- packages/core/src/core/entities/internal.ts (1 hunks)
- packages/core/src/database/migrations/1728798743598-CreateResourceLinkTable.ts (1 hunks)
- packages/core/src/organization-project-module/organization-project-module.service.ts (4 hunks)
- packages/core/src/organization-project/organization-project.service.ts (2 hunks)
- packages/core/src/organization-sprint/organization-sprint.service.ts (4 hunks)
- packages/core/src/resource-link/repository/index.ts (1 hunks)
- packages/core/src/resource-link/repository/mikro-orm-resource-link.repository.ts (1 hunks)
- packages/core/src/resource-link/repository/type-orm-resource-link.repository.ts (1 hunks)
- packages/core/src/resource-link/resource-link.entity.ts (1 hunks)
- packages/core/src/tasks/commands/handlers/task-create.handler.ts (3 hunks)
- packages/core/src/tasks/task.service.ts (3 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/core/src/resource-link/repository/index.ts
🧰 Additional context used
🔇 Additional comments (44)
packages/core/src/resource-link/repository/mikro-orm-resource-link.repository.ts (2)
1-2
: Imports look good!The imports are appropriate and necessary for the implementation of the
MikroOrmResourceLinkRepository
class. They follow a clear and organized project structure.
1-4
: Overall, this is a well-implemented repository class.The
MikroOrmResourceLinkRepository
is correctly set up to handleResourceLink
entities using MikroORM. It follows best practices by extending the base repository class and leveraging inheritance for code reuse. The file structure and naming conventions are consistent with the project's organization.Great job on keeping the implementation concise and focused!
packages/core/src/resource-link/repository/type-orm-resource-link.repository.ts (4)
1-4
: Imports look good!The necessary dependencies are correctly imported, and the import order follows a common convention. There are no unused imports.
6-7
: Class declaration and decorator are well-implemented!The
@Injectable()
decorator is correctly used, allowing for dependency injection. The class properly extendsRepository<ResourceLink>
, following TypeORM's custom repository pattern. The class name adheres to the naming convention for TypeORM repositories.
8-10
: Constructor implementation is correct and follows best practices!The constructor correctly uses
@InjectRepository(ResourceLink)
for dependency injection. The call to the super constructor withrepository.target
,repository.manager
, andrepository.queryRunner
is the proper way to extend theRepository
class in TypeORM. This implementation ensures that the custom repository has access to all the necessary TypeORM functionality.
1-11
: Overall, excellent implementation of the TypeOrmResourceLinkRepository!The file introduces a well-structured and correctly implemented custom repository for the ResourceLink entity. It follows TypeORM and NestJS best practices, including proper use of decorators, dependency injection, and extension of the base Repository class. The code is concise and clear, making it easy to understand and maintain.
packages/contracts/src/resource-link.model.ts (4)
1-3
: LGTM: Import statements are well-organized and relevant.The import statements are concise and import only the necessary types and interfaces. This approach helps maintain a clean and modular codebase.
15-15
: LGTM: IResourceLinkCreateInput is well-defined.The use of the
Omit
utility type to create a new interface based onIResourceLink
without thecreator
andcreatorId
properties is a good TypeScript practice. This approach ensures type safety when creating new resource links.
17-17
: LGTM: IResourceLinkUpdateInput is well-crafted.The interface definition demonstrates advanced use of TypeScript utility types. By using
Partial
andOmit
together, it allows for flexible updates of resource links while preventing changes to core identifiers (entity
andentityId
). This approach ensures type safety and maintains data integrity during updates.
19-19
: LGTM: IResourceLinkFindInput is concise and purposeful.The use of the
Pick
utility type to create a minimal interface for finding resource links is excellent. By selecting only theentity
andentityId
properties, it provides a clear and type-safe way to query resource links based on their core identifiers.packages/core/src/activity-log/activity-log.helper.ts (2)
16-16
: Approve the function signature update and verify its usage.The function signature has been correctly updated to use
EntityEnum
instead ofActivityLogEntityEnum
, which is consistent with the import statement change.To ensure that all callers of this function have been updated accordingly, please run the following script:
#!/bin/bash # Description: Verify the usage of generateActivityLogDescription function # Test 1: Check for any remaining usage of generateActivityLogDescription with ActivityLogEntityEnum echo "Checking for any remaining usage of generateActivityLogDescription with ActivityLogEntityEnum:" rg --type typescript "generateActivityLogDescription\s*\([^)]*ActivityLogEntityEnum" # Test 2: Verify the correct usage of generateActivityLogDescription with EntityEnum echo "Verifying the correct usage of generateActivityLogDescription with EntityEnum:" rg --type typescript "generateActivityLogDescription\s*\([^)]*EntityEnum" # Test 3: List all files using generateActivityLogDescription for manual review echo "Listing all files using generateActivityLogDescription for manual review:" rg --type typescript -l "generateActivityLogDescription"This script will help identify any inconsistencies in the usage of the
generateActivityLogDescription
function across the codebase.
1-1
: Verify the consistency of enum renaming across the codebase.The import statement has been updated to use
EntityEnum
instead ofActivityLogEntityEnum
. This change suggests a broader refactoring of enum types in the project.To ensure consistency and identify any potential issues, please run the following script:
This script will help identify any inconsistencies or files that might need further updates.
✅ Verification successful
Enum renaming is consistent across the codebase.
All instances of
ActivityLogEntityEnum
have been successfully replaced withEntityEnum
, and the new enum is consistently used throughout the repository.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any remaining usage of ActivityLogEntityEnum and verify EntityEnum usage # Test 1: Check for any remaining usage of ActivityLogEntityEnum echo "Checking for any remaining usage of ActivityLogEntityEnum:" rg --type typescript "ActivityLogEntityEnum" # Test 2: Verify the correct usage of EntityEnum echo "Verifying the correct usage of EntityEnum:" rg --type typescript "EntityEnum" # Test 3: Check for any files that might need updating echo "Checking for files that might need updating:" rg --type typescript -l "ActivityLogEntityEnum|EntityEnum"Length of output: 847
Script:
#!/bin/bash # Description: Re-check for any remaining usage of ActivityLogEntityEnum and verify EntityEnum usage with corrected file type. # Test 1: Check for any remaining usage of ActivityLogEntityEnum echo "Checking for any remaining usage of ActivityLogEntityEnum:" rg --type ts "ActivityLogEntityEnum" # Test 2: Verify the correct usage of EntityEnum echo "Verifying the correct usage of EntityEnum:" rg --type ts "EntityEnum" # Test 3: Check for any files that might need updating echo "Checking for files that might need updating:" rg --type ts -l "ActivityLogEntityEnum|EntityEnum"Length of output: 9661
packages/contracts/src/activity-log.model.ts (3)
1-1
: LGTM: Import statement updated correctlyThe import statement has been appropriately updated to include
EntityEnum
from thebase-entity.model
file. This change aligns with the usage ofEntityEnum
in theIActivityLog
interface.
Line range hint
1-42
: Verify completeness ofEntityEnum
and update usagesThe removal of
ActivityLogEntityEnum
is noted. This change simplifies the entity representation by relying onEntityEnum
. However, it's crucial to ensure that this change doesn't introduce any regressions.Please verify the following:
- Ensure that
EntityEnum
inbase-entity.model
covers all the cases that were previously inActivityLogEntityEnum
.- Update all previous usages of
ActivityLogEntityEnum
throughout the codebase.Run the following script to assist with this verification:
#!/bin/bash # Description: Check for any remaining usage of ActivityLogEntityEnum and compare with EntityEnum # Search for any remaining usage of ActivityLogEntityEnum echo "Searching for any remaining usage of ActivityLogEntityEnum:" rg --type typescript "ActivityLogEntityEnum" # Display the contents of EntityEnum for manual verification echo "Contents of EntityEnum (for manual verification):" rg --type typescript -A 20 "export enum EntityEnum"Please review the output to ensure all necessary entities are included in
EntityEnum
and update any remaining usages ofActivityLogEntityEnum
.
8-8
: Verify usage of updatedIActivityLog
interfaceThe change from
ActivityLogEntityEnum
toEntityEnum
for theentity
property is correct and aligns with the removal ofActivityLogEntityEnum
. However, this change might affect other parts of the codebase that use theIActivityLog
interface.Please run the following script to verify the usage of
IActivityLog
and ensure that all occurrences are updated accordingly:✅ Verification successful
Verification Successful: No Remaining Usage of
ActivityLogEntityEnum
The
ActivityLogEntityEnum
is no longer used in the codebase, and theIActivityLog
interface is correctly utilized across various modules. The interface change aligns with the overall codebase updates and poses no issues.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any remaining usage of ActivityLogEntityEnum and verify IActivityLog usage # Search for any remaining usage of ActivityLogEntityEnum echo "Searching for any remaining usage of ActivityLogEntityEnum:" rg --type typescript "ActivityLogEntityEnum" # Search for usage of IActivityLog echo "Verifying usage of IActivityLog:" rg --type typescript "IActivityLog"Length of output: 406
Script:
#!/bin/bash # Description: Check for any remaining usage of ActivityLogEntityEnum and verify IActivityLog usage # Search for any remaining usage of ActivityLogEntityEnum in TypeScript files echo "Searching for any remaining usage of ActivityLogEntityEnum in TypeScript files:" rg --glob "*.ts" --glob "*.tsx" "ActivityLogEntityEnum" # Search for usage of IActivityLog in TypeScript files echo "Verifying usage of IActivityLog in TypeScript files:" rg --glob "*.ts" --glob "*.tsx" "IActivityLog"Length of output: 3656
packages/core/src/activity-log/dto/get-activity-logs.dto.ts (4)
3-3
: LGTM: Import statement updated correctlyThe import statement has been updated to use
EntityEnum
instead ofActivityLogEntityEnum
. This change is consistent with the refactoring mentioned in the summary and appears to be correct.
21-21
: LGTM: Swagger decorator simplifiedThe
@ApiPropertyOptional
decorator for theentity
property has been simplified to directly useEntityEnum
. This change improves readability and is consistent with best practices for using enums with Swagger decorators.
Line range hint
1-58
: Overall assessment: Changes look goodThe changes in this file are consistent with the described refactoring effort to replace
ActivityLogEntityEnum
with a more genericEntityEnum
. The modifications improve code consistency and simplify Swagger decorators. No issues were found in the changes.However, it's important to ensure that this refactoring has been applied consistently across the entire codebase. Please review the results of the verification script to confirm that all necessary updates have been made.
23-24
: LGTM: Entity property type updated correctlyThe
entity
property has been correctly updated to useEntityEnum
for both the@IsEnum
decorator and the property type. This change ensures type safety and proper validation.To ensure consistency across the codebase, please run the following script to verify the usage of
EntityEnum
:✅ Verification successful
Let's correct the shell script to use file extensions instead of the unrecognized
typescript
type.
LGTM: Entity property type updated correctly
The
entity
property has been correctly updated to useEntityEnum
for both the@IsEnum
decorator and the property type. This change ensures type safety and proper validation.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of EntityEnum across the codebase # Test: Search for EntityEnum usage echo "Searching for EntityEnum usage:" rg --type typescript "EntityEnum" -g "!*.spec.ts" # Test: Check for any remaining references to ActivityLogEntityEnum echo "Checking for any remaining references to ActivityLogEntityEnum:" rg --type typescript "ActivityLogEntityEnum" -g "!*.spec.ts"Length of output: 390
Script:
#!/bin/bash # Description: Verify the usage of EntityEnum across the codebase # Test: Search for EntityEnum usage echo "Searching for EntityEnum usage:" rg "EntityEnum" -g "*.ts" -g "*.tsx" # Test: Check for any remaining references to ActivityLogEntityEnum echo "Checking for any remaining references to ActivityLogEntityEnum:" rg "ActivityLogEntityEnum" -g "*.ts" -g "*.tsx"Length of output: 8268
packages/core/src/activity-log/activity-log.entity.ts (3)
15-15
: LGTM. API property updated correctly.The
@ApiProperty
decorator has been properly updated to referenceEntityEnum
. This change ensures that the API documentation remains consistent with the code changes.
Line range hint
1-114
: Summary: Enum renaming implemented correctly.The renaming of
ActivityLogEntityEnum
toEntityEnum
has been consistently applied throughout theActivityLog
entity. The changes maintain the functionality and structure of the class while updating the necessary references. The modifications to imports, decorators, and property types are all in line with the intended change.
6-6
: LGTM. Verify enum usage across the codebase.The import statement has been correctly updated to use
EntityEnum
instead ofActivityLogEntityEnum
. This change is consistent with the renaming of the enum.To ensure that this change doesn't introduce any issues, please verify the usage of
EntityEnum
across the codebase:✅ Verification successful
Verification Successful:
ActivityLogEntityEnum
Renamed toEntityEnum
All references to
ActivityLogEntityEnum
have been successfully removed. TheEntityEnum
is correctly utilized across the codebase without introducing any inconsistencies.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of EntityEnum across the codebase # Test 1: Check for any remaining references to ActivityLogEntityEnum echo "Checking for any remaining references to ActivityLogEntityEnum:" rg --type typescript "ActivityLogEntityEnum" # Test 2: Verify the correct usage of EntityEnum echo "Verifying the correct usage of EntityEnum:" rg --type typescript "EntityEnum"Length of output: 380
Script:
#!/bin/bash # Description: Verify the usage of EntityEnum across the codebase # Test 1: Check for any remaining references to ActivityLogEntityEnum echo "Checking for any remaining references to ActivityLogEntityEnum:" rg --type ts "ActivityLogEntityEnum" # Test 2: Verify the correct usage of EntityEnum echo "Verifying the correct usage of EntityEnum:" rg --type ts "EntityEnum"Length of output: 8268
packages/core/src/tasks/commands/handlers/task-create.handler.ts (1)
3-3
: LGTM! Verify enum usage across the codebase.The import statement has been correctly updated to use
EntityEnum
instead ofActivityLogEntityEnum
. This change is consistent with the refactoring mentioned in the summary.To ensure consistency across the codebase, run the following script to check for any remaining usage of
ActivityLogEntityEnum
:packages/core/src/core/entities/index.ts (2)
120-120
: LGTM: Import statement addition is correct.The
ResourceLink
entity has been properly added to the import list, maintaining the alphabetical order and consistent with the existing structure.
270-270
: LGTM: CoreEntities array updated correctly.The
ResourceLink
entity has been properly added to thecoreEntities
array, maintaining the alphabetical order and consistent with the existing structure. This change ensures that the new entity is exported and available for use in other parts of the application.To ensure the
ResourceLink
entity is properly defined and imported, please run the following verification script:This script will help verify that the
ResourceLink
entity is properly defined and imported, reducing the likelihood of any integration issues.packages/contracts/src/index.ts (3)
108-108
: LGTM: New model export added correctlyThe export statement for 'resource-link.model' has been added correctly, maintaining the alphabetical order and following the existing pattern of export statements in this file.
Line range hint
108-149
: Summary: New model added and EntityEnum exportedThe changes in this file are consistent and well-structured. They include:
- Adding an export for a new 'resource-link.model'.
- Including 'EntityEnum' in the named exports from 'base-entity.model'.
These changes suggest modifications to the underlying models, which may have implications for other parts of the codebase.
To ensure these changes are properly integrated, please run the following verification:
#!/bin/bash # Description: Verify the usage of ResourceLink and EntityEnum in the codebase # Test 1: Check for imports of ResourceLink echo "Checking ResourceLink imports:" rg --type typescript 'import.*ResourceLink' packages # Test 2: Check for usage of EntityEnum echo "Checking EntityEnum usage:" rg --type typescript 'EntityEnum\.' packages # Test 3: Check for any TODOs related to these changes echo "Checking for related TODOs:" rg --type typescript 'TODO.*(?:ResourceLink|EntityEnum)' packagesThis will help ensure that the new model and enum are being used correctly throughout the project.
148-149
: LGTM: EntityEnum added to named exportsThe 'EntityEnum' has been correctly added to the named exports from 'base-entity.model'. The necessary syntactical change (adding a comma after 'JsonData') has been made correctly.
To ensure consistency, please verify the 'EntityEnum' in 'base-entity.model':
✅ Verification successful
Verified: EntityEnum correctly added to named exports
The presence of
EntityEnum
inbase-entity.model.ts
has been confirmed. The named export inindex.ts
has been updated appropriately.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the presence and structure of EntityEnum in base-entity.model.ts # Test: Search for EntityEnum in base-entity.model.ts rg --type typescript -A 10 'export enum EntityEnum' packages/contracts/src/base-entity.model.tsLength of output: 473
Script:
#!/bin/bash # Description: Verify the presence and structure of EntityEnum in base-entity.model.ts # Test: Search for 'export enum EntityEnum' directly in the specified file rg 'export enum EntityEnum' packages/contracts/src/base-entity.model.tsLength of output: 98
packages/core/src/organization-sprint/organization-sprint.service.ts (2)
5-5
: LGTM: Import statement updated correctly.The import of
EntityEnum
from@gauzy/contracts
is consistent with the renaming mentioned in the summary. This change is correctly implemented and maintains the existing import structure.
Line range hint
1-368
: Summary: EntityEnum renaming successfully implemented.The changes in this file consistently and correctly implement the renaming of
ActivityLogEntityEnum
toEntityEnum
. This update affects the import statement and usage within thecreate
andupdate
methods of theOrganizationSprintService
class. The changes are minimal and do not alter the overall logic or functionality of the service.Key points:
- Import statement updated correctly.
EntityEnum
used consistently in activity log generation and event publishing.- No other significant changes or issues introduced.
These changes improve consistency with the rest of the codebase and should not introduce any new bugs or issues. The refactoring appears to be successful and well-executed.
packages/core/src/core/entities/internal.ts (1)
124-124
: LGTM: New entity export added correctly.The new export for
resource-link.entity
has been added correctly:
- It's placed in the appropriate alphabetical order among other entity exports.
- The import path follows the consistent pattern used for other entity imports.
- Adding this entity to the public API of the core module seems intentional, likely to support the new
ResourceLink
functionality mentioned in the PR summary.To ensure the
ResourceLink
entity is properly implemented, let's verify its existence and basic structure:✅ Verification successful
: The
ResourceLink
entity has been successfully added and correctly exported inpackages/core/src/core/entities/internal.ts
. The entity file exists and is properly structured, ensuring seamless integration into the core module's public API.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the ResourceLink entity file exists and check its basic structure if [ -f "packages/core/src/resource-link/resource-link.entity.ts" ]; then echo "ResourceLink entity file exists." echo "File contents:" cat "packages/core/src/resource-link/resource-link.entity.ts" else echo "Error: ResourceLink entity file not found." fiLength of output: 2619
packages/core/src/organization-project-module/organization-project-module.service.ts (3)
6-6
: LGTM: Import statement updated correctlyThe import statement has been updated to use
EntityEnum
instead ofActivityLogEntityEnum
, which is consistent with the reported changes. This modification ensures that the correct enum is imported and used throughout the file.
Line range hint
1-486
: Overall assessment: Changes are consistent and well-implementedThe renaming of
ActivityLogEntityEnum
toEntityEnum
has been carried out consistently throughout this file. The changes are limited to the import statement and usage within thecreate
andupdate
methods, which is in line with the expected scope of the modification. The rest of the file remains unchanged, indicating that existing functionality has been preserved.To ensure the completeness of this change across the entire codebase, it's recommended to run the verification script provided in the previous comment. This will help identify any instances of
ActivityLogEntityEnum
that might have been overlooked in other files.
57-57
: LGTM: Enum usage updated correctlyThe
ActivityLogEntityEnum
has been consistently replaced withEntityEnum
in both thecreate
andupdate
methods. This change aligns with the reported enum renaming and maintains the existing functionality.To ensure all instances of
ActivityLogEntityEnum
have been updated throughout the codebase, please run the following verification script:This will help identify any places where the old enum name might still be in use.
Also applies to: 64-64, 116-116, 128-128
✅ Verification successful
Verification Successful: No remaining instances of
ActivityLogEntityEnum
foundAll instances of
ActivityLogEntityEnum
have been successfully replaced withEntityEnum
in the codebase.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any remaining instances of ActivityLogEntityEnum rg --type typescript "ActivityLogEntityEnum"Length of output: 79
Script:
#!/bin/bash # Search for any remaining instances of ActivityLogEntityEnum in TypeScript files rg "ActivityLogEntityEnum" --glob "*.ts" --glob "*.tsx"Length of output: 55
packages/core/src/organization-project/organization-project.service.ts (4)
6-6
: Import statement updated correctlyThe import statement has been properly updated to use the new
EntityEnum
instead ofActivityLogEntityEnum
. This change is consistent with the reported enum renaming.
131-131
: Enum usage updated correctly increate
methodThe
create
method has been updated to useEntityEnum.OrganizationProject
instead ofActivityLogEntityEnum.OrganizationProject
. This change is consistent and correct in both instances (lines 131 and 138).Also applies to: 138-138
Line range hint
1-624
: Summary of changes: Enum renaming implemented correctlyThe changes in this file are minimal and focused on renaming
ActivityLogEntityEnum
toEntityEnum
. The implementation is correct and consistent throughout the file. The main impacts are:
- Updated import statement to use
EntityEnum
.- Updated usage in the
create
method to useEntityEnum.OrganizationProject
.These changes should not affect the functionality of the
OrganizationProjectService
class. However, it's important to ensure that this renaming has been applied consistently across the entire codebase to prevent any potential issues.
Line range hint
1-624
: Enum renaming applied consistentlyAfter reviewing the entire file, it appears that the renaming of
ActivityLogEntityEnum
toEntityEnum
has been applied consistently. No instances of the old enum name were found, and all relevant usages have been updated correctly.However, to ensure complete consistency across the codebase, it would be beneficial to verify that this renaming has been applied in all other files where
ActivityLogEntityEnum
might have been used.To verify the consistent application of this change across the codebase, you can run the following script:
✅ Verification successful
Enum renaming applied consistently
After executing the verification scripts, no instances of
ActivityLogEntityEnum
were found inorganization-project.service.ts
. The use ofEntityEnum
has been updated correctly throughout the file. The renaming appears to be consistently applied in this context.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for any remaining instances of ActivityLogEntityEnum in the codebase # Search for any remaining instances of ActivityLogEntityEnum echo "Searching for remaining instances of ActivityLogEntityEnum:" rg --type typescript "ActivityLogEntityEnum" # Search for usage of EntityEnum to confirm correct usage echo "Confirming usage of EntityEnum:" rg --type typescript "EntityEnum"Length of output: 350
Script:
#!/bin/bash # Description: Check for any remaining instances of ActivityLogEntityEnum in the codebase # Search for any remaining instances of ActivityLogEntityEnum in .ts and .tsx files echo "Searching for remaining instances of ActivityLogEntityEnum:" rg "ActivityLogEntityEnum" --glob "*.ts" --glob "*.tsx" # Search for usage of EntityEnum in .ts and .tsx files to confirm correct usage echo "Confirming usage of EntityEnum:" rg "EntityEnum" --glob "*.ts" --glob "*.tsx"Length of output: 8276
packages/core/src/resource-link/resource-link.entity.ts (1)
66-67
: Re-evaluate theonDelete: 'CASCADE'
behavior for thecreator
relationshipSetting
onDelete: 'CASCADE'
on thecreator
relationship means that when a user is deleted, all associated resource links they created will also be deleted. This could lead to unintended data loss. Verify if this is the desired behavior. If you want to preserve resource links even after the creator is deleted, consider changing theonDelete
option toSET NULL
and updatingnullable
totrue
to allow for orphaned resource links.packages/core/src/database/migrations/1728798743598-CreateResourceLinkTable.ts (2)
178-215
: Check Data Type Compatibility for Boolean Fields in MySQLIn the MySQL migration (lines 184-185), the
isActive
andisArchived
fields are defined astinyint
. While MySQL does not have a nativeboolean
type, usingtinyint(1)
is common practice. Ensure that the application handles these fields correctly as booleans.Confirm that the ORM and application logic correctly interpret these
tinyint
fields as booleans in MySQL.
61-61
: Verify Availability ofgen_random_uuid()
Function in PostgresThe function
gen_random_uuid()
used for default UUID generation may require thepgcrypto
extension, which is not enabled by default in all PostgreSQL installations.Ensure that the
pgcrypto
extension is enabled in your PostgreSQL database. If not, you can enable it by running:Alternatively, consider using
uuid_generate_v4()
from theuuid-ossp
extension if it's preferred in your environment.packages/core/src/tasks/task.service.ts (3)
119-119
: Check compatibility ofEntityEnum.Task
inActivityLogEvent
.When publishing the
ActivityLogEvent
, theentity
field is now set toEntityEnum.Task
. Ensure thatActivityLogEvent
and all consumers of this event are compatible withEntityEnum
values to maintain consistent activity logging.To verify, examine the definition of
ActivityLogEvent
and its usage:#!/bin/bash # Description: Check the definition of ActivityLogEvent and instances where 'entity' is assigned. # Check the ActivityLogEvent class definition rg --type ts 'class ActivityLogEvent' -A 10 # Find all usages of ActivityLogEvent where 'entity' is set rg --type ts 'new ActivityLogEvent' -A 10
17-17
: Verify the replacement ofActivityLogEntityEnum
withEntityEnum
.The import statement replaces
ActivityLogEntityEnum
withEntityEnum
. Ensure thatEntityEnum
includes all the necessary values previously provided byActivityLogEntityEnum
to prevent any unexpected issues in activity logging.To verify that
EntityEnum
contains the required values, run the following script:
107-107
: EnsuregenerateActivityLogDescription
handlesEntityEnum.Task
correctly.The call to
generateActivityLogDescription
now usesEntityEnum.Task
instead ofActivityLogEntityEnum.Task
. Confirm that this function acceptsEntityEnum
values and generates the correct descriptions for task-related activity logs.To verify, search for the usage of
generateActivityLogDescription
and check its handling ofEntityEnum
:✅ Verification successful
generateActivityLogDescription
correctly handlesEntityEnum.Task
.All usages of
generateActivityLogDescription
withEntityEnum.Task
are properly managed, ensuring accurate activity log descriptions.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Find usages of generateActivityLogDescription and inspect parameter types. rg --type ts 'generateActivityLogDescription' -A 3Length of output: 9152
Script:
#!/bin/bash # Description: Locate the definition of generateActivityLogDescription and inspect its parameters. fd generateActivityLogDescription --type ts | xargs -I {} ast-grep --lang typescript --pattern $'function generateActivityLogDescription($_)' {}Length of output: 319
Script:
#!/bin/bash # Description: Find all calls to generateActivityLogDescription and inspect the arguments passed. rg --type ts 'generateActivityLogDescription' -A 5Length of output: 8982
Script:
#!/bin/bash # Description: Locate the definition of ActivityTemplates and inspect its contents. rg 'const ActivityTemplates' -A 20Length of output: 2169
Script:
#!/bin/bash # Description: Find all templates related to EntityEnum.Task within ActivityTemplates. rg 'ActivityTemplates.*EntityEnum.Task' -A 10Length of output: 47
packages/core/src/database/migrations/1728798743598-CreateResourceLinkTable.ts
Show resolved
Hide resolved
packages/core/src/database/migrations/1728798743598-CreateResourceLinkTable.ts
Show resolved
Hide resolved
packages/core/src/database/migrations/1728798743598-CreateResourceLinkTable.ts
Show resolved
Hide resolved
packages/core/src/database/migrations/1728798743598-CreateResourceLinkTable.ts
Show resolved
Hide resolved
☁️ Nx Cloud ReportCI is running/has finished running commands for commit fea108a. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this CI Pipeline Execution
✅ Successfully ran 4 targetsSent with 💌 from NxCloud. |
* fix: #8339 employee & organization parameters to URLs * fix: #8339 project parameters to URLs * fix: #8339 date range picker parameters to URLs * fix: #8339 project parameters to URLs * fix: don't merge new config with old default config * fix: don't merge new config with old default config * fix: organization controller and module improvement * feat: add standardWorkHoursPerDay column to organization entity * feat: #8341 add standardWorkHoursPerDay column migration to organization entity * feat: #8341 add standardWorkHoursPerDay column migration to organization table * feat: #8341 add standardWorkHoursPerDay column migration to tenant table * fix: create/update standard work hours per day * feat: get task by view query model * feat: get task by view query DTO * feat: get tasks by view filter API * fix: save standard work hours per day for organization * fix: get tasks by view filters * fix: remove unused DTO * chore(deps): add chartjs-plugin-annotation chore: add chartjs-plugin-annotation package for annotation support in charts * fix: organization ID filter in query * feat: add translations for Standard Work Hours * feat: #8341 added horizontal dotted line * fix(deepscan): removed unused import * fix(coderrabitai): improve types and finders * fix: sprint DELETE role permission * fix: improve sprints role permissions * fix: #8340 clear data before loading on report pages * fix: issue type value using enum * fix(deepscan): removed unused import * feat: #8339 bookmark query params builder resolver * [Feat] Add new workspace's methods to desktop authentication service (#8375) * feat: add new methods to service * feat: remove unecessary try-catch blocks and type annotations for return values in AuthService methods. * [Feat] Create Reusable Component and Add Workspace Links (#8383) * feat: export social links * feat: create a shared logo component * feat: create a shared social links component * feat: add reusable patterns to constants * feat: add link to magic workspace signin and use reusable logo, links and switch * feat: SwitchThemeModule, LogoComponent, and SocialLinksComponent to NgxLoginModule * fix(cspell): typo spelling :-) * fix: improvement suggested by CodeRabbit * fix: improvement suggested by CodeRabbit * fix: improvement suggested by CodeRabbit * fix: task type enum swagger * fix: issue type enum * feat: #8386 add module and entity for global logging of API * feat: #8386 add repository and subscriber for global logging of API * feat: #8386 table migration for "api_call_log" table * fix: #8386 circular dependency injection in repository * [Fix] Edit team functionality not working * feat: #8386 retrieves call logs API * fix(deepscan): property is accessed without null check * fix: missing role-permission module * fix: better encapsulation and reducing coupling between modules * fix: task view not found update command handler * [Fix] Filters not working * fix: #8386 added origin into `api_call_log` table * [Feat] Implement magic login (#8387) * feat: create reusable workspace selection component * feat: create debounce click directive * feat: create reusable avatar component * feat: implement login magic component * feat: implement login magic workspace component * feat: implement login workspace component * feat: reuse shared core styles * feat: add new component to login * feat: create authentication routes * feat: use lazy loading for authentications routes * fix: add code rabbit suggestions * fix: apply code rabbit suggestions * fix: apply code rabbit suggestions * [Fix] Task deselect on refresh (#8392) * fix: task deselect on refresh * fix: add `organizationTeamId` missing property to time tracker API request and spread `arg.timer` into the request object. * fix: apply code rabbit suggestion * [Fix] Edit contact for (client,customers,leads) functionality not working (#8393) * [Fix] Edit contact for (client,customers,leads) functionality not working * Remove member deletion * [Fix] Remote timer logic stop calls (#8394) * fix: remote timer logic and stopTimer calls * refactor: remote timer logic * [Feat] Resource Link Entity (#8397) * feat: add resource link model and entity * feat: resource link migration * [Feat] Resource Link API (#8399) * feat: add resource link model and entity * feat: resource link migration * feat: add resource link service * feat: resource link commands * feat: add resource link handlers * feat: add resource link subscriber * feat: add resource link controller and DTO * chore: desktop builds on Windows --------- Co-authored-by: Rahul R. <rahulrathore576@gmail.com> Co-authored-by: GloireMutaliko21 <mufunyig@gmail.com> Co-authored-by: Kifungo A <45813955+adkif@users.noreply.github.com> Co-authored-by: samuelmbabhazi <samuelmbabhazi@gmail.com> Co-authored-by: samuel mbabhazi <111171386+samuelmbabhazi@users.noreply.github.com> Co-authored-by: Gloire Mutaliko (Salva) <86450367+GloireMutaliko21@users.noreply.github.com>
PR
Please note: we will close your PR without comment if you do not check the boxes above and provide ALL requested information.
Description
This pull request introduces a new resource_links table to centralize the management of links associated with various project resources. The goal is to allow users to easily attach relevant links to different entities, such as tasks, modules, or sprints.
For example, when a task requires additional resources for its completion (links to documentation, technical specifications, related support tickets, or associated modules), these references can now be stored and tracked in a single table. This enhances the management of external references, improves visibility of resources needed for each task, and ensures greater consistency in project tracking. The flexible and scalable structure of this table also allows for adding links to new entities without major structural changes.
Note: This PR is base of #8399