This commit is contained in:
2020-12-24 16:11:38 +00:00
parent f87c2e60b1
commit 068d8099cc
23 changed files with 426 additions and 198 deletions

View File

@@ -147,7 +147,8 @@ namespace AyaNova.Biz
try
{
Part dbObject = await ct.Part.SingleOrDefaultAsync(m => m.Id == id);
if (dbObject == null){
if (dbObject == null)
{
AddError(ApiErrorCode.NOT_FOUND);
return false;
}
@@ -176,13 +177,14 @@ namespace AyaNova.Biz
}
}
////////////////////////////////////////////////////////////////////////////////////////////////
//SEARCH
//
private async Task SearchIndexAsync(Part obj, bool isNew)
{
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserTranslationId, obj.Id, BizType);
SearchParams.AddText(obj.Notes).AddText(obj.Name).AddText(obj.Wiki).AddText(obj.Tags).AddCustomFields(obj.CustomFields);
DigestSearchText(obj, SearchParams);
if (isNew)
await Search.ProcessNewObjectKeywordsAsync(SearchParams);
else
@@ -191,13 +193,23 @@ namespace AyaNova.Biz
public async Task<Search.SearchIndexProcessObjectParameters> GetSearchResultSummary(long id)
{
var obj = await ct.Part.SingleOrDefaultAsync(m => m.Id == id);
var obj = await ct.Part.SingleOrDefaultAsync(z => z.Id == id);
var SearchParams = new Search.SearchIndexProcessObjectParameters();
if (obj != null)
SearchParams.AddText(obj.Notes).AddText(obj.Name).AddText(obj.Wiki).AddText(obj.Tags).AddCustomFields(obj.CustomFields);
DigestSearchText(obj, SearchParams);
return SearchParams;
}
public void DigestSearchText(Part obj, Search.SearchIndexProcessObjectParameters searchParams)
{
if (obj != null)
searchParams.AddText(obj.Notes)
.AddText(obj.Name)
.AddText(obj.Wiki)
.AddText(obj.Tags)
.AddCustomFields(obj.CustomFields);
}
////////////////////////////////////////////////////////////////////////////////////////////////
//VALIDATION
@@ -212,7 +224,7 @@ namespace AyaNova.Biz
if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
//If name is otherwise OK, check that name is unique
if (!PropertyHasErrors("Name"))
@@ -246,13 +258,13 @@ namespace AyaNova.Biz
}
////////////////////////////////////////////////////////////////////////////////////////////////
// NOTIFICATION PROCESSING
//
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj=null)
public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null)
{
ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger<PartBiz>();
if (ServerBootConfig.SEEDING) return;