This commit is contained in:
@@ -77,8 +77,13 @@ INITIAL TESTING NOTES:
|
|||||||
|
|
||||||
|
|
||||||
SERVER
|
SERVER
|
||||||
- WidgetBiz Create / CreateAsync share much the same code, move redundancies to common method
|
- ProcessObjectKeywords improvement
|
||||||
- This object will be replicated repeatedly so it always pays to clean it up more and more
|
-Should just be able to pass the object to be processed to a method that will automatically find the Name field and all text fields and process it accordingly
|
||||||
|
- May need a hint if there isn't a specific "Name" field but that's probably so rare that can just leave that out and continue the old way for any object without a Name
|
||||||
|
- Do these after doing the above as it may be all that's required for them anyway:
|
||||||
|
- WidgetBiz Create / CreateAsync share much the same code, move redundancies to common method
|
||||||
|
- This object will be replicated repeatedly so it always pays to clean it up more and more
|
||||||
|
- WidgetBiz Put/Patch also share nearly the same process keywords code, so move to common method!!
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ namespace AyaNova.Biz
|
|||||||
internal async Task<DataFilter> GetAsync(long fetchId)
|
internal async Task<DataFilter> GetAsync(long fetchId)
|
||||||
{
|
{
|
||||||
//This is simple so nothing more here, but often will be copying to a different output object or some other ops
|
//This is simple so nothing more here, but often will be copying to a different output object or some other ops
|
||||||
var ret = await ct.DataFilter.SingleOrDefaultAsync(m => m.Id == fetchId);
|
var ret = await ct.DataFilter.SingleOrDefaultAsync(m => m.Id == fetchId && (m.Public == true || m.OwnerId == UserId));
|
||||||
if (ret != null)
|
if (ret != null)
|
||||||
{
|
{
|
||||||
//Log
|
//Log
|
||||||
@@ -129,25 +129,25 @@ namespace AyaNova.Biz
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
//get many (paged)
|
// //get many (paged)
|
||||||
internal async Task<ApiPagedResponse<DataFilter>> GetManyAsync(IUrlHelper Url, string routeName, PagingOptions pagingOptions)
|
// internal async Task<ApiPagedResponse<DataFilter>> GetManyAsync(IUrlHelper Url, string routeName, PagingOptions pagingOptions)
|
||||||
{
|
// {
|
||||||
|
|
||||||
pagingOptions.Offset = pagingOptions.Offset ?? PagingOptions.DefaultOffset;
|
// pagingOptions.Offset = pagingOptions.Offset ?? PagingOptions.DefaultOffset;
|
||||||
pagingOptions.Limit = pagingOptions.Limit ?? PagingOptions.DefaultLimit;
|
// pagingOptions.Limit = pagingOptions.Limit ?? PagingOptions.DefaultLimit;
|
||||||
|
|
||||||
var items = await ct.DataFilter
|
// var items = await ct.DataFilter
|
||||||
.OrderBy(m => m.Id)
|
// .OrderBy(m => m.Id)
|
||||||
.Skip(pagingOptions.Offset.Value)
|
// .Skip(pagingOptions.Offset.Value)
|
||||||
.Take(pagingOptions.Limit.Value)
|
// .Take(pagingOptions.Limit.Value)
|
||||||
.ToArrayAsync();
|
// .ToArrayAsync();
|
||||||
|
|
||||||
var totalRecordCount = await ct.DataFilter.CountAsync();
|
// var totalRecordCount = await ct.DataFilter.CountAsync();
|
||||||
var pageLinks = new PaginationLinkBuilder(Url, routeName, null, pagingOptions, totalRecordCount).PagingLinksObject();
|
// var pageLinks = new PaginationLinkBuilder(Url, routeName, null, pagingOptions, totalRecordCount).PagingLinksObject();
|
||||||
|
|
||||||
ApiPagedResponse<DataFilter> pr = new ApiPagedResponse<DataFilter>(items, pageLinks);
|
// ApiPagedResponse<DataFilter> pr = new ApiPagedResponse<DataFilter>(items, pageLinks);
|
||||||
return pr;
|
// return pr;
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
//get picklist (NOT PAGED)
|
//get picklist (NOT PAGED)
|
||||||
@@ -179,7 +179,6 @@ namespace AyaNova.Biz
|
|||||||
//put
|
//put
|
||||||
internal bool Put(DataFilter dbObj, DataFilter inObj)
|
internal bool Put(DataFilter dbObj, DataFilter inObj)
|
||||||
{
|
{
|
||||||
|
|
||||||
//Replace the db object with the PUT object
|
//Replace the db object with the PUT object
|
||||||
CopyObject.Copy(inObj, dbObj, "Id,Serial");
|
CopyObject.Copy(inObj, dbObj, "Id,Serial");
|
||||||
//Set "original" value of concurrency token to input token
|
//Set "original" value of concurrency token to input token
|
||||||
@@ -194,7 +193,7 @@ 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.Name);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user