This commit is contained in:
2018-10-09 15:05:26 +00:00
parent 7f03a019d7
commit 2f5d2a8d26
6 changed files with 46 additions and 29 deletions

View File

@@ -43,6 +43,12 @@ namespace AyaNova.Biz
IsValid = false;
}
if (objectPatch.Operations.Any(m => m.path == "/serial"))
{
biz.AddError(ValidationErrorType.NotChangeable, "Serial");
IsValid = false;
}
if (objectPatch.Operations.Any(m => m.op == "add"))
{
biz.AddError(ValidationErrorType.InvalidOperation, "add");

View File

@@ -78,7 +78,7 @@ namespace AyaNova.Biz
EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
//SEARCH INDEXING
Search.ProcessNewObjectKeywords(ct, UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Notes, outObj.Name);
Search.ProcessNewObjectKeywords(ct, UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Notes, outObj.Name, outObj.Serial.ToString());
return outObj;
@@ -109,7 +109,7 @@ namespace AyaNova.Biz
EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), TempContext);
//SEARCH INDEXING
Search.ProcessNewObjectKeywords(TempContext, UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Notes, outObj.Name);
Search.ProcessNewObjectKeywords(TempContext, UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Notes, outObj.Name, outObj.Serial.ToString());
return outObj;
@@ -225,7 +225,7 @@ namespace AyaNova.Biz
EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
//Update keywords
Search.ProcessUpdatedObjectKeywords(ct, UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Notes, dbObj.Name);
Search.ProcessUpdatedObjectKeywords(ct, UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Notes, dbObj.Name, dbObj.Serial.ToString());
return true;
}
@@ -234,6 +234,7 @@ namespace AyaNova.Biz
internal bool Patch(Widget dbObj, JsonPatchDocument<Widget> objectPatch, uint concurrencyToken)
{
//Validate Patch is allowed
//Note: Id, OwnerId and Serial are all checked for and disallowed in the validate code by default
if (!ValidateJsonPatch<Widget>.Validate(this, objectPatch)) return false;
//Do the patching
@@ -247,7 +248,7 @@ namespace AyaNova.Biz
EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
//Update keywords
Search.ProcessUpdatedObjectKeywords(ct, UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Notes, dbObj.Name);
Search.ProcessUpdatedObjectKeywords(ct, UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Notes, dbObj.Name, dbObj.Serial.ToString());
return true;
}