add ability to view Migration History
This commit is contained in:
28
Oqtane.Server/Controllers/MigrationHistoryController.cs
Normal file
28
Oqtane.Server/Controllers/MigrationHistoryController.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Oqtane.Models;
|
||||
using System.Collections.Generic;
|
||||
using Oqtane.Shared;
|
||||
using Oqtane.Repository;
|
||||
|
||||
namespace Oqtane.Controllers
|
||||
{
|
||||
[Route(ControllerRoutes.ApiRoute)]
|
||||
public class MigrationHistoryController : Controller
|
||||
{
|
||||
private readonly IMigrationHistoryRepository _history;
|
||||
|
||||
public MigrationHistoryController(IMigrationHistoryRepository history)
|
||||
{
|
||||
_history = history;
|
||||
}
|
||||
|
||||
// GET: api/<controller>
|
||||
[HttpGet]
|
||||
[Authorize(Roles = RoleNames.Host)]
|
||||
public IEnumerable<MigrationHistory> Get()
|
||||
{
|
||||
return _history.GetMigrationHistory();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -228,6 +228,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
services.AddScoped<IImageService, ImageService>();
|
||||
services.AddScoped<ICookieConsentService, ServerCookieConsentService>();
|
||||
services.AddScoped<ITimeZoneService, TimeZoneService>();
|
||||
services.AddScoped<IMigrationHistoryService, MigrationHistoryService>();
|
||||
|
||||
// providers
|
||||
services.AddScoped<ITextEditor, Oqtane.Modules.Controls.QuillJSTextEditor>();
|
||||
@ -276,6 +277,7 @@ namespace Microsoft.Extensions.DependencyInjection
|
||||
services.AddTransient<IVisitorRepository, VisitorRepository>();
|
||||
services.AddTransient<IUrlMappingRepository, UrlMappingRepository>();
|
||||
services.AddTransient<ISearchContentRepository, SearchContentRepository>();
|
||||
services.AddTransient<IMigrationHistoryRepository, MigrationHistoryRepository>();
|
||||
|
||||
// managers
|
||||
services.AddTransient<IDBContextDependencies, DBContextDependencies>();
|
||||
|
||||
@ -69,6 +69,7 @@ namespace Oqtane.Repository
|
||||
public virtual DbSet<JobLog> JobLog { get; set; }
|
||||
public virtual DbSet<Setting> Setting { get; set; }
|
||||
public virtual DbSet<Theme> Theme { get; set; }
|
||||
public virtual DbSet<MigrationHistory> MigrationHistory { get; set; }
|
||||
|
||||
public override int SaveChanges()
|
||||
{
|
||||
|
||||
25
Oqtane.Server/Repository/MigrationHistoryRepository.cs
Normal file
25
Oqtane.Server/Repository/MigrationHistoryRepository.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Oqtane.Models;
|
||||
|
||||
namespace Oqtane.Repository
|
||||
{
|
||||
public interface IMigrationHistoryRepository
|
||||
{
|
||||
IEnumerable<MigrationHistory> GetMigrationHistory();
|
||||
}
|
||||
public class MigrationHistoryRepository : IMigrationHistoryRepository
|
||||
{
|
||||
private MasterDBContext _db;
|
||||
|
||||
public MigrationHistoryRepository(MasterDBContext context)
|
||||
{
|
||||
_db = context;
|
||||
}
|
||||
|
||||
public IEnumerable<MigrationHistory> GetMigrationHistory()
|
||||
{
|
||||
return _db.MigrationHistory.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user