Skip to content

Uncomment NotificationController and fix DTO references#103

Open
Trubador wants to merge 1 commit intomainfrom
claude/uncomment-notification-controller-01McyFD4LwTE8D22decVgAyw
Open

Uncomment NotificationController and fix DTO references#103
Trubador wants to merge 1 commit intomainfrom
claude/uncomment-notification-controller-01McyFD4LwTE8D22decVgAyw

Conversation

@Trubador
Copy link
Copy Markdown
Member

Uncommented the NotificationController and updated it to follow current architectural patterns, including API versioning, proper DTOs from Contracts namespace, and BaseController inheritance. Fixed repository interface inconsistencies by changing Delete method parameter from int to string to match entity ID type.

🤖 Generated with Claude Code

Summary & Motivation

A brief description of the changes in this pull request explaining why these changes are necessary. Please delete this paragraph.

Checklist for Pull Request - Merge from development into main (production) branch

  • A Label has been added to the Pull Request
  • Automated tests have been added
  • Documentation has been updated automatically or manual

Uncommented the NotificationController and updated it to follow current architectural patterns, including API versioning, proper DTOs from Contracts namespace, and BaseController inheritance. Fixed repository interface inconsistencies by changing Delete method parameter from int to string to match entity ID type.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copilot AI review requested due to automatic review settings November 14, 2025 12:16
@sonarqubecloud
Copy link
Copy Markdown

Copy link
Copy Markdown
Contributor

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 uncomments and modernizes the NotificationController to align with current architectural patterns. The changes include implementing API versioning, using proper DTOs from the Contracts namespace, inheriting from BaseController, and fixing a type inconsistency in the repository's Delete method parameter.

  • Updated NotificationController to follow current patterns with API versioning, BaseController inheritance, and proper DTOs
  • Fixed repository interface type mismatch by changing Delete method parameter from int to string
  • Added NotificationResponse.Id property and corresponding API endpoints

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
NotificationController.cs Uncommented and modernized controller with API versioning, BaseController inheritance, proper DTOs, and all CRUD operations
ApiEndpoints.cs Added Notifications endpoint constants for routing consistency
NotificationRepository.cs Updated Delete method parameter type from int to string to match entity ID type
INotificationRepository.cs Updated Delete method signature to use string instead of int
NotificationResponse.cs Added Id property to response DTO

IsRead = request.IsRead,
UserId = "temp-user-id", // TODO: Get from authenticated user context
CreatedAt = DateTime.UtcNow,
UpdatedAt = DateTime.UtcNow
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

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

The property name should be 'LastUpdatedAt' to match the BaseEntity property. The current code sets 'UpdatedAt' which doesn't exist on NotificationEntity (which inherits from BaseEntity with 'LastUpdatedAt' property).

Suggested change
UpdatedAt = DateTime.UtcNow
LastUpdatedAt = DateTime.UtcNow

Copilot uses AI. Check for mistakes.
UpdatedAt = DateTime.UtcNow
};

await _notificationRepository.AddAsync(newNotification);
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

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

Missing SaveChangesAsync call after AddAsync. The repository pattern used here doesn't auto-save changes. Based on IntegrationController and AdminController patterns in this codebase, you should inject IUnitOfWork and call 'await _unitOfWork.SaveChangesAsync(cancellationToken);' after AddAsync to persist the changes to the database.

Copilot uses AI. Check for mistakes.
NotificationEntity? notification = await _notificationRepository.GetByIdAsync(id);
if (notification is null) return NotFound(new { Message = $"Notification with ID {id} not found." });

_notificationRepository.Delete(id);
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

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

Missing SaveChangesAsync call after Delete. The repository pattern used here doesn't auto-save changes. Based on IntegrationController and AdminController patterns in this codebase, you should inject IUnitOfWork and call 'await _unitOfWork.SaveChangesAsync(cancellationToken);' after Delete to persist the changes to the database.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants