This commit is contained in:
2021-01-27 23:32:05 +00:00
parent d44361fc19
commit 34a4c31249
17 changed files with 106 additions and 101 deletions

View File

@@ -1,5 +1,7 @@
LIST / GRAPH FILTERING SORTING AND COLUMN RETURNED
##### DEPRECATED ALL LISTVIEW STUFF FOR NEW SPLIT METHOD SOME OF BELOW IS OUTDATED WHERE IT DEALS WITH THE "LISTVIEW"
DATALIST
A dataList is a raw source of data for returning to client
All below is based on a datalist which is a predefined list of fields, rights and some query info for joins etc
@@ -27,7 +29,7 @@ Users can select a datalistview for a picklist DataList which will in turn affec
Users will get the default hard coded DataListView built into the DataList that is specified for that picklist unless it's changed to an alternative datalistview
There is a default PickList format and a default DataTable format pre-defined and hard coded at the server with each dataList definition object
If the client isn't using a particular dataListView it MUST send the ListView json as empty string or omit it entirely.
If the client isn't using a particular dataListView it MUST send the Lis tView json as empty string or omit it entirely.
This will instruct the server to use the pre-defined format instead
JSON DataListView format:

View File

@@ -21,13 +21,13 @@ namespace AyaNova.Api.Controllers
/// </summary>
[ApiController]
[ApiVersion("8.0")]
[Route("api/v{version:apiVersion}/data-list-view")]
[Route("api/v{version:apiVersion}/data-list-filter")]
[Produces("application/json")]
[Authorize]
public class DataListViewController : ControllerBase
public class DataListSavedFilterController : ControllerBase
{
private readonly AyContext ct;
private readonly ILogger<DataListViewController> log;
private readonly ILogger<DataListSavedFilterController> log;
private readonly ApiServerState serverState;
@@ -37,7 +37,7 @@ namespace AyaNova.Api.Controllers
/// <param name="dbcontext"></param>
/// <param name="logger"></param>
/// <param name="apiServerState"></param>
public DataListViewController(AyContext dbcontext, ILogger<DataListViewController> logger, ApiServerState apiServerState)
public DataListSavedFilterController(AyContext dbcontext, ILogger<DataListSavedFilterController> logger, ApiServerState apiServerState)
{
ct = dbcontext;
log = logger;
@@ -46,18 +46,18 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get full DataListView object
/// Get full DataListSavedFilter object
/// </summary>
/// <param name="id"></param>
/// <returns>A single DataListView</returns>
/// <returns>A single DataListSavedFilter</returns>
[HttpGet("{id}")]
public async Task<IActionResult> GetDataListView([FromRoute] long id)
public async Task<IActionResult> GetDataListSavedFilter([FromRoute] long id)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
//Instantiate the business object handler
DataListViewBiz biz = DataListViewBiz.GetBiz(ct, HttpContext);
DataListSavedFilterBiz biz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse());
@@ -75,11 +75,11 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get DataListView list
/// Get DataListSavedFilter list
/// </summary>
/// <returns>List of public or owned data list views listKey provided</returns>
[HttpGet("viewlist", Name = nameof(DataListViewList))]
public async Task<IActionResult> DataListViewList([FromQuery] string ListKey)
[HttpGet("list", Name = nameof(DataListSavedFilterList))]
public async Task<IActionResult> DataListSavedFilterList([FromQuery] string ListKey)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
@@ -88,7 +88,7 @@ namespace AyaNova.Api.Controllers
return BadRequest(new ApiErrorResponse(ModelState));
//Instantiate the business object handler
DataListViewBiz biz = DataListViewBiz.GetBiz(ct, HttpContext);
DataListSavedFilterBiz biz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
var l = await biz.GetViewListAsync(ListKey);
return Ok(ApiOkResponse.Response(l));
@@ -97,13 +97,13 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Put (update) DataListView
/// Put (update) DataListSavedFilter
/// </summary>
/// <param name="id"></param>
/// <param name="inObj"></param>
/// <returns></returns>
[HttpPut("{id}")]
public async Task<IActionResult> PutDataListView([FromRoute] long id, [FromBody] DataListView inObj)
public async Task<IActionResult> PutDataListSavedFilter([FromRoute] long id, [FromBody] DataListSavedFilter inObj)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
@@ -112,7 +112,7 @@ namespace AyaNova.Api.Controllers
return BadRequest(new ApiErrorResponse(ModelState));
//Instantiate the business object handler
DataListViewBiz biz = DataListViewBiz.GetBiz(ct, HttpContext);
DataListSavedFilterBiz biz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
var o = await biz.GetAsync(id, false);
if (o == null)
@@ -138,19 +138,19 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Create DataListView
/// Create DataListSavedFilter
/// </summary>
/// <param name="inObj"></param>
/// <param name="apiVersion">From route path</param>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> PostDataListView([FromBody] DataListView inObj, ApiVersion apiVersion)
public async Task<IActionResult> PostDataListSavedFilter([FromBody] DataListSavedFilter inObj, ApiVersion apiVersion)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
//Instantiate the business object handler
DataListViewBiz biz = DataListViewBiz.GetBiz(ct, HttpContext);
DataListSavedFilterBiz biz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
//check roles
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
@@ -160,16 +160,16 @@ namespace AyaNova.Api.Controllers
return BadRequest(new ApiErrorResponse(ModelState));
//Create and validate
DataListView o = await biz.CreateAsync(inObj);
DataListSavedFilter o = await biz.CreateAsync(inObj);
if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors));
else
return CreatedAtAction(nameof(DataListViewController.GetDataListView), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
return CreatedAtAction(nameof(DataListSavedFilterController.GetDataListSavedFilter), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
}
/// <summary>
/// Duplicate DataListView
/// Duplicate DataListSavedFilter
/// </summary>
/// <param name="id">Create a duplicate of this items id</param>
/// <param name="apiVersion">From route path</param>
@@ -181,7 +181,7 @@ namespace AyaNova.Api.Controllers
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
//Instantiate the business object handler
DataListViewBiz biz = DataListViewBiz.GetBiz(ct, HttpContext);
DataListSavedFilterBiz biz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
//If a user has change roles
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
@@ -195,21 +195,21 @@ namespace AyaNova.Api.Controllers
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
//Create and validate
DataListView o = await biz.DuplicateAsync(oSrc);
DataListSavedFilter o = await biz.DuplicateAsync(oSrc);
if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors));
else
return CreatedAtAction(nameof(DataListViewController.GetDataListView), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
return CreatedAtAction(nameof(DataListSavedFilterController.GetDataListSavedFilter), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
}
/// <summary>
/// Delete DataListView
/// Delete DataListSavedFilter
/// </summary>
/// <param name="id"></param>
/// <returns>Ok</returns>
[HttpDelete("{id}")]
public async Task<IActionResult> DeleteDataListView([FromRoute] long id)
public async Task<IActionResult> DeleteDataListSavedFilter([FromRoute] long id)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
@@ -218,7 +218,7 @@ namespace AyaNova.Api.Controllers
return BadRequest(new ApiErrorResponse(ModelState));
//Instantiate the business object handler
DataListViewBiz biz = DataListViewBiz.GetBiz(ct, HttpContext);
DataListSavedFilterBiz biz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
var o = await biz.GetAsync(id, false);
if (o == null)
@@ -237,16 +237,16 @@ namespace AyaNova.Api.Controllers
/// Get default ListView for DataList
/// </summary>
/// <param name="dataListKey">Key of an existing DataList</param>
/// <returns>A single DataListView</returns>
/// <returns>A single DataListSavedFilter</returns>
[HttpGet("default/{dataListKey}")]
public ActionResult GetDefaultDataListView([FromRoute] string dataListKey)
public ActionResult GetDefaultDataListSavedFilter([FromRoute] string dataListKey)
{
throw new System.NotSupportedException("NEEDS REPLACEMENT WITH NEW SYSTEM");
// if (!serverState.IsOpen)
// return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
// //Instantiate the business object handler
// DataListViewBiz biz = DataListViewBiz.GetBiz(ct, HttpContext);
// DataListSavedFilterBiz biz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
// if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
// return StatusCode(403, new ApiNotAuthorizedResponse());

View File

@@ -88,7 +88,7 @@ namespace AyaNova.DataList
//Developers little helper
if (o == null)
{
throw new System.ArgumentNullException($"DEV ERROR in AyaDataList::GenerateListColumnsJSONFromListView - field {s} specified in ListView was NOT found in ObjectFields list");
throw new System.ArgumentNullException($"DEV ERROR in AyaDataList::GenerateReturnListColumns - field {s} specified in columns was NOT found in ObjectFields list");
}
#endif

View File

@@ -12,8 +12,8 @@ namespace AyaNova.DataList
internal static class DataListSqlSelectBuilder
{
//Build the SELECT portion of a list query based on the ListView fields
internal static SqlSelectBuilderResult Build(List<AyaDataListFieldDefinition> objectFieldsList, List<string> listViewFieldList)
//Build the SELECT portion of a list query based on the columns
internal static SqlSelectBuilderResult Build(List<AyaDataListFieldDefinition> objectFieldsList, List<string> columns)
{
StringBuilder sb = new StringBuilder();
sb.Append("SELECT ");
@@ -26,14 +26,14 @@ namespace AyaNova.DataList
int nOrdinal = 0;
var firstColumnAdded = false;
foreach (string ColumnName in listViewFieldList)
foreach (string ColumnName in columns)
{
AyaDataListFieldDefinition o = objectFieldsList.FirstOrDefault(z => z.FieldKey == ColumnName);
#if (DEBUG)
//Developers little helper
if (o == null)
{
throw new System.ArgumentNullException($"## DEV ERROR in DataListSqlSelectBuilder.cs:Build() field {ColumnName} specified in datalist view was NOT found in the data list's ObjectFields list, a defined fieldkey name differs from the ListView field key name");
throw new System.ArgumentNullException($"## DEV ERROR in DataListSqlSelectBuilder.cs:Build() field {ColumnName} specified in columns was NOT found in the data list's ObjectFields list, a defined fieldkey name differs from the columns key name");
}
#endif
if (o != null)

View File

@@ -45,7 +45,7 @@ namespace AyaNova.Biz
[CoreBizObject]
LoanUnit = 16,
FileAttachment = 17,
DataListView = 18,
DataListSavedFilter = 18,
FormCustom = 19,
[CoreBizObject]
Part = 20,

View File

@@ -26,8 +26,8 @@ namespace AyaNova.Biz
return true;
case AyaType.FileAttachment:
return await ct.FileAttachment.AnyAsync(z => z.Id == id);
case AyaType.DataListView:
return await ct.DataListView.AnyAsync(z => z.Id == id);
case AyaType.DataListSavedFilter:
return await ct.DataListSavedFilter.AnyAsync(z => z.Id == id);
case AyaType.FormCustom:
return await ct.FormCustom.AnyAsync(z => z.Id == id);
case AyaType.User:

View File

@@ -24,8 +24,8 @@ namespace AyaNova.Biz
return new TrialBiz(ct, userId, roles);
case AyaType.Translation:
return new TranslationBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
case AyaType.DataListView:
return new DataListViewBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
case AyaType.DataListSavedFilter:
return new DataListSavedFilterBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
case AyaType.FormCustom:
return new FormCustomBiz(ct, userId, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, roles);
case AyaType.Widget:

View File

@@ -694,7 +694,7 @@ namespace AyaNova.Biz
////////////////////////////////////////////////////////////
//DATALISTFILTER
//
roles.Add(AyaType.DataListView, new BizRoleSet()
roles.Add(AyaType.DataListSavedFilter, new BizRoleSet()
{
Change = AuthorizationRoles.BizAdminFull,
ReadFullRecord = AuthorizationRoles.All

View File

@@ -13,24 +13,24 @@ namespace AyaNova.Biz
{
internal class DataListViewBiz : BizObject
internal class DataListSavedFilterBiz : BizObject
{
internal DataListViewBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
internal DataListSavedFilterBiz(AyContext dbcontext, long currentUserId, long userTranslationId, AuthorizationRoles UserRoles)
{
ct = dbcontext;
UserId = currentUserId;
UserTranslationId = userTranslationId;
CurrentUserRoles = UserRoles;
BizType = AyaType.DataListView;
BizType = AyaType.DataListSavedFilter;
}
internal static DataListViewBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext = null)
internal static DataListSavedFilterBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext = null)
{
if (httpContext != null)
return new DataListViewBiz(ct, UserIdFromContext.Id(httpContext.Items), UserTranslationIdFromContext.Id(httpContext.Items), UserRolesFromContext.Roles(httpContext.Items));
return new DataListSavedFilterBiz(ct, UserIdFromContext.Id(httpContext.Items), UserTranslationIdFromContext.Id(httpContext.Items), UserRolesFromContext.Roles(httpContext.Items));
else
return new DataListViewBiz(ct, 1, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, AuthorizationRoles.BizAdminFull);
return new DataListSavedFilterBiz(ct, 1, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, AuthorizationRoles.BizAdminFull);
}
@@ -39,14 +39,14 @@ namespace AyaNova.Biz
//EXISTS
internal async Task<bool> ExistsAsync(long id)
{
return await ct.DataListView.AnyAsync(z => z.Id == id);
return await ct.DataListSavedFilter.AnyAsync(z => z.Id == id);
}
////////////////////////////////////////////////////////////////////////////////////////////////
//CREATE
internal async Task<DataListView> CreateAsync(DataListView inObj)
internal async Task<DataListSavedFilter> CreateAsync(DataListSavedFilter inObj)
{
await ValidateAsync(inObj, true);
if (HasErrors)
@@ -54,11 +54,11 @@ namespace AyaNova.Biz
else
{
//do stuff with datafilter
DataListView outObj = inObj;
DataListSavedFilter outObj = inObj;
outObj.UserId = UserId;
await ct.DataListView.AddAsync(outObj);
await ct.DataListSavedFilter.AddAsync(outObj);
await ct.SaveChangesAsync();
//Handle child and associated items:
@@ -80,10 +80,10 @@ namespace AyaNova.Biz
//DUPLICATE
//
internal async Task<DataListView> DuplicateAsync(DataListView dbObject)
internal async Task<DataListSavedFilter> DuplicateAsync(DataListSavedFilter dbObject)
{
DataListView outObj = new DataListView();
DataListSavedFilter outObj = new DataListSavedFilter();
CopyObject.Copy(dbObject, outObj);
//generate unique name
string newUniqueName = string.Empty;
@@ -92,7 +92,7 @@ namespace AyaNova.Biz
do
{
newUniqueName = Util.StringUtil.UniqueNameBuilder(dbObject.Name, l++, 255);
NotUnique = await ct.DataListView.AnyAsync(z => z.Name == newUniqueName);
NotUnique = await ct.DataListSavedFilter.AnyAsync(z => z.Name == newUniqueName);
} while (NotUnique);
outObj.Name = newUniqueName;
outObj.Id = 0;
@@ -100,7 +100,7 @@ namespace AyaNova.Biz
await ct.DataListView.AddAsync(outObj);
await ct.DataListSavedFilter.AddAsync(outObj);
await ct.SaveChangesAsync();
//Handle child and associated items:
@@ -114,10 +114,10 @@ namespace AyaNova.Biz
/// GET
//Get one
internal async Task<DataListView> GetAsync(long fetchId, bool logTheGetEvent = true)
internal async Task<DataListSavedFilter> GetAsync(long fetchId, bool logTheGetEvent = true)
{
//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.DataListView.SingleOrDefaultAsync(z => z.Id == fetchId && (z.Public == true || z.UserId == UserId));
var ret = await ct.DataListSavedFilter.SingleOrDefaultAsync(z => z.Id == fetchId && (z.Public == true || z.UserId == UserId));
if (logTheGetEvent && ret != null)
{
//Log
@@ -135,7 +135,7 @@ namespace AyaNova.Biz
List<NameIdItem> items = new List<NameIdItem>();
if (!string.IsNullOrWhiteSpace(listKey))
{
items = await ct.DataListView
items = await ct.DataListSavedFilter
.AsNoTracking()
.Where(z => z.ListKey == listKey && (z.Public == true || z.UserId == UserId))
.OrderBy(z => z.Name)
@@ -157,7 +157,7 @@ namespace AyaNova.Biz
//
//put
internal async Task<bool> PutAsync(DataListView dbObject, DataListView inObj)
internal async Task<bool> PutAsync(DataListSavedFilter dbObject, DataListSavedFilter inObj)
{
//preserve the owner ID if none was specified
if (inObj.UserId == 0)
@@ -186,7 +186,7 @@ namespace AyaNova.Biz
////////////////////////////////////////////////////////////////////////////////////////////////
//DELETE
//
internal async Task<bool> DeleteAsync(DataListView dbObject)
internal async Task<bool> DeleteAsync(DataListSavedFilter dbObject)
{
//Determine if the object can be deleted, do the deletion tentatively
//Probably also in here deal with tags and associated search text etc
@@ -196,7 +196,7 @@ namespace AyaNova.Biz
if (HasErrors)
return false;
ct.DataListView.Remove(dbObject);
ct.DataListSavedFilter.Remove(dbObject);
await ct.SaveChangesAsync();
//Delete sibling objects
@@ -217,7 +217,7 @@ namespace AyaNova.Biz
//
//Can save or update?
private async Task ValidateAsync(DataListView inObj, bool isNew)
private async Task ValidateAsync(DataListSavedFilter inObj, bool isNew)
{
//UserId required
@@ -238,7 +238,7 @@ namespace AyaNova.Biz
if (!PropertyHasErrors("Name"))
{
//Use Any command is efficient way to check existance, it doesn't return the record, just a true or false
if (await ct.DataListView.AnyAsync(z => z.Name == inObj.Name && z.Id != inObj.Id))
if (await ct.DataListSavedFilter.AnyAsync(z => z.Name == inObj.Name && z.Id != inObj.Id))
{
AddError(ApiErrorCode.VALIDATION_NOT_UNIQUE, "Name");
}

View File

@@ -22,7 +22,7 @@ namespace AyaNova.Models
public virtual DbSet<OpsJobLog> OpsJobLog { get; set; }
public virtual DbSet<Translation> Translation { get; set; }
public virtual DbSet<TranslationItem> TranslationItem { get; set; }
public virtual DbSet<DataListView> DataListView { get; set; }
public virtual DbSet<DataListSavedFilter> DataListSavedFilter { get; set; }
public virtual DbSet<Tag> Tag { get; set; }
public virtual DbSet<FormCustom> FormCustom { get; set; }
public virtual DbSet<PickListTemplate> PickListTemplate { get; set; }

View File

@@ -3,8 +3,9 @@ using System.ComponentModel.DataAnnotations;
namespace AyaNova.Models
{
//TODO: Need to split this into a personal column order set and a personal filter collection
public class DataListView
//this is a hiearchical object so saving as a JSON fragment still best option
public class DataListSavedFilter
{
public long Id { get; set; }
public uint Concurrency { get; set; }
@@ -17,7 +18,8 @@ namespace AyaNova.Models
public bool Public { get; set; }
[Required, MaxLength(255)]
public string ListKey { get; set; }//max 255 characters ascii set
public string ListView { get; set; }//JSON ListView object
public string Filter { get; set; }//JSON filter object representing DataListFilterOption
//filter:[{column:"PartPartNumber",any:true/false,items:[{op: "=",value: "400735"}]}]
}

View File

@@ -1753,7 +1753,7 @@
"ReviewCustom15": "Angepasstes Feld 15",
"ReviewCustom16": "Angepasstes Feld 16",
"UserSettings": "Benutzereinstellungen",
"DataListView": "Datenlistenansicht",
"DataListSavedFilter": "Listenfilter",
"Include": "Umfassen",
"Sort": "Sortieren",
"Filter": "Filter",

View File

@@ -1753,7 +1753,7 @@
"ReviewCustom15": "Custom15",
"ReviewCustom16": "Custom16",
"UserSettings": "User settings",
"DataListView": "List view",
"DataListSavedFilter": "List filter",
"Include": "Include",
"Sort": "Sort",
"Filter": "Filter",

View File

@@ -1753,7 +1753,7 @@
"ReviewCustom15": "Campo personalizado 15",
"ReviewCustom16": "Campo personalizado 16",
"UserSettings": "Configuración de usuario",
"DataListView": "Vista de lista de datos",
"DataListSavedFilter": "Filtro de lista",
"Include": "Incluir",
"Sort": "Ordenar",
"Filter": "Filtro",

View File

@@ -1753,7 +1753,7 @@
"ReviewCustom15": "Champ personnalisé 15",
"ReviewCustom16": "Champ personnalisé 16",
"UserSettings": "Paramètres utilisateur",
"DataListView": "Affichage de la liste des données",
"DataListSavedFilter": "Filtre de liste",
"Include": "Inclure",
"Sort": "Trier",
"Filter": "Filtre",

View File

@@ -346,7 +346,7 @@ BEGIN
when 15 then aytable = 'aheadoffice';
when 16 then aytable = 'aloanunit';
when 17 then aytable = 'afileattachment'; aynamecolumn ='displayfilename';
when 18 then aytable = 'adatalistview';
when 18 then aytable = 'adatalistsavedfilter';
when 19 then aytable = 'aformcustom'; aynamecolumn = 'formkey';
when 20 then aytable = 'apart'; aynamecolumn ='partnumber';
when 21 then aytable = 'apm'; aynamecolumn ='serial';
@@ -509,8 +509,8 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
{
LogUpdateMessage(log);
await ExecQueryAsync("CREATE TABLE adatalistview (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid BIGINT NOT NULL, name TEXT NOT NULL UNIQUE, public BOOL NOT NULL," +
"listkey VARCHAR(255) NOT NULL, listview TEXT)");
await ExecQueryAsync("CREATE TABLE adatalistsavedfilter (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid BIGINT NOT NULL, name TEXT NOT NULL UNIQUE, public BOOL NOT NULL," +
"listkey VARCHAR(255) NOT NULL, filter TEXT)");
await SetSchemaLevelAsync(++currentSchema);
}

View File

@@ -166,34 +166,35 @@ namespace AyaNova.Util
await FormCustomBiz.GetBiz(ct).CreateAsync(fc);
}
//Create a couple of DataListView's for development and testing
{
var dlv = new DataListView()
{
Name = "Name starts with generic",
UserId = 1,
ListKey = "TestWidgetDataList",
Public = true,
ListView = @"[{""fld"": ""widgetname"",""filter"": {""any"":false,""items"": [{""op"": ""%-"",""value"": ""Generic""}]}}]"
};
//TODO: Add this back in or...fuck it?
// //Create a couple of DataListView's for development and testing
// {
// var dlv = new DataListSavedFilter()
// {
// Name = "Name starts with generic",
// UserId = 1,
// ListKey = "TestWidgetDataList",
// Public = true,
// ListView = @"[{""fld"": ""widgetname"",""filter"": {""any"":false,""items"": [{""op"": ""%-"",""value"": ""Generic""}]}}]"
// };
//Create and save to db
using (var ct = ServiceProviderProvider.DBContext)
await DataListViewBiz.GetBiz(ct).CreateAsync(dlv);
// //Create and save to db
// using (var ct = ServiceProviderProvider.DBContext)
// await DataListSavedFilterBiz.GetBiz(ct).CreateAsync(dlv);
dlv = new DataListView()
{
Name = "Awesome (lots of fields)",
UserId = 1,
ListKey = "TestWidgetDataList",
Public = true,
ListView = @"[{""fld"": ""widgetname"",""filter"": {""any"":false,""items"": [{""op"": ""%-"",""value"": ""Awesome""}]}},{""fld"":""widgetserial""},{""fld"":""widgetdollaramount""},{""fld"":""widgetusertype""},{""fld"":""widgetstartdate""},{""fld"":""widgetactive""},{""fld"":""username""},{""fld"":""widgettags""},{""fld"":""widgetcustom1""},{""fld"":""widgetcustom2""}]"
};
// dlv = new DataListSavedFilter()
// {
// Name = "Awesome (lots of fields)",
// UserId = 1,
// ListKey = "TestWidgetDataList",
// Public = true,
// ListView = @"[{""fld"": ""widgetname"",""filter"": {""any"":false,""items"": [{""op"": ""%-"",""value"": ""Awesome""}]}},{""fld"":""widgetserial""},{""fld"":""widgetdollaramount""},{""fld"":""widgetusertype""},{""fld"":""widgetstartdate""},{""fld"":""widgetactive""},{""fld"":""username""},{""fld"":""widgettags""},{""fld"":""widgetcustom1""},{""fld"":""widgetcustom2""}]"
// };
//Create and save to db
using (var ct = ServiceProviderProvider.DBContext)
await DataListViewBiz.GetBiz(ct).CreateAsync(dlv);
}
// //Create and save to db
// using (var ct = ServiceProviderProvider.DBContext)
// await DataListSavedFilterBiz.GetBiz(ct).CreateAsync(dlv);
// }
//Seed special test data for integration testing
@@ -1608,7 +1609,7 @@ namespace AyaNova.Util
//Add inventory into multiple warehouses for testing
for (int y = 0; y < 3; y++)
{
int WarehouseNumber=y+1;
int WarehouseNumber = y + 1;
//add opening inventory
partInventory = await PartInventoryBizNess.CreateAsync(new dtPartInventory() { PartId = NewObject.Id, PartWarehouseId = WarehouseNumber, Quantity = OpeningInventoryLevel, Description = "New part opening inventory" });