This commit is contained in:
@@ -2,6 +2,7 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using AyaNova.Models;
|
||||
using System;
|
||||
|
||||
|
||||
namespace AyaNova.Biz
|
||||
@@ -56,7 +57,7 @@ namespace AyaNova.Biz
|
||||
|
||||
//Set up the query
|
||||
var q = ct.Event.Select(m => m).Skip(offset).Take(limit).AsNoTracking();
|
||||
q = q.Where(m => m.AyId == opt.AyId && m.AyType== opt.AyType);
|
||||
q = q.Where(m => m.AyId == opt.AyId && m.AyType == opt.AyType);
|
||||
q = q.OrderByDescending(m => m.Created);
|
||||
q = q.Skip(offset).Take(limit);
|
||||
|
||||
@@ -123,6 +124,28 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// V7 import handler
|
||||
/// Import needs to fixup event log CREATED entry to show original created and last modified times
|
||||
/// and users
|
||||
/// </summary>
|
||||
internal static async Task V7_Modify_LogAsync(AyaNova.Api.Controllers.EventLogController.V7Event ev, AyContext ct)
|
||||
{
|
||||
//delete the automatically created entry from the import object
|
||||
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from aevent where aytype = {ev.AyType} and ayid={ev.AyId}");
|
||||
|
||||
//Now create the entries to reflect the original data from v7
|
||||
//CREATED
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(ev.Creator, ev.AyId, ev.AyType, AyaEvent.Created, ev.Created, null), ct);
|
||||
|
||||
//MODIFIED
|
||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(ev.Modifier,ev.AyId, ev.AyType, AyaEvent.Modified, ev.Modified, null), ct);
|
||||
|
||||
|
||||
await ct.SaveChangesAsync();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Reference in New Issue
Block a user