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

@@ -58,8 +58,7 @@ SCHEMA
=-=-=-=
AOPSJOB
- jobid long NOT NULL INDEXED UNIQUE (initially I'll use linux epoch when job created, used to tag logs etc, but keeping this open for a change later)
- OwnerId NOT NULL
- jobid long NOT NULL INDEXED UNIQUE (initially I'll use linux epoch when job created, used to tag logs etc, but keeping this open for a change later)
- Created NOT NULL
- Exclusive NOT NULL bool (true=close api and don't run any other jobs, false=process async and keep api open)
- StartAfter NOT NULL INDEXED (datetime to start the job, in cases of start now jobs the date will be minvalue)

View File

@@ -16,13 +16,15 @@ Remove OwnerId
- DONE ValidateJsonPatch
- DONE FileAttachment
- DONE FormCustom
- DONE OpsJob
- DONE UserOptions
- Rename OwnerId to UserId for those objects that require it still
- DONE DataFilter
- EventLog
- Event object uses it see eventlog above
- UserOptions (rename to userID)
- OpsJob (might be removable, rename it CreatorID? Or, if it's already logged in the event log then maybe no creator ID is required at all.)
OwnerID is put on httpcontext in startup.cs, will it still be necessary?
Clean up owner ID and rules now that it's deprecated
@@ -47,6 +49,7 @@ TODO: Make it fucking easier to test deploy and erase db and fetch key and all t
TODO: Licensing - make sure tech type use license works properly: a tech license is consumed if a user has **any one** of the four roles of TechFull, TechLimited, SubcontractorFull, SubcontractorLimited
### TODO FILTER ISSUE: SEE integration tests search for BUGBUG there are two tests failing in DataFilterFilteringLists tests that might be DST related
TODO: JobsBiz::Create -> should log an event in order to be able to see who created a job, but maybe not for automatic internal jobs
=-=-=-=-=-=-
Less urgent things...

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)");