This commit is contained in:
2019-05-20 22:05:06 +00:00
parent d9f7a69da6
commit 9b91b85a64
8 changed files with 18 additions and 15 deletions

View File

@@ -72,7 +72,7 @@ namespace AyaNova.Biz
var ret = EventItems.Select(m => new AyaNova.Api.Controllers.EventLogController.ObjectEventLogItem()
{
Date = m.Created,
UserId = m.OwnerId,
UserId = m.UserId,
Event = m.AyEvent,
Textra = m.Textra
}).ToArray();
@@ -91,7 +91,7 @@ namespace AyaNova.Biz
//Set up the query
var q = ct.Event.Select(m => m);
q = q.Where(m => m.OwnerId == opt.AyId);
q = q.Where(m => m.UserId == opt.AyId);
if (opt.StartDate != null)
q = q.Where(m => m.Created > opt.StartDate);

View File

@@ -142,6 +142,7 @@ namespace AyaNova.Biz
/// <returns></returns>
internal static OpsJob AddJob(OpsJob newJob, AyContext ct)
{
//TODO: Does this need to create an event so we know which user created the job?
ct.OpsJob.Add(newJob);
ct.SaveChanges();
return newJob;

View File

@@ -113,7 +113,7 @@ namespace AyaNova.Biz
/*
2018-12-12 16:29:12.7547|INFO|Microsoft.EntityFrameworkCore.Database.Command|Executed DbCommand (3ms) [Parameters=[@__p_2='999', @__p_1='0'], CommandType='Text', CommandTimeout='30']
SELECT a.id, a.active, a.xmin, a.count, a.dollaramount, a.enddate, a.name, a.notes, a.ownerid, a.roles, a.serial, a.startdate, a.tags
SELECT a.id, a.active, a.xmin, a.count, a.dollaramount, a.enddate, a.name, a.notes, a.o wnerid, a.roles, a.serial, a.startdate, a.tags
FROM (
SELECT *, xmin FROM AWIDGET where (name Like 'SortByFieldAscendingWorks 1544660950941%') ORDER BY startdate ASC
) AS a

View File

@@ -551,7 +551,7 @@ namespace AyaNova.Biz
//They can always make any user inactive to get rid of them and it will mean referential integrity issues are not there
//There's only one rule - have they done anything eventlog worthy yet?
if (ct.Event.Select(m => m).Where(m => m.OwnerId == inObj.Id).Count() > 0)
if (ct.Event.Select(m => m).Where(m => m.UserId == inObj.Id).Count() > 0)
{
AddError(ApiErrorCode.INVALID_OPERATION, "user", "LT:ErrorDBForeignKeyViolation");
return;

View File

@@ -14,7 +14,7 @@ namespace AyaNova.Models
public uint ConcurrencyToken { get; set; }
public DateTime Created { get; set; }
[Required]
public long OwnerId { get; set; }
public long UserId { get; set; }
//-----------------------------------------
[Required]
public long AyId { get; set; }
@@ -32,10 +32,10 @@ namespace AyaNova.Models
Created = System.DateTime.UtcNow;
}
public Event(long ownerId, long ayId, AyaType ayType, AyaEvent ayEvent, string textra = null)
public Event(long userId, long ayId, AyaType ayType, AyaEvent ayEvent, string textra = null)
{
Created = System.DateTime.UtcNow;
OwnerId = ownerId;
UserId = userId;
AyId = ayId;
AyType = ayType;
AyEvent = ayEvent;
@@ -47,10 +47,10 @@ namespace AyaNova.Models
}
}
public Event(long ownerId, long ayId, AyaType ayType, AyaEvent ayEvent, DateTime created, string textra = null)
public Event(long userId, long ayId, AyaType ayType, AyaEvent ayEvent, DateTime created, string textra = null)
{
Created = created;
OwnerId = ownerId;
UserId = userId;
AyId = ayId;
AyType = ayType;
AyEvent = ayEvent;

View File

@@ -136,7 +136,7 @@ namespace AyaNova.Util
LogUpdateMessage(log);
//create aevent biz event log table
exec("CREATE TABLE aevent (id BIGSERIAL PRIMARY KEY, created timestamp not null, ownerid bigint not null," +
exec("CREATE TABLE aevent (id BIGSERIAL PRIMARY KEY, created timestamp not null, userid bigint not null," +
"ayid bigint not null, aytype integer not null, ayevent integer not null, textra varchar(255))");
//SEARCH TABLES
@@ -248,7 +248,7 @@ namespace AyaNova.Util
{
LogUpdateMessage(log);
exec("CREATE TABLE aopsjob (gid uuid PRIMARY KEY, ownerid bigint not null, name text not null, created timestamp not null, exclusive bool not null, " +
exec("CREATE TABLE aopsjob (gid uuid PRIMARY KEY, name text not null, created timestamp not null, exclusive bool not null, " +
"startafter timestamp not null, jobtype integer not null, objectid bigint null, objecttype integer null, jobstatus integer not null, jobinfo text null)");
exec("CREATE TABLE aopsjoblog (gid uuid PRIMARY KEY, jobid uuid not null REFERENCES aopsjob (gid), created timestamp not null, statustext text not null)");