Skip to content

Refactor asset management classes and interfaces#79

Merged
gitnasr merged 3 commits intodevfrom
delete-asset
Jun 15, 2025
Merged

Refactor asset management classes and interfaces#79
gitnasr merged 3 commits intodevfrom
delete-asset

Conversation

@gitnasr
Copy link
Copy Markdown
Contributor

@gitnasr gitnasr commented Jun 15, 2025

Renamed and restructured asset-related classes and interfaces in the Dentizone application to use plural naming conventions. Updated namespaces and import statements accordingly. Enhanced DTOs with necessary properties and validation rules, including the addition of UserId. Modified service interfaces and implementations to support new asset handling methods, including asset deletion. Updated repository methods for consistency with the new structure. Improved authorization checks in controllers for asset operations, enhancing overall clarity and functionality of the asset management system.

Summary by CodeRabbit

  • New Features
    • Added the ability to delete an asset by ID via a new endpoint in the upload section.
  • Improvements
    • Asset and related data transfer objects now require more fields to be provided, enhancing data consistency.
    • Improved error handling and validation in authentication processes.
  • Bug Fixes
    • Corrected and unified namespace references for asset-related components.
  • Refactor
    • Simplified and clarified method signatures and parameter names across repositories and services for assets.
    • Applied code style improvements for constructors and method formatting.

Renamed and restructured asset-related classes and interfaces in the Dentizone application to use plural naming conventions. Updated namespaces and import statements accordingly. Enhanced DTOs with necessary properties and validation rules, including the addition of `UserId`. Modified service interfaces and implementations to support new asset handling methods, including asset deletion. Updated repository methods for consistency with the new structure. Improved authorization checks in controllers for asset operations, enhancing overall clarity and functionality of the asset management system.
@gitnasr gitnasr requested a review from Copilot June 15, 2025 18:45
@gitnasr gitnasr self-assigned this Jun 15, 2025
@gitnasr gitnasr added the enhancement New feature or request label Jun 15, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jun 15, 2025

Walkthrough

This update standardizes asset-related namespaces from singular to plural across DTOs, interfaces, and services. It introduces stricter property requirements for asset DTOs, modifies asset deletion methods to return Task instead of the deleted entity, and adds a user-validated asset deletion endpoint in the upload controller and service. Minor constructor and method signature adjustments are also included.

Changes

File(s) Change Summary
.../AutoMapper/Asset/AssetProfile.cs
.../DI/Services.cs
.../Services/PostService.cs
Updated namespace imports from singular to plural for asset-related DTOs and interfaces.
.../DTOs/Asset/AssetDto.cs Deleted old AssetDto class in singular namespace.
.../DTOs/Assets/AssetDto.cs Added new AssetDto class in plural namespace with required UserId property.
.../DTOs/Assets/CreateAssetDto.cs Changed namespace and made properties required in CreateAssetDto.
.../DTOs/Assets/UpdateAssetDto.cs Changed namespace for UpdateAssetDto.
.../Interfaces/Assets/IAssetService.cs Changed namespace; updated DeleteAssetAsync to return Task and renamed parameter.
.../Interfaces/IUploadService.cs Updated namespace; added DeleteAssetById method.
.../Services/AssetService.cs Updated namespaces; changed DeleteAssetAsync to return Task and simplified logic.
.../Services/UploadService.cs Added DeleteAssetById method with user validation; updated namespaces and imports.
.../Repositories/AssetRepository.cs Changed to primary constructor; simplified DeleteAsync to return Task and accept Asset entity.
.../Repositories/AnswerRepository.cs Changed to primary constructor; updated UpdateAsync to return non-nullable.
.../Repositories/PostRepsitory.cs Removed default value for page parameter in GetAllAsync.
.../Controllers/AuthenticationController.cs Added stricter null checks and claim retrieval logic.
.../Controllers/UploadController.cs Applied [Authorize] at class level; added DeleteAssetById endpoint with user validation and asset existence check.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UploadController
    participant UploadService
    participant AssetService
    participant AssetRepository

    User->>UploadController: DELETE /upload/{id}
    UploadController->>UploadService: DeleteAssetById(id, userId)
    UploadService->>AssetService: GetAssetById(id)
    AssetService->>AssetRepository: FindById(id)
    AssetRepository-->>AssetService: Asset (or null)
    AssetService-->>UploadService: Asset (or null)
    UploadService->>UploadService: Validate asset existence and userId
    UploadService->>AssetService: DeleteAssetAsync(assetDto)
    AssetService->>AssetRepository: DeleteAsync(asset)
    AssetRepository-->>AssetService: (void)
    AssetService-->>UploadService: (void)
    UploadService-->>UploadController: Deleted AssetDto
    UploadController-->>User: 204 No Content
Loading

Possibly related PRs

  • dentizone/api#47: Introduced the initial asset service, DTOs, AutoMapper profile, and interfaces for asset management, which are directly modified by this PR.
  • dentizone/api#71: Added initial UploadService, UploadController, and related DTOs/mappings for image upload, which this PR extends and modifies.

Poem

In fields of code where assets roam,
Names grew plural, found a home.
Deletion’s now a lighter task,
With user checks—no need to ask!
Uploads guarded, strict and neat,
🐇 This rabbit finds the changes sweet!
Hop, hop, hooray—refactor complete!


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 58c38bd and a101c0b.

📒 Files selected for processing (1)
  • Dentizone.Application/Services/AssetService.cs (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Dentizone.Application/Services/AssetService.cs
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @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
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors asset management classes and interfaces in the Dentizone application, with changes focused on naming conventions, updated service methods, and namespace adjustments. Key changes include enhancing DTOs (with required property declarations), adding asset deletion endpoints with proper authorization checks, and updating repository and service interfaces for consistency.

Reviewed Changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Dentizone.Presentaion/Controllers/UploadController.cs Added class-level authorization and a new DELETE endpoint for asset deletion.
Dentizone.Presentaion/Controllers/AuthenticationController.cs Updated claim retrieval and error handling in Login, ConfirmEmail, SendVerificationEmail, and RefreshToken endpoints.
Dentizone.Infrastructure/Repositories/PostRepsitory.cs Removed the default parameter for page in the GetAllAsync method.
Dentizone.Infrastructure/Repositories/AssetRepository.cs Updated constructor syntax and refactored DeleteAsync to use a lambda deletion approach.
Dentizone.Infrastructure/Repositories/AnswerRepository.cs Modified UpdateAsync to return a non-nullable Answer.
Dentizone.Domain/Interfaces/Repositories/IAssetRepository.cs Adjusted method signatures to use Asset directly and update return types.
Dentizone.Application/Services/* Updated UploadService, AssetService and PostService to match the new asset API design.
Dentizone.Application/Interfaces/* and DTOs Consistent namespace and naming refactor in asset-related interfaces and DTOs.
Dentizone.Application/DI/Services.cs & AutoMapper profiles Updated namespace references for asset-related components.
Comments suppressed due to low confidence (1)

Dentizone.Infrastructure/Repositories/PostRepsitory.cs:52

  • Removing the default parameter value for 'page' may break existing calls that relied on the default. Ensure that all call sites are updated to pass an explicit page number or consider preserving a default.
public async Task<IEnumerable<Post>> GetAllAsync(int page)

Copy link
Copy Markdown
Contributor

@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: 7

🔭 Outside diff range comments (3)
Dentizone.Presentaion/Controllers/AuthenticationController.cs (1)

138-142: ⚠️ Potential issue

user may be null – check before dereferencing

If the user id is valid in IdentityServer but deleted in your store, authenticationService.GetById could return null, triggering an exception here.

-                if (user.Email == null)
+                if (user == null || user.Email == null)
                 {
                     return Unauthorized(new { message = "User not found" });
                 }
Dentizone.Infrastructure/Repositories/AnswerRepository.cs (1)

39-47: 🛠️ Refactor suggestion

Possible NullReferenceException & hard-delete contradicts soft-delete model
GetByIdAsync can return null; passing that into Remove will throw.
Additionally, Answer has an IsDeleted flag, yet the record is physically deleted. This makes IsDeleted meaningless and breaks referential integrity / audits.

-var answer = await GetByIdAsync(id);
-dbContext.Answers.Remove(answer);
+var answer = await GetByIdAsync(id);
+if (answer is null)
+    return null;
+
+// soft-delete to keep historical data
+answer.IsDeleted = true;
+dbContext.Answers.Update(answer);
Dentizone.Application/AutoMapper/Asset/AssetProfile.cs (1)

11-15: 🛠️ Refactor suggestion

UserId field is unintentionally overwritten during updates

UpdateAssetDto contains only Type and Status, but ReverseMap() tells AutoMapper to map all matching properties back to AssetDto.
Because UserId is not explicitly ignored, an update operation will zero-out the existing UserId on the destination object (default/null).

             CreateMap<UpdateAssetDto, AssetDto>()
                 .ForMember(dest => dest.Id,     opt => opt.Ignore())
                 .ForMember(dest => dest.Url,    opt => opt.Ignore())
                 .ForMember(dest => dest.Size,   opt => opt.Ignore())
+                .ForMember(dest => dest.UserId, opt => opt.Ignore())
                 .ReverseMap();
🧹 Nitpick comments (7)
Dentizone.Application/DTOs/Assets/AssetDto.cs (1)

1-2: Remove unused import
The using Dentizone.Domain.Entity; directive isn't used in this DTO and can be removed to clean up the file.

Dentizone.Domain/Interfaces/Repositories/IAssetRepository.cs (1)

7-8: DeleteAsync Should Communicate Outcome

Changing the signature to Task loses any feedback about success, already-deleted, or not-found scenarios. Consider returning Task<bool> (deleted?) or throwing a dedicated exception so callers can react appropriately.

-Task DeleteAsync(string assetId);
+Task<bool> DeleteAsync(string assetId); // returns true when a row was affected

Alternatively, retain the previous Task<Asset?> but mark it nullable to preserve the deleted entity when needed (audit, logging).

Dentizone.Infrastructure/Repositories/AssetRepository.cs (1)

18-24: Minor: early-return duplicates query execution
When includes == null you execute FirstOrDefaultAsync on query anyway; the explicit branch can be removed.

-if (includes == null)
-    return await query.FirstOrDefaultAsync(condition);
+if (includes == null)
+    return await query.FirstOrDefaultAsync(condition);

(Same result, but the special branch is redundant.)

Dentizone.Application/Services/PostService.cs (1)

32-35: Whitespace-only change – consider skipping next time
The lambda re-indent produces a noisy diff without functional benefit.

Dentizone.Application/AutoMapper/Asset/AssetProfile.cs (1)

2-2: Namespace mis-alignment — consider pluralising AutoMapper.Asset

Imports, DTO folders, service interfaces, and repositories have all been renamed to Assets, yet the namespace that houses this profile is still AutoMapper.Asset (singular). Keeping one singular namespace in an otherwise pluralised hierarchy is a breeding-ground for confusion when navigating or using “Find-type” tooling.

-namespace Dentizone.Application.AutoMapper.Asset
+namespace Dentizone.Application.AutoMapper.Assets
Dentizone.Application/DTOs/Assets/UpdateAssetDto.cs (1)

7-9: Add basic validation to prevent invalid enum defaults

Both properties are nullable by default and will serialise to 0 (first enum value) when the client omits them. Making them required (either via C# required keyword or DataAnnotations) prevents silent mis-classification of assets.

 using Dentizone.Domain.Enums;
+using System.ComponentModel.DataAnnotations;

 public class UpdateAssetDto
 {
-    public AssetType Type { get; set; }
-    public AssetStatus Status { get; set; }
+    [Required]
+    public AssetType Type { get; init; }
+
+    [Required]
+    public AssetStatus Status { get; init; }
 }
Dentizone.Application/Services/UploadService.cs (1)

35-51: Return type & exception choice could be tightened

  1. The controller ignores the returned AssetDto, so returning it just adds GC pressure.
    Consider Task instead of Task<AssetDto> unless another caller needs the DTO.

  2. Throwing UnauthorizedAccessException maps to 401 in ASP.NET by default, but semantically the caller is authenticated – they simply lack permission.
    A custom ForbiddenException (mapped to 403) or re-using BadActionException with 403 semantics is clearer.

-public async Task<AssetDto> DeleteAssetById(string id, string userId)
+public async Task DeleteAssetById(string id, string userId)
 {
     var asset = await assetService.GetAssetByIdAsync(id);
     if (asset == null)
         throw new NotFoundException("Asset not found");

     if (asset.UserId != userId)
-        throw new UnauthorizedAccessException("You are not authorized to delete this asset");
+        throw new ForbiddenException("You are not authorized to delete this asset");

     await assetService.DeleteAssetAsync(asset.Id);
-    return asset;
 }

(Assumes a ForbiddenException exists or will be introduced.)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between af31eea and 39f6780.

📒 Files selected for processing (17)
  • Dentizone.Application/AutoMapper/Asset/AssetProfile.cs (1 hunks)
  • Dentizone.Application/DI/Services.cs (1 hunks)
  • Dentizone.Application/DTOs/Asset/AssetDto.cs (0 hunks)
  • Dentizone.Application/DTOs/Assets/AssetDto.cs (1 hunks)
  • Dentizone.Application/DTOs/Assets/CreateAssetDto.cs (1 hunks)
  • Dentizone.Application/DTOs/Assets/UpdateAssetDto.cs (1 hunks)
  • Dentizone.Application/Interfaces/Assets/IAssetService.cs (1 hunks)
  • Dentizone.Application/Interfaces/IUploadService.cs (2 hunks)
  • Dentizone.Application/Services/AssetService.cs (2 hunks)
  • Dentizone.Application/Services/PostService.cs (3 hunks)
  • Dentizone.Application/Services/UploadService.cs (2 hunks)
  • Dentizone.Domain/Interfaces/Repositories/IAssetRepository.cs (1 hunks)
  • Dentizone.Infrastructure/Repositories/AnswerRepository.cs (2 hunks)
  • Dentizone.Infrastructure/Repositories/AssetRepository.cs (3 hunks)
  • Dentizone.Infrastructure/Repositories/PostRepsitory.cs (1 hunks)
  • Dentizone.Presentaion/Controllers/AuthenticationController.cs (4 hunks)
  • Dentizone.Presentaion/Controllers/UploadController.cs (2 hunks)
💤 Files with no reviewable changes (1)
  • Dentizone.Application/DTOs/Asset/AssetDto.cs
🧰 Additional context used
🧬 Code Graph Analysis (5)
Dentizone.Infrastructure/Repositories/PostRepsitory.cs (2)
Dentizone.Application/Services/PostService.cs (8)
  • Task (29-39)
  • Task (42-57)
  • Task (59-76)
  • Task (78-112)
  • Task (115-124)
  • Task (126-140)
  • Task (142-151)
  • Task (153-162)
Dentizone.Application/Interfaces/Post/IPostService.cs (8)
  • Task (8-8)
  • Task (9-9)
  • Task (10-10)
  • Task (11-11)
  • Task (12-12)
  • Task (13-13)
  • Task (14-14)
  • Task (16-16)
Dentizone.Domain/Interfaces/Repositories/IAssetRepository.cs (1)
Dentizone.Domain/Entity/Asset.cs (1)
  • Asset (6-21)
Dentizone.Application/Interfaces/Assets/IAssetService.cs (3)
Dentizone.Application/DTOs/Assets/AssetDto.cs (1)
  • AssetDto (6-13)
Dentizone.Application/DTOs/Assets/CreateAssetDto.cs (1)
  • CreateAssetDto (6-13)
Dentizone.Application/DTOs/Assets/UpdateAssetDto.cs (1)
  • UpdateAssetDto (5-9)
Dentizone.Infrastructure/Repositories/AnswerRepository.cs (3)
Dentizone.Infrastructure/Repositories/AbstractRepository.cs (1)
  • AbstractRepository (5-19)
Dentizone.Infrastructure/Repositories/AssetRepository.cs (5)
  • Task (10-15)
  • Task (17-33)
  • Task (35-41)
  • Task (44-48)
  • Task (50-55)
Dentizone.Domain/Entity/Answer.cs (1)
  • Answer (6-16)
Dentizone.Infrastructure/Repositories/AssetRepository.cs (3)
Dentizone.Infrastructure/Repositories/AbstractRepository.cs (1)
  • AbstractRepository (5-19)
Dentizone.Domain/Entity/Asset.cs (1)
  • Asset (6-21)
Dentizone.Infrastructure/Repositories/AnswerRepository.cs (5)
  • Task (10-15)
  • Task (18-36)
  • Task (39-47)
  • Task (50-53)
  • Task (55-60)
🔇 Additional comments (11)
Dentizone.Application/DTOs/Assets/AssetDto.cs (2)

4-4: Namespace update looks good
Switching to a file-scoped Assets namespace aligns with the new plural naming convention across your DTOs.


8-12: Confirm runtime validation approach for required properties
You've marked all properties as C# 11 required, but if you need runtime validation (e.g., MVC model binding or OpenAPI schema enforcement), consider adding [Required] DataAnnotations or custom validators. Please verify that required alone meets your validation requirements.

Dentizone.Domain/Interfaces/Repositories/IAssetRepository.cs (1)

5-5:

Details

✅ Verification successful

Confirm UpdateAsync / DeleteAsync Are Not Already Declared In IBaseRepo<T>

IAssetRepository inherits from IBaseRepo<Asset>, yet it re-declares UpdateAsync and DeleteAsync.
If IBaseRepo<T> already exposes these members (many generic repo bases do), this becomes redundant and widens the surface area for divergence between base and derived interfaces.

-public interface IAssetRepository : IBaseRepo<Asset>
-{
-    Task<Asset> UpdateAsync(Asset entity);
-    Task DeleteAsync(string assetId);
-}
+public interface IAssetRepository : IBaseRepo<Asset>
+{
+    //  Only keep members that are NOT already present in IBaseRepo<Asset>
+}

Double-check the base interface; remove duplicates or convert to new specialised methods (e.g., UpdateUrlAsync, SoftDeleteAsync) to avoid contract drift.


🏁 Script executed:

#!/bin/bash
# Locate the base repository interface
rg --fixed-strings "interface IBaseRepo" -n .

# Check for UpdateAsync declarations across the codebase
rg "UpdateAsync" -n .

# Check for DeleteAsync declarations across the codebase
rg "DeleteAsync" -n .

Length of output: 7850


🏁 Script executed:

#!/bin/bash
# Display the contents of the base repository interface to check declared members
sed -n '1,200p' Dentizone.Domain/Interfaces/Repositories/IBaseRepo.cs

Length of output: 489


No Redundant Declarations in IAssetRepository
IBaseRepo only defines GetByIdAsync, CreateAsync and FindBy. It does not include UpdateAsync or DeleteAsync, so the overrides in IAssetRepository are required and not duplicates.

No changes needed here.

Dentizone.Infrastructure/Repositories/AnswerRepository.cs (2)

8-8: Primary-constructor syntax mandates C# 12 – confirm project language version
The positional constructor introduced here compiles only when LangVersion is set to preview or 12.0. If Directory.Build.props / csproj still targets an older version the build will break silently in CI.


55-60: UpdateAsync now promises non-nullable but doesn’t guarantee entity exists
Caller may pass a detached entity that doesn’t exist in DB → SaveChangesAsync hits DbUpdateConcurrencyException. Consider returning null when RowsAffected == 0 or keep the previous Answer? signature.

Dentizone.Application/Services/PostService.cs (1)

4-4: Good catch – updated namespace prevents broken imports
No action needed; just acknowledging the correction from AssetAssets.

Dentizone.Infrastructure/Repositories/PostRepsitory.cs (1)

52-58: Removed default page value – audit call sites for explicit argument
GetAllAsync(int page) now requires callers to pass page. PostService.GetAllPosts already complies, but double-check other usages (e.g., admin panels, tests) to avoid compile errors.

Dentizone.Application/DI/Services.cs (1)

1-3: Import rename looks good

The switch to Dentizone.Application.Interfaces.Assets resolves the missing-namespace issue and compiles cleanly.

Dentizone.Presentaion/Controllers/UploadController.cs (1)

11-11: Controller-level [Authorize] attribute is a nice consolidation
Applying the attribute once removes redundancy and lowers the risk of accidentally exposing new endpoints anonymously.

Dentizone.Application/DTOs/Assets/CreateAssetDto.cs (1)

8-13: required modifiers strengthen compile-time safety
Good move—these properties are now impossible to forget during object construction, and FluentValidation still guards runtime.

Dentizone.Application/Interfaces/Assets/IAssetService.cs (1)

11-11:

Details

✅ Verification successful

Signature change: ensure callers updated
DeleteAssetAsync now returns Task and parameter renamed to assetId. Verify every implementation and call-site (repositories, services, tests) compiles with the new signature.

Run:

Expect only fire-and-forget await usages.


🏁 Script executed:

#!/bin/bash
# Find any outdated calls expecting a return value.
rg -n "DeleteAssetAsync\(.*\)" | grep -v "await assetService.DeleteAssetAsync"

Length of output: 292


No outdated calls to DeleteAssetAsync detected
The grep output shows only the interface and implementation definitions—no call sites expect a return value. All existing usages (if any) already await the Task. No further updates are required.

- Updated `IAssetService` to accept `AssetDto` in `DeleteAssetAsync`.
- Simplified `AssetService` constructor and removed private fields.
- Refactored methods in `AssetService` to use constructor parameters directly.
- Changed `IAssetRepository` to accept `Asset` in `DeleteAsync`.
- Modified `AssetRepository` to delete assets using the `Asset` object.
- Updated `UploadService` to call `DeleteAssetAsync` with `Asset` instead of ID.
Copy link
Copy Markdown
Contributor

@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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 39f6780 and 58c38bd.

📒 Files selected for processing (5)
  • Dentizone.Application/Interfaces/Assets/IAssetService.cs (1 hunks)
  • Dentizone.Application/Services/AssetService.cs (1 hunks)
  • Dentizone.Application/Services/UploadService.cs (2 hunks)
  • Dentizone.Domain/Interfaces/Repositories/IAssetRepository.cs (1 hunks)
  • Dentizone.Infrastructure/Repositories/AssetRepository.cs (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • Dentizone.Application/Services/UploadService.cs
  • Dentizone.Application/Interfaces/Assets/IAssetService.cs
  • Dentizone.Infrastructure/Repositories/AssetRepository.cs
  • Dentizone.Application/Services/AssetService.cs
🧰 Additional context used
🧬 Code Graph Analysis (1)
Dentizone.Domain/Interfaces/Repositories/IAssetRepository.cs (1)
Dentizone.Domain/Entity/Asset.cs (1)
  • Asset (6-21)
🔇 Additional comments (1)
Dentizone.Domain/Interfaces/Repositories/IAssetRepository.cs (1)

5-5: Switch to unqualified Asset is clean

The move from Entity.Asset to simply Asset (enabled by the added using) improves readability without altering behaviour.

@sonarqubecloud
Copy link
Copy Markdown

@gitnasr gitnasr merged commit 1af9551 into dev Jun 15, 2025
2 checks passed
@coderabbitai coderabbitai bot mentioned this pull request Jun 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants