This commit is contained in:
2018-11-29 15:56:43 +00:00
parent a6b82eab27
commit 7a0ed8928d
2 changed files with 24 additions and 20 deletions

View File

@@ -77,8 +77,13 @@ INITIAL TESTING NOTES:
SERVER
- 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
- ProcessObjectKeywords improvement
-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!!

View File

@@ -120,7 +120,7 @@ namespace AyaNova.Biz
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
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)
{
//Log
@@ -129,25 +129,25 @@ namespace AyaNova.Biz
return ret;
}
//get many (paged)
internal async Task<ApiPagedResponse<DataFilter>> GetManyAsync(IUrlHelper Url, string routeName, PagingOptions pagingOptions)
{
// //get many (paged)
// internal async Task<ApiPagedResponse<DataFilter>> GetManyAsync(IUrlHelper Url, string routeName, PagingOptions pagingOptions)
// {
pagingOptions.Offset = pagingOptions.Offset ?? PagingOptions.DefaultOffset;
pagingOptions.Limit = pagingOptions.Limit ?? PagingOptions.DefaultLimit;
// pagingOptions.Offset = pagingOptions.Offset ?? PagingOptions.DefaultOffset;
// pagingOptions.Limit = pagingOptions.Limit ?? PagingOptions.DefaultLimit;
var items = await ct.DataFilter
.OrderBy(m => m.Id)
.Skip(pagingOptions.Offset.Value)
.Take(pagingOptions.Limit.Value)
.ToArrayAsync();
// var items = await ct.DataFilter
// .OrderBy(m => m.Id)
// .Skip(pagingOptions.Offset.Value)
// .Take(pagingOptions.Limit.Value)
// .ToArrayAsync();
var totalRecordCount = await ct.DataFilter.CountAsync();
var pageLinks = new PaginationLinkBuilder(Url, routeName, null, pagingOptions, totalRecordCount).PagingLinksObject();
// var totalRecordCount = await ct.DataFilter.CountAsync();
// var pageLinks = new PaginationLinkBuilder(Url, routeName, null, pagingOptions, totalRecordCount).PagingLinksObject();
ApiPagedResponse<DataFilter> pr = new ApiPagedResponse<DataFilter>(items, pageLinks);
return pr;
}
// ApiPagedResponse<DataFilter> pr = new ApiPagedResponse<DataFilter>(items, pageLinks);
// return pr;
// }
//get picklist (NOT PAGED)
@@ -179,7 +179,6 @@ namespace AyaNova.Biz
//put
internal bool Put(DataFilter dbObj, DataFilter inObj)
{
//Replace the db object with the PUT object
CopyObject.Copy(inObj, dbObj, "Id,Serial");
//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);
//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;
}