This commit is contained in:
@@ -386,10 +386,13 @@ namespace AyaNova.Biz
|
|||||||
public List<string> Tags { get; set; }
|
public List<string> Tags { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public SearchIndexProcessObjectParameters(long localeId, long objectID, AyaType objectType, string name)
|
public SearchIndexProcessObjectParameters(long localeId, long objectID, AyaType objectType, string name, List<string> tags = null)
|
||||||
{
|
{
|
||||||
Words = new List<string>();
|
Words = new List<string>();
|
||||||
Tags = new List<string>();
|
if (tags != null)
|
||||||
|
Tags = tags;
|
||||||
|
else
|
||||||
|
Tags = new List<string>();
|
||||||
LocaleId = localeId;
|
LocaleId = localeId;
|
||||||
ObjectId = objectID;
|
ObjectId = objectID;
|
||||||
ObjectType = objectType;
|
ObjectType = objectType;
|
||||||
@@ -716,7 +719,7 @@ namespace AyaNova.Biz
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static List<string> BreakSearchPhrase(long localeId, string searchPhrase)
|
internal static List<string> BreakSearchPhrase(long localeId, string searchPhrase)
|
||||||
{
|
{
|
||||||
List<string> textStrings=new List<string>();
|
List<string> textStrings = new List<string>();
|
||||||
textStrings.Add(searchPhrase);
|
textStrings.Add(searchPhrase);
|
||||||
return BreakCore(localeId, true, textStrings);
|
return BreakCore(localeId, true, textStrings);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
internal class UserBiz : BizObject, IJobObject, IImportAyaNova7Object
|
internal class UserBiz : BizObject, IJobObject, IImportAyaNova7Object
|
||||||
{
|
{
|
||||||
|
|
||||||
public bool SeedOrImportRelaxedRulesMode { get; set; }
|
public bool SeedOrImportRelaxedRulesMode { get; set; }
|
||||||
|
|
||||||
internal UserBiz(AyContext dbcontext, long currentUserId, long userLocaleId, AuthorizationRoles userRoles)
|
internal UserBiz(AyContext dbcontext, long currentUserId, long userLocaleId, AuthorizationRoles userRoles)
|
||||||
@@ -61,6 +61,7 @@ namespace AyaNova.Biz
|
|||||||
//do stuff with User
|
//do stuff with User
|
||||||
User outObj = inObj;
|
User outObj = inObj;
|
||||||
outObj.OwnerId = UserId;
|
outObj.OwnerId = UserId;
|
||||||
|
outObj.Tags = TagUtil.NormalizeTags(outObj.Tags);
|
||||||
//Seeder sets user options in advance so no need to create them here in that case
|
//Seeder sets user options in advance so no need to create them here in that case
|
||||||
if (outObj.UserOptions == null)
|
if (outObj.UserOptions == null)
|
||||||
outObj.UserOptions = new UserOptions(UserId);
|
outObj.UserOptions = new UserOptions(UserId);
|
||||||
@@ -73,9 +74,12 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
//Log event
|
//Log event
|
||||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
|
EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
|
||||||
|
|
||||||
//SEARCH INDEXING
|
//SEARCH INDEXING
|
||||||
Search.ProcessNewObjectKeywords( UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.EmployeeNumber, outObj.Notes, outObj.Name);
|
//Search.ProcessNewObjectKeywords( UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.EmployeeNumber, outObj.Notes, outObj.Name);
|
||||||
|
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Tags);
|
||||||
|
SearchParams.AddWord(outObj.Notes).AddWord(outObj.Name).AddWord(outObj.EmployeeNumber);
|
||||||
|
Search.ProcessNewObjectKeywords(SearchParams);
|
||||||
|
|
||||||
return outObj;
|
return outObj;
|
||||||
|
|
||||||
@@ -98,6 +102,7 @@ namespace AyaNova.Biz
|
|||||||
//do stuff with User
|
//do stuff with User
|
||||||
User outObj = inObj;
|
User outObj = inObj;
|
||||||
outObj.OwnerId = UserId;
|
outObj.OwnerId = UserId;
|
||||||
|
outObj.Tags = TagUtil.NormalizeTags(outObj.Tags);
|
||||||
//Seeder sets user options in advance so no need to create them here in that case
|
//Seeder sets user options in advance so no need to create them here in that case
|
||||||
if (outObj.UserOptions == null)
|
if (outObj.UserOptions == null)
|
||||||
outObj.UserOptions = new UserOptions(UserId);
|
outObj.UserOptions = new UserOptions(UserId);
|
||||||
@@ -110,9 +115,12 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
//Log event
|
//Log event
|
||||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), TempContext);
|
EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), TempContext);
|
||||||
|
|
||||||
//SEARCH INDEXING
|
//SEARCH INDEXING
|
||||||
Search.ProcessNewObjectKeywords(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.EmployeeNumber, outObj.Notes, outObj.Name);
|
// Search.ProcessNewObjectKeywords(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.EmployeeNumber, outObj.Notes, outObj.Name);
|
||||||
|
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Tags);
|
||||||
|
SearchParams.AddWord(outObj.Notes).AddWord(outObj.Name).AddWord(outObj.EmployeeNumber);
|
||||||
|
Search.ProcessNewObjectKeywords(SearchParams);
|
||||||
|
|
||||||
return outObj;
|
return outObj;
|
||||||
|
|
||||||
@@ -130,7 +138,7 @@ namespace AyaNova.Biz
|
|||||||
if (ret != null)
|
if (ret != null)
|
||||||
{
|
{
|
||||||
//Log
|
//Log
|
||||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, fetchId, BizType, AyaEvent.Retrieved), ct);
|
EventLogProcessor.LogEventToDatabase(new Event(UserId, fetchId, BizType, AyaEvent.Retrieved), ct);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -220,16 +228,17 @@ namespace AyaNova.Biz
|
|||||||
//put
|
//put
|
||||||
internal bool Put(User dbObj, User inObj)
|
internal bool Put(User dbObj, User inObj)
|
||||||
{
|
{
|
||||||
//preserve the owner ID if none was specified
|
//preserve the owner ID if none was specified
|
||||||
if (inObj.OwnerId == 0)
|
if (inObj.OwnerId == 0)
|
||||||
inObj.OwnerId = dbObj.OwnerId;
|
inObj.OwnerId = dbObj.OwnerId;
|
||||||
|
|
||||||
//Get a snapshot of the original db value object before changes
|
//Get a snapshot of the original db value object before changes
|
||||||
User SnapshotObj = new User();
|
User SnapshotObj = new User();
|
||||||
CopyObject.Copy(dbObj, SnapshotObj);
|
CopyObject.Copy(dbObj, SnapshotObj);
|
||||||
|
|
||||||
//Update the db object with the PUT object values
|
//Update the db object with the PUT object values
|
||||||
CopyObject.Copy(inObj, dbObj, "Id, Salt");
|
CopyObject.Copy(inObj, dbObj, "Id, Salt");
|
||||||
|
dbObj.Tags = TagUtil.NormalizeTags(dbObj.Tags);
|
||||||
|
|
||||||
//Is the user updating the password?
|
//Is the user updating the password?
|
||||||
if (!string.IsNullOrWhiteSpace(inObj.Password) && SnapshotObj.Password != inObj.Password)
|
if (!string.IsNullOrWhiteSpace(inObj.Password) && SnapshotObj.Password != inObj.Password)
|
||||||
@@ -255,9 +264,12 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
//Log modification
|
//Log modification
|
||||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
|
EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
|
||||||
//Update keywords
|
//Update keywords
|
||||||
Search.ProcessUpdatedObjectKeywords( UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.EmployeeNumber, dbObj.Notes, dbObj.Name);
|
// Search.ProcessUpdatedObjectKeywords(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.EmployeeNumber, dbObj.Notes, dbObj.Name);
|
||||||
|
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Tags);
|
||||||
|
SearchParams.AddWord(dbObj.Notes).AddWord(dbObj.Name).AddWord(dbObj.EmployeeNumber);
|
||||||
|
Search.ProcessNewObjectKeywords(SearchParams);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -274,6 +286,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
//Do the patching
|
//Do the patching
|
||||||
objectPatch.ApplyTo(dbObj);
|
objectPatch.ApplyTo(dbObj);
|
||||||
|
dbObj.Tags = TagUtil.NormalizeTags(dbObj.Tags);
|
||||||
|
|
||||||
//Is the user patching the password?
|
//Is the user patching the password?
|
||||||
if (!string.IsNullOrWhiteSpace(dbObj.Password) && dbObj.Password != snapshotObj.Password)
|
if (!string.IsNullOrWhiteSpace(dbObj.Password) && dbObj.Password != snapshotObj.Password)
|
||||||
@@ -289,9 +302,12 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
//Log modification
|
//Log modification
|
||||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
|
EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
|
||||||
|
|
||||||
//Update keywords
|
//Update keywords
|
||||||
Search.ProcessUpdatedObjectKeywords( UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.EmployeeNumber, dbObj.Notes, dbObj.Name);
|
// Search.ProcessUpdatedObjectKeywords(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.EmployeeNumber, dbObj.Notes, dbObj.Name);
|
||||||
|
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Tags);
|
||||||
|
SearchParams.AddWord(dbObj.Notes).AddWord(dbObj.Name).AddWord(dbObj.EmployeeNumber);
|
||||||
|
Search.ProcessNewObjectKeywords(SearchParams);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -99,11 +99,9 @@ namespace AyaNova.Biz
|
|||||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
|
EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), ct);
|
||||||
|
|
||||||
//SEARCH INDEXING
|
//SEARCH INDEXING
|
||||||
var search = new Search.SearchIndexProcessObjectParameters();
|
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Tags);
|
||||||
search.Tags=outObj.Tags;
|
SearchParams.AddWord(outObj.Notes).AddWord(outObj.Name).AddWord(outObj.Serial);
|
||||||
search.Name=outObj.Name;
|
Search.ProcessNewObjectKeywords(SearchParams);
|
||||||
search.AddWord(outObj.Notes).AddWord(outObj.Name).AddWord(outObj.Serial);
|
|
||||||
Search.ProcessNewObjectKeywords(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Notes, outObj.Name, outObj.Serial.ToString());
|
|
||||||
|
|
||||||
return outObj;
|
return outObj;
|
||||||
|
|
||||||
@@ -135,8 +133,10 @@ namespace AyaNova.Biz
|
|||||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), TempContext);
|
EventLogProcessor.LogEventToDatabase(new Event(UserId, outObj.Id, BizType, AyaEvent.Created), TempContext);
|
||||||
|
|
||||||
//SEARCH INDEXING
|
//SEARCH INDEXING
|
||||||
Search.ProcessNewObjectKeywords(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Notes, outObj.Name, outObj.Serial.ToString());
|
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserLocaleId, outObj.Id, BizType, outObj.Name, outObj.Tags);
|
||||||
|
SearchParams.AddWord(outObj.Notes).AddWord(outObj.Name).AddWord(outObj.Serial);
|
||||||
|
Search.ProcessNewObjectKeywords(SearchParams);
|
||||||
|
|
||||||
return outObj;
|
return outObj;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -295,7 +295,10 @@ namespace AyaNova.Biz
|
|||||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
|
EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
|
||||||
|
|
||||||
//Update keywords
|
//Update keywords
|
||||||
Search.ProcessUpdatedObjectKeywords(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Notes, dbObj.Name, dbObj.Serial.ToString());
|
// Search.ProcessUpdatedObjectKeywords(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Notes, dbObj.Name, dbObj.Serial.ToString());
|
||||||
|
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Tags);
|
||||||
|
SearchParams.AddWord(dbObj.Notes).AddWord(dbObj.Name).AddWord(dbObj.Serial);
|
||||||
|
Search.ProcessNewObjectKeywords(SearchParams);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -321,7 +324,10 @@ namespace AyaNova.Biz
|
|||||||
EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
|
EventLogProcessor.LogEventToDatabase(new Event(UserId, dbObj.Id, BizType, AyaEvent.Modified), ct);
|
||||||
|
|
||||||
//Update keywords
|
//Update keywords
|
||||||
Search.ProcessUpdatedObjectKeywords(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Notes, dbObj.Name, dbObj.Serial.ToString());
|
//Search.ProcessUpdatedObjectKeywords(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Notes, dbObj.Name, dbObj.Serial.ToString());
|
||||||
|
var SearchParams = new Search.SearchIndexProcessObjectParameters(UserLocaleId, dbObj.Id, BizType, dbObj.Name, dbObj.Tags);
|
||||||
|
SearchParams.AddWord(dbObj.Notes).AddWord(dbObj.Name).AddWord(dbObj.Serial);
|
||||||
|
Search.ProcessNewObjectKeywords(SearchParams);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,12 +37,18 @@ namespace AyaNova.Models
|
|||||||
public long? HeadOfficeId { get; set; }
|
public long? HeadOfficeId { get; set; }
|
||||||
public long? SubVendorId { get; set; }
|
public long? SubVendorId { get; set; }
|
||||||
|
|
||||||
|
public List<string> Tags { get; set; }
|
||||||
|
|
||||||
//relations
|
//relations
|
||||||
//https://docs.microsoft.com/en-us/ef/core/modeling/relationships#other-relationship-patterns
|
//https://docs.microsoft.com/en-us/ef/core/modeling/relationships#other-relationship-patterns
|
||||||
[JsonIgnore]//hide from being returned (as null anyway) with User object in routes
|
[JsonIgnore]//hide from being returned (as null anyway) with User object in routes
|
||||||
public UserOptions UserOptions { get; set; }
|
public UserOptions UserOptions { get; set; }
|
||||||
|
|
||||||
|
public User()
|
||||||
|
{
|
||||||
|
Tags = new List<string>();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user