Skip to content

✨ Notifications soft-delete #1377

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

Merged
merged 9 commits into from
Jul 10, 2025

Conversation

jernejk
Copy link
Member

@jernejk jernejk commented Jul 10, 2025

  1. What triggered this change? (PBI link, Email Subject, conversation + reason, etc)

✏️ #1364

  1. What was changed?

✏️ Added soft-delete for notifications and updated UI.

  1. Did you do pair or mob programming?

✏️ No.

image
Figure: Updated UI.

image
Figure: Include archived notifications

@Copilot Copilot AI review requested due to automatic review settings July 10, 2025 01:53
@jernejk jernejk linked an issue Jul 10, 2025 that may be closed by this pull request
Copilot

This comment was marked as outdated.

@jernejk jernejk changed the title 1364 admin implement soft delete for notifications ✨ Notifications soft-delete Jul 10, 2025
@jernejk jernejk requested a review from Copilot July 10, 2025 02:21
Copy link
Contributor

@Copilot 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 implements soft-delete functionality for notifications with an updated admin UI to manage archived notifications. The implementation allows notifications to be archived instead of permanently deleted, with the ability to view archived items when needed.

  • Adds soft-delete support to the Notification entity by inheriting from BaseAuditableEntity
  • Implements archive/unarchive functionality with new API endpoints and UI controls
  • Updates notification history queries to optionally include deleted/archived notifications

Reviewed Changes

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

Show a summary per file
File Description
NotificationsController.cs Adds includeDeleted parameter to List endpoint and new DeleteNotification endpoint
ApplicationDbContextModelSnapshot.cs Adds soft-delete columns (DeletedBy, DeletedUtc, LastModifiedBy, LastModifiedUtc) to Notifications table
AddNotificationSoftDelete.cs Database migration adding soft-delete columns and index
NotificationConfiguration.cs Configures soft-delete behavior for Notification entity
Notification.cs Changes inheritance from BaseEntity to BaseAuditableEntity for audit tracking
NotificationHistoryDto.cs Adds Id and IsArchived properties for UI display
GetNotificationHistoryListQuery.cs Adds IncludeDeleted parameter and query filter logic
Mapping.cs Maps IsArchived property based on DeletedUtc value
SendAdminNotificationCommand.cs Handles archived notification detection and prevents sending
NotificationSentResponse.cs Adds WasArchived property and Archived factory method
DeleteNotificationCommand.cs Implements soft-delete command handler
ScheduleNotificationTask.cs Removes unnecessary ScheduleAt clearing logic
INotificationsService.cs Updates method signatures for archive functionality
Notifications.razor.cs Implements UI logic for archive operations and filtering
Notifications.razor Updates UI with archive controls and improved layout
Files not reviewed (1)
  • src/Infrastructure/Persistence/Migrations/20250707011647_AddNotificationSoftDelete.Designer.cs: Language not supported

Copy link
Member

@zacharykeeping zacharykeeping left a comment

Choose a reason for hiding this comment

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

LGTM

@jernejk
Copy link
Member Author

jernejk commented Jul 10, 2025

This pull request introduces functionality for managing archived notifications, refactors the notification handling logic, and adds soft delete support for notifications. The changes span across the Admin UI, API client, application layer, domain layer, and infrastructure layer.

Admin UI Enhancements:

  • Added a checkbox to filter archived notifications and a button to archive notifications in the Notifications.razor UI. [1] [2]
  • Moved the notification-related logic from Notifications.razor to a new partial class Notifications.razor.cs for better separation of concerns.

API Client Updates:

  • Modified INotificationsService to include methods for archiving notifications and retrieving notification history with an option to include deleted records. [1] [2] [3] [4]

Application Layer Changes:

  • Introduced the DeleteNotificationCommand to handle notification archiving, including database removal logic.
  • Updated notification query and command handlers to account for archived notifications, including filtering and error handling for deleted records. [1] [2] [3]

Domain Layer Modifications:

  • Changed the Notification entity to extend BaseAuditableEntity for soft delete support.
  • Added an IsArchived property to NotificationHistoryDto for tracking archived status.

Infrastructure Layer Updates:

  • Added soft delete configuration for the Notification entity in the database.

@jernejk jernejk merged commit a152f19 into main Jul 10, 2025
6 checks passed
@jernejk jernejk deleted the 1364-admin-implement-soft-delete-for-notifications branch July 10, 2025 23:23
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.

✨ Admin - Implement Soft Delete for Notifications
2 participants