Reporting: Add UserName
This commit is contained in:
30
Server/Migrations/ReportSystem/01000001_AddUserName.cs
Normal file
30
Server/Migrations/ReportSystem/01000001_AddUserName.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Oqtane.Databases.Interfaces;
|
||||
using Oqtane.Migrations;
|
||||
using SZUAbsolventenverein.Module.AdminModules.Migrations.EntityBuilders;
|
||||
using SZUAbsolventenverein.Module.AdminModules.Repository;
|
||||
|
||||
namespace SZUAbsolventenverein.Module.ReportSystem.Migrations
|
||||
{
|
||||
[DbContext(typeof(ReportingContext))]
|
||||
[Migration("SZUAbsolventenverein.Module.ReportSystem.01.00.00.01")]
|
||||
public class AddUserName : MultiDatabaseMigration
|
||||
{
|
||||
public AddUserName(IDatabase database) : base(database)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
var entityBuilder = new ReportingEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||
entityBuilder.AddStringColumn("UserName", 256, false, false, "");
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
var entityBuilder = new ReportingEntityBuilder(migrationBuilder, ActiveDatabase);
|
||||
entityBuilder.DropColumn("UserName");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,7 @@ namespace SZUAbsolventenverein.Module.ReportSystem.Services
|
||||
{
|
||||
// if (_userPermissions.IsAuthorized(_accessor.HttpContext.User, _alias.SiteId, EntityNames.Module, ModuleId, PermissionNames.Edit))
|
||||
{
|
||||
Reporting reporting = await CreateReportAsync(new Reporting {ModuleId = reportable.ModuleID, EntityId = reportable.EntityID, Note = note, Reason = "Default Reason"});
|
||||
Reporting reporting = await CreateReportAsync(new Reporting {ModuleId = reportable.ModuleID, EntityId = reportable.EntityID, UserName = reportable.UserName, Note = note, Reason = "Default Reason"});
|
||||
if (reporting != null)
|
||||
{
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Reporting recieved {ReportingId}", reporting.ReportingID);
|
||||
|
||||
Reference in New Issue
Block a user