ayType aytype all now AyaType or ayaType

This commit is contained in:
2020-05-15 21:08:37 +00:00
parent 7806e0df26
commit 8f3118d309
11 changed files with 77 additions and 42 deletions

View File

@@ -20,7 +20,7 @@ namespace AyaNova.Biz
/// <returns></returns>
internal static async Task LogEventToDatabaseAsync(Event newEvent, AyContext ct)
{
//System.Diagnostics.Debug.WriteLine($"Event log event for {newEvent.AyId}:{newEvent.AyType} {newEvent.AyEvent} {newEvent.Created}");
//System.Diagnostics.Debug.WriteLine($"Event log event for {newEvent.AyId}:{newEvent.AyaType} {newEvent.AyEvent} {newEvent.Created}");
await ct.Event.AddAsync(newEvent);
await ct.SaveChangesAsync();
@@ -33,14 +33,14 @@ namespace AyaNova.Biz
/// remove all prior entries for object, add one deleted entry
/// </summary>
/// <param name="userId"></param>
/// <param name="ayType"></param>
/// <param name="ayaType"></param>
/// <param name="ayId"></param>
/// <param name="textra"></param>
/// <param name="ct"></param>
internal static async Task DeleteObjectLogAsync(long userId, AyaType ayType, long ayId, string textra, AyContext ct)
internal static async Task DeleteObjectLogAsync(long userId, AyaType ayaType, long ayId, string textra, AyContext ct)
{
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from aevent where aytype = {ayType} and ayid={ayId}");
await ct.Event.AddAsync(new Event(userId, ayId, ayType, AyaEvent.Deleted, textra));
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from aevent where ayatype = {ayaType} and ayid={ayId}");
await ct.Event.AddAsync(new Event(userId, ayId, ayaType, AyaEvent.Deleted, textra));
await ct.SaveChangesAsync();
}
@@ -57,7 +57,7 @@ namespace AyaNova.Biz
//Set up the query
var q = ct.Event.Select(m => m).AsNoTracking();
q = q.Where(m => m.AyId == opt.AyId && m.AyType == opt.AyType);
q = q.Where(m => m.AyId == opt.AyId && m.AyaType == opt.AyaType);
q = q.OrderByDescending(m => m.Created);
q = q.Skip(offset).Take(limit);
@@ -77,7 +77,7 @@ namespace AyaNova.Biz
Name = BizObjectNameFetcherDirect.Name(AyaType.User, m.UserId, command)
}).ToArray();
ret.Name = BizObjectNameFetcherDirect.Name(opt.AyType, opt.AyId, command);
ret.Name = BizObjectNameFetcherDirect.Name(opt.AyaType, opt.AyId, command);
return ret;
}
}
@@ -115,11 +115,11 @@ namespace AyaNova.Biz
{
Date = m.Created,
ObjectType = m.AyType,
ObjectType = m.AyaType,
ObjectId = m.AyId,
Event = m.AyEvent,
Textra = m.Textra,
Name = BizObjectNameFetcherDirect.Name(m.AyType, m.AyId, command)
Name = BizObjectNameFetcherDirect.Name(m.AyaType, m.AyId, command)
}).ToArray();
ret.Name = BizObjectNameFetcherDirect.Name(AyaType.User, opt.UserId, command);
@@ -137,14 +137,14 @@ namespace AyaNova.Biz
internal static async Task V7_Modify_LogAsync(AyaNova.Api.Controllers.EventLogController.V7Event ev, AyContext ct)
{
//delete the automatically created entry from the exported object
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from aevent where aytype = {ev.AyType} and ayid={ev.AyId}");
await ct.Database.ExecuteSqlInterpolatedAsync($"delete from aevent where ayatype = {ev.AyaType} 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);
await EventLogProcessor.LogEventToDatabaseAsync(new Event(ev.Creator, ev.AyId, ev.AyaType, 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 EventLogProcessor.LogEventToDatabaseAsync(new Event(ev.Modifier, ev.AyId, ev.AyaType, AyaEvent.Modified, ev.Modified, null), ct);
await ct.SaveChangesAsync();