This commit is contained in:
@@ -25,16 +25,15 @@ namespace AyaNova.Biz
|
||||
BizType = AyaType.DataListView;
|
||||
}
|
||||
|
||||
internal static DataListViewBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext)
|
||||
internal static DataListViewBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext = null)
|
||||
{
|
||||
return new DataListViewBiz(ct, UserIdFromContext.Id(httpContext.Items), UserLocaleIdFromContext.Id(httpContext.Items), UserRolesFromContext.Roles(httpContext.Items));
|
||||
if (httpContext != null)
|
||||
return new DataListViewBiz(ct, UserIdFromContext.Id(httpContext.Items), UserLocaleIdFromContext.Id(httpContext.Items), UserRolesFromContext.Roles(httpContext.Items));
|
||||
else
|
||||
return new DataListViewBiz(ct, 1, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, AuthorizationRoles.BizAdminFull);
|
||||
}
|
||||
|
||||
// //Version for internal use
|
||||
// internal static DataListFilterBiz GetBizInternal(AyContext ct)
|
||||
// {
|
||||
// return new DataListFilterBiz(ct, 1, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, AuthorizationRoles.BizAdminFull);
|
||||
// }
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//EXISTS
|
||||
@@ -260,7 +259,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "ListView", $"ListView array item {i}, fld property value \"{fld}\" is not a valid value for ListKey specified");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
//This is the old filter validation code but at this point only going to validate that the fields are present and valid as the bare minimum
|
||||
|
||||
@@ -136,6 +136,47 @@ namespace AyaNova.Util
|
||||
}
|
||||
}
|
||||
|
||||
//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"": {""items"": [{""op"": ""%-"",""value"": ""Generic""}]}}]"
|
||||
|
||||
};
|
||||
|
||||
//Create and save to db
|
||||
using (var cct = ServiceProviderProvider.DBContext)
|
||||
{
|
||||
await DataListViewBiz.GetBiz(cct).CreateAsync(dlv);
|
||||
}
|
||||
|
||||
dlv = new DataListView()
|
||||
{
|
||||
Name = "Name starts with awesome",
|
||||
UserId = 1,
|
||||
ListKey = "TestWidgetDataList",
|
||||
Public = true,
|
||||
ListView = @"[{""fld"": ""widgetname"",""filter"": {""items"": [{""op"": ""%-"",""value"": ""Awesome""}]}}]"
|
||||
|
||||
};
|
||||
|
||||
//Create and save to db
|
||||
using (var cct = ServiceProviderProvider.DBContext)
|
||||
{
|
||||
await DataListViewBiz.GetBiz(cct).CreateAsync(dlv);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Seed special test data for integration testing
|
||||
//log.LogInformation("Seeding known users");
|
||||
await SeedKnownUsersAsync(log);
|
||||
|
||||
Reference in New Issue
Block a user