diff --git a/Oqtane.Server/Repository/Context/DBContextBase.cs b/Oqtane.Server/Repository/Context/DBContextBase.cs index 8fb37ffb..25956f19 100644 --- a/Oqtane.Server/Repository/Context/DBContextBase.cs +++ b/Oqtane.Server/Repository/Context/DBContextBase.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Oqtane.Models; +using Oqtane.Shared; using System; using System.Linq; @@ -70,6 +71,22 @@ namespace Oqtane.Repository item.CurrentValues[nameof(IAuditable.ModifiedBy)] = username; item.CurrentValues[nameof(IAuditable.ModifiedOn)] = date; } + + if (item.Entity is IDeletable deleted && item.State != EntityState.Added) + { + if ((bool)item.CurrentValues[nameof(IDeletable.IsDeleted)] + && !item.GetDatabaseValues().GetValue(nameof(IDeletable.IsDeleted))) + { + item.CurrentValues[nameof(IDeletable.DeletedBy)] = username; + item.CurrentValues[nameof(IDeletable.DeletedOn)] = date; + } + else if (!(bool)item.CurrentValues[nameof(IDeletable.IsDeleted)] + && item.GetDatabaseValues().GetValue(nameof(IDeletable.IsDeleted))) + { + item.CurrentValues[nameof(IDeletable.DeletedBy)] = null; + item.CurrentValues[nameof(IDeletable.DeletedOn)] = null; + } + } } return base.SaveChanges(); diff --git a/Oqtane.Shared/Shared/IDeletable.cs b/Oqtane.Shared/Shared/IDeletable.cs new file mode 100644 index 00000000..6198dcde --- /dev/null +++ b/Oqtane.Shared/Shared/IDeletable.cs @@ -0,0 +1,11 @@ +using System; + +namespace Oqtane.Shared +{ + public interface IDeletable + { + string DeletedBy { get; set; } + DateTime? DeletedOn { get; set; } + bool IsDeleted { get; set; } + } +} diff --git a/README.md b/README.md index 195c8091..5c44003e 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@ Oqtane uses Blazor, a new web framework for .NET Core that lets you build intera **To get started with Oqtane:** - 1. Oqtane is currently compatible with **[.NET Core 3.0 RC 1 SDK (3.0.100-rc1-014190)](https://dotnet.microsoft.com/download/dotnet-core/3.0)**. + 1. Oqtane is currently compatible with **[.NET Core 3.0](https://dotnet.microsoft.com/download/dotnet-core/3.0)**. - 2. Install the latest **Preview** edition of [Visual Studio 2019](https://visualstudio.com/preview) with the **ASP.NET and web development** workload. Installing the latest **Preview** edition will also install the latest preview of .NET Core 3. + 2. Install the latest edition of [Visual Studio 2019](https://visualstudio.com/vs/) with the **ASP.NET and web development** workload. Installing the latest edition will also install the latest version of .NET Core 3.0. 3. Download or Clone the Oqtane source code to your local system. Open the **Oqtane.sln** solution file. If you want to develop using **server-side** Blazor ( which includes a full debugging experience in Visual Studio ) you should choose to Build the solution using the default Debug configuration. If you want to develop using **client-side** Blazor ( WebAssembly ) you should first choose the "Wasm" configuration option in the Visual Studio toolbar and then Build. @@ -20,21 +20,15 @@ This project is a work in progress and the schedule for implementing the items i Security - Logging +- Need support for JwT tokens for external client access to API Design - Need modern Admin UI theme - Need to cleanly separate site.css -- CSS registration for modules and skins - -Packaging -- Need ability to package/install Modules -- Need ability to package/install Themes Admin - Need fully functional administrative modules for all core entities ( user, role, site, etc… ) -- Need ability to create a new Site and auto provision Admin pages/modules - Need ability to soft delete core entities -- Re-ordering of modules in panes - Drag and Drop modules Upgrade @@ -42,9 +36,6 @@ Upgrade - integrated store/catalog of extensions - auto update - provide url to check for updates, perhaps even download in background - core and extensions -Multi-Tenant -- Need ability to provision a new tenant DB - Database - Need ability to run on SQLite