Skip to content

Commit f2a241d

Browse files
author
CIS Guru
committed
feat: add other-DB delete, expand import, bump v1.1.0
- Add DatabasePreviewService.DeleteDatabaseFileAsync with active-DB safety guard; refactor DeleteBackup to use it - Add Delete button and handler for Previous Database Versions Found files in Database Settings - Expand import to cover 7 additional tables: CalendarEvents, Inspections, Checklists, ChecklistItems, SecurityDeposits, Notes, Notifications - with required-cols sets and ImportResult DTO properties - Add preview DTOs, count cards, tabs, and data panels for all 7 tables in DatabasePreview.razor - ImportNotificationsAsync: fan out each notification to all real users (excluding system user) with fresh IDs - Fix SignalR ObjectDisposedException in NotificationCenter on dispose - Bump application and database version to 1.1.0
1 parent 4e157af commit f2a241d

File tree

7 files changed

+986
-28
lines changed

7 files changed

+986
-28
lines changed

2-Nine.Application/Models/DTOs/DatabasePreviewDTOs.cs

Lines changed: 106 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ public class DatabasePreviewData
1313
public int MaintenanceCount { get; set; }
1414
public int RepairCount { get; set; }
1515
public int DocumentCount { get; set; }
16+
public int CalendarEventCount { get; set; }
17+
public int InspectionCount { get; set; }
18+
public int ChecklistCount { get; set; }
19+
public int ChecklistItemCount { get; set; }
20+
public int SecurityDepositCount { get; set; }
21+
public int NoteCount { get; set; }
22+
public int NotificationCount { get; set; }
1623

1724
public List<PropertyPreview> Properties { get; set; } = new();
1825
public List<TenantPreview> Tenants { get; set; } = new();
@@ -21,6 +28,13 @@ public class DatabasePreviewData
2128
public List<PaymentPreview> Payments { get; set; } = new();
2229
public List<MaintenancePreview> MaintenanceRequests { get; set; } = new();
2330
public List<RepairPreview> Repairs { get; set; } = new();
31+
public List<CalendarEventPreview> CalendarEvents { get; set; } = new();
32+
public List<InspectionPreview> Inspections { get; set; } = new();
33+
public List<ChecklistPreview> Checklists { get; set; } = new();
34+
public List<ChecklistItemPreview> ChecklistItems { get; set; } = new();
35+
public List<SecurityDepositPreview> SecurityDeposits { get; set; } = new();
36+
public List<NotePreview> Notes { get; set; } = new();
37+
public List<NotificationPreview> Notifications { get; set; } = new();
2438
}
2539

2640
/// <summary>
@@ -121,6 +135,88 @@ public class RepairPreview
121135
public decimal Cost { get; set; }
122136
}
123137

138+
/// <summary>
139+
/// DTO for calendar event preview in read-only database view
140+
/// </summary>
141+
public class CalendarEventPreview
142+
{
143+
public Guid Id { get; set; }
144+
public string Title { get; set; } = string.Empty;
145+
public DateTime StartOn { get; set; }
146+
public string EventType { get; set; } = string.Empty;
147+
public string Status { get; set; } = string.Empty;
148+
}
149+
150+
/// <summary>
151+
/// DTO for inspection preview in read-only database view
152+
/// </summary>
153+
public class InspectionPreview
154+
{
155+
public Guid Id { get; set; }
156+
public string PropertyAddress { get; set; } = string.Empty;
157+
public DateTime CompletedOn { get; set; }
158+
public string InspectionType { get; set; } = string.Empty;
159+
public string? InspectedBy { get; set; }
160+
}
161+
162+
/// <summary>
163+
/// DTO for checklist preview in read-only database view
164+
/// </summary>
165+
public class ChecklistPreview
166+
{
167+
public Guid Id { get; set; }
168+
public string Name { get; set; } = string.Empty;
169+
public string ChecklistType { get; set; } = string.Empty;
170+
public string Status { get; set; } = string.Empty;
171+
}
172+
173+
/// <summary>
174+
/// DTO for checklist item preview in read-only database view
175+
/// </summary>
176+
public class ChecklistItemPreview
177+
{
178+
public Guid Id { get; set; }
179+
public Guid ChecklistId { get; set; }
180+
public string ItemText { get; set; } = string.Empty;
181+
public int ItemOrder { get; set; }
182+
}
183+
184+
/// <summary>
185+
/// DTO for security deposit preview in read-only database view
186+
/// </summary>
187+
public class SecurityDepositPreview
188+
{
189+
public Guid Id { get; set; }
190+
public string TenantName { get; set; } = string.Empty;
191+
public decimal Amount { get; set; }
192+
public DateTime DateReceived { get; set; }
193+
public string PaymentMethod { get; set; } = string.Empty;
194+
public string Status { get; set; } = string.Empty;
195+
}
196+
197+
/// <summary>
198+
/// DTO for note preview in read-only database view
199+
/// </summary>
200+
public class NotePreview
201+
{
202+
public Guid Id { get; set; }
203+
public string EntityType { get; set; } = string.Empty;
204+
public string Content { get; set; } = string.Empty;
205+
public DateTime? CreatedOn { get; set; }
206+
}
207+
208+
/// <summary>
209+
/// DTO for notification preview in read-only database view
210+
/// </summary>
211+
public class NotificationPreview
212+
{
213+
public Guid Id { get; set; }
214+
public string Title { get; set; } = string.Empty;
215+
public string Type { get; set; } = string.Empty;
216+
public string Category { get; set; } = string.Empty;
217+
public DateTime SentOn { get; set; }
218+
}
219+
124220
/// <summary>
125221
/// Represents a non-backup database file found in the data directory (e.g. an older versioned DB)
126222
/// </summary>
@@ -155,10 +251,19 @@ public class ImportResult
155251
public int MaintenanceRequestsImported { get; set; }
156252
public int RepairsImported { get; set; }
157253
public int DocumentsImported { get; set; }
254+
public int CalendarEventsImported { get; set; }
255+
public int InspectionsImported { get; set; }
256+
public int ChecklistsImported { get; set; }
257+
public int ChecklistItemsImported { get; set; }
258+
public int SecurityDepositsImported { get; set; }
259+
public int NotesImported { get; set; }
260+
public int NotificationsImported { get; set; }
158261
public List<string> Errors { get; set; } = new();
159262

160263
public int TotalImported => PropertiesImported + TenantsImported + LeasesImported
161-
+ InvoicesImported + PaymentsImported + MaintenanceRequestsImported + RepairsImported + DocumentsImported;
264+
+ InvoicesImported + PaymentsImported + MaintenanceRequestsImported + RepairsImported + DocumentsImported
265+
+ CalendarEventsImported + InspectionsImported + ChecklistsImported + ChecklistItemsImported
266+
+ SecurityDepositsImported + NotesImported + NotificationsImported;
162267
}
163268

164269
/// <summary>

0 commit comments

Comments
 (0)