This commit is contained in:
@@ -60,10 +60,10 @@ export default {
|
|||||||
ltKeysRequired: [
|
ltKeysRequired: [
|
||||||
"Widget",
|
"Widget",
|
||||||
"WidgetList",
|
"WidgetList",
|
||||||
"WidgetName",
|
"CommonName",
|
||||||
"WidgetSerial",
|
"WidgetSerial",
|
||||||
"WidgetDollarAmount",
|
"WidgetDollarAmount",
|
||||||
"WidgetActive",
|
"CommonActive",
|
||||||
"WidgetRoles",
|
"WidgetRoles",
|
||||||
"WidgetStartDate",
|
"WidgetStartDate",
|
||||||
"WidgetEndDate",
|
"WidgetEndDate",
|
||||||
@@ -88,12 +88,12 @@ export default {
|
|||||||
rowsPerPageText: "blah per blah",
|
rowsPerPageText: "blah per blah",
|
||||||
headers: [
|
headers: [
|
||||||
{
|
{
|
||||||
text: this.lt("Widget"),
|
text: this.lt("CommonName"),
|
||||||
value: "name"
|
value: "name"
|
||||||
},
|
},
|
||||||
{ text: this.lt("WidgetSerial"), value: "serial" },
|
{ text: this.lt("WidgetSerial"), value: "serial" },
|
||||||
{ text: this.lt("WidgetDollarAmount"), value: "dollarAmount" },
|
{ text: this.lt("WidgetDollarAmount"), value: "dollarAmount" },
|
||||||
{ text: this.lt("WidgetActive"), value: "active" },
|
{ text: this.lt("CommonActive"), value: "active" },
|
||||||
{ text: this.lt("WidgetRoles"), value: "roles" },
|
{ text: this.lt("WidgetRoles"), value: "roles" },
|
||||||
{ text: this.lt("WidgetStartDate"), value: "startDate" },
|
{ text: this.lt("WidgetStartDate"), value: "startDate" },
|
||||||
{ text: this.lt("WidgetEndDate"), value: "endDate" }
|
{ text: this.lt("WidgetEndDate"), value: "endDate" }
|
||||||
|
|||||||
@@ -6,10 +6,6 @@ Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNTQ0NTU5NzAwIiwiZXhwIjoi
|
|||||||
## IMMEDIATE ITEMS
|
## IMMEDIATE ITEMS
|
||||||
|
|
||||||
|
|
||||||
WIDGET LIST
|
|
||||||
- ORDER BY???
|
|
||||||
- Create test for it and ensure it's working and coded fully
|
|
||||||
|
|
||||||
User and any other getmany LISTS - replicate from widget list when above is done
|
User and any other getmany LISTS - replicate from widget list when above is done
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -143,6 +143,26 @@ namespace AyaNova.Biz
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static FilterOptions FilterOptions(long localizeToLocaleId = 0)
|
||||||
|
{
|
||||||
|
//NOTE: All column names are lowercase to conform with Postgres AyaNova DB which uses lowercase for all identifiers
|
||||||
|
//Also all list keys are lower case for consistency
|
||||||
|
FilterOptions f = new FilterOptions("user");
|
||||||
|
f.
|
||||||
|
AddField("name", "CommonName", AyDataType.Text).
|
||||||
|
AddField("active", "CommonActive", AyDataType.Bool).
|
||||||
|
AddField("tags", "Tags", AyDataType.Tags).
|
||||||
|
AddField("EmployeeNumber", "UserEmployeeNumber", AyDataType.Text).
|
||||||
|
AddField("notes", "WidgetNotes", AyDataType.Text);
|
||||||
|
|
||||||
|
if (localizeToLocaleId != 0)
|
||||||
|
f.Localize(localizeToLocaleId);
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//get many (paged)
|
//get many (paged)
|
||||||
internal async Task<ApiPagedResponse<System.Object>> GetManyAsync(IUrlHelper Url, string routeName, PagingOptions pagingOptions)
|
internal async Task<ApiPagedResponse<System.Object>> GetManyAsync(IUrlHelper Url, string routeName, PagingOptions pagingOptions)
|
||||||
{
|
{
|
||||||
@@ -150,23 +170,62 @@ namespace AyaNova.Biz
|
|||||||
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.User
|
// var items = await ct.User
|
||||||
.AsNoTracking()
|
// .AsNoTracking()
|
||||||
.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.User.CountAsync();
|
||||||
|
// var pageLinks = new PaginationLinkBuilder(Url, routeName, null, pagingOptions, totalRecordCount).PagingLinksObject();
|
||||||
|
|
||||||
|
//BUILD THE QUERY
|
||||||
|
//base query
|
||||||
|
var q = "SELECT *, xmin FROM AUSER ";
|
||||||
|
|
||||||
|
//GET THE FILTER / SORT
|
||||||
|
if (pagingOptions.DataFilterId > 0)
|
||||||
|
{
|
||||||
|
var TheFilter = await ct.DataFilter.FirstOrDefaultAsync(x => x.Id == pagingOptions.DataFilterId);
|
||||||
|
|
||||||
|
//BUILD WHERE AND APPEND IT
|
||||||
|
q = q + FilterSqlCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, UserBiz.FilterOptions(), UserId);
|
||||||
|
|
||||||
|
//BUILD ORDER BY AND APPEND IT
|
||||||
|
q = q + FilterSqlOrderByBuilder.DataFilterToSQLOrderBy(TheFilter);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//GET DEFAULT ORDER BY
|
||||||
|
q = q + FilterSqlOrderByBuilder.DefaultOrderBy();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#pragma warning disable EF1000
|
||||||
|
|
||||||
|
var items = await ct.User
|
||||||
|
.AsNoTracking()
|
||||||
|
.FromSql(q)
|
||||||
|
.Skip(pagingOptions.Offset.Value)
|
||||||
|
.Take(pagingOptions.Limit.Value)
|
||||||
|
.ToArrayAsync();
|
||||||
|
|
||||||
|
|
||||||
|
var totalRecordCount = await ct.User
|
||||||
|
.AsNoTracking()
|
||||||
|
.FromSql(q)
|
||||||
|
.CountAsync();
|
||||||
|
#pragma warning restore EF1000
|
||||||
|
|
||||||
var totalRecordCount = await ct.User.CountAsync();
|
|
||||||
var pageLinks = new PaginationLinkBuilder(Url, routeName, null, pagingOptions, totalRecordCount).PagingLinksObject();
|
|
||||||
|
|
||||||
var cleanedItems = new System.Object[] { };
|
var cleanedItems = new System.Object[] { };
|
||||||
foreach (User item in items)
|
foreach (User item in items)
|
||||||
{
|
{
|
||||||
cleanedItems.Append(CleanUserForReturn(item));
|
cleanedItems.Append(CleanUserForReturn(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var pageLinks = new PaginationLinkBuilder(Url, routeName, null, pagingOptions, totalRecordCount).PagingLinksObject();
|
||||||
ApiPagedResponse<System.Object> pr = new ApiPagedResponse<System.Object>(cleanedItems, pageLinks);
|
ApiPagedResponse<System.Object> pr = new ApiPagedResponse<System.Object>(cleanedItems, pageLinks);
|
||||||
return pr;
|
return pr;
|
||||||
}
|
}
|
||||||
@@ -735,9 +794,9 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
//Copy values
|
//Copy values
|
||||||
User i = new User();
|
User i = new User();
|
||||||
|
|
||||||
//default owner id is manager account in RAVEN
|
//default owner id is manager account in RAVEN
|
||||||
i.OwnerId=1;
|
i.OwnerId = 1;
|
||||||
|
|
||||||
i.Name = j["FirstName"].Value<string>() + " " + j["LastName"].Value<string>();
|
i.Name = j["FirstName"].Value<string>() + " " + j["LastName"].Value<string>();
|
||||||
var Temp = j["UserType"].Value<int>();
|
var Temp = j["UserType"].Value<int>();
|
||||||
@@ -786,11 +845,11 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
//User options
|
//User options
|
||||||
i.UserOptions=new UserOptions(i.OwnerId);
|
i.UserOptions = new UserOptions(i.OwnerId);
|
||||||
|
|
||||||
//TimeZone Offset
|
//TimeZone Offset
|
||||||
//Note: can be null value if not set so need to check for that here specially
|
//Note: can be null value if not set so need to check for that here specially
|
||||||
var tzo = j["TimeZoneOffset"].Value<decimal?>() ?? 0;
|
var tzo = j["TimeZoneOffset"].Value<decimal?>() ?? 0;
|
||||||
i.UserOptions.TimeZoneOffset = tzo;
|
i.UserOptions.TimeZoneOffset = tzo;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace AyaNova.Biz
|
|||||||
AddField("serial", "WidgetSerial", AyDataType.Integer).
|
AddField("serial", "WidgetSerial", AyDataType.Integer).
|
||||||
AddField("notes", "WidgetNotes", AyDataType.Text).
|
AddField("notes", "WidgetNotes", AyDataType.Text).
|
||||||
AddField("dollaramount", "WidgetDollarAmount", AyDataType.Decimal).
|
AddField("dollaramount", "WidgetDollarAmount", AyDataType.Decimal).
|
||||||
AddField("active", "WidgetActive", AyDataType.Bool).
|
AddField("active", "CommonActive", AyDataType.Bool).
|
||||||
AddField("startdate", "WidgetStartDate", AyDataType.Date).
|
AddField("startdate", "WidgetStartDate", AyDataType.Date).
|
||||||
AddField("count", "WidgetCount", AyDataType.Integer).
|
AddField("count", "WidgetCount", AyDataType.Integer).
|
||||||
AddField("tags", "Tags", AyDataType.Tags).
|
AddField("tags", "Tags", AyDataType.Tags).
|
||||||
@@ -168,14 +168,7 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
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.Widget
|
|
||||||
// .OrderBy(m => m.Id)
|
|
||||||
// .Skip(pagingOptions.Offset.Value)
|
|
||||||
// .Take(pagingOptions.Limit.Value)
|
|
||||||
// .ToArrayAsync();
|
|
||||||
|
|
||||||
|
|
||||||
//BUILD THE QUERY
|
//BUILD THE QUERY
|
||||||
//base query
|
//base query
|
||||||
var q = "SELECT *, xmin FROM AWIDGET ";
|
var q = "SELECT *, xmin FROM AWIDGET ";
|
||||||
@@ -189,16 +182,7 @@ namespace AyaNova.Biz
|
|||||||
q = q + FilterSqlCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, WidgetBiz.FilterOptions(), UserId);
|
q = q + FilterSqlCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, WidgetBiz.FilterOptions(), UserId);
|
||||||
|
|
||||||
//BUILD ORDER BY AND APPEND IT
|
//BUILD ORDER BY AND APPEND IT
|
||||||
q = q + FilterSqlOrderByBuilder.DataFilterToSQLOrderBy(TheFilter);
|
q = q + FilterSqlOrderByBuilder.DataFilterToSQLOrderBy(TheFilter);
|
||||||
|
|
||||||
//TESTING:
|
|
||||||
// //TODO: remove this from production build
|
|
||||||
// //LOG THE CRIT AND QUERY
|
|
||||||
// ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger("WidgetBiz::GetManyAsync");
|
|
||||||
// log.LogInformation("Filter criteria:");
|
|
||||||
// log.LogInformation(TheFilter.Filter);
|
|
||||||
// log.LogInformation("Generated SQL:");
|
|
||||||
// log.LogInformation(q);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -207,10 +191,6 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#pragma warning disable EF1000
|
#pragma warning disable EF1000
|
||||||
|
|
||||||
var items = await ct.Widget
|
var items = await ct.Widget
|
||||||
|
|||||||
@@ -1436,7 +1436,6 @@
|
|||||||
"WidgetSerial":"Seriennummer",
|
"WidgetSerial":"Seriennummer",
|
||||||
"WidgetDollarAmount":"Betrag",
|
"WidgetDollarAmount":"Betrag",
|
||||||
"WidgetCount":"Anzahl",
|
"WidgetCount":"Anzahl",
|
||||||
"WidgetActive":"Aktiv",
|
|
||||||
"WidgetRoles":"Rollen",
|
"WidgetRoles":"Rollen",
|
||||||
"WidgetStartDate":"Startdatum",
|
"WidgetStartDate":"Startdatum",
|
||||||
"WidgetEndDate":"Enddatum",
|
"WidgetEndDate":"Enddatum",
|
||||||
|
|||||||
@@ -1435,7 +1435,6 @@
|
|||||||
"WidgetSerial":"Serial #",
|
"WidgetSerial":"Serial #",
|
||||||
"WidgetDollarAmount":"Price",
|
"WidgetDollarAmount":"Price",
|
||||||
"WidgetCount":"Count",
|
"WidgetCount":"Count",
|
||||||
"WidgetActive":"Active",
|
|
||||||
"WidgetRoles":"Roles",
|
"WidgetRoles":"Roles",
|
||||||
"WidgetStartDate":"Start",
|
"WidgetStartDate":"Start",
|
||||||
"WidgetEndDate":"End",
|
"WidgetEndDate":"End",
|
||||||
|
|||||||
@@ -1436,7 +1436,6 @@
|
|||||||
"WidgetSerial":"Número de serie",
|
"WidgetSerial":"Número de serie",
|
||||||
"WidgetDollarAmount":"Importe",
|
"WidgetDollarAmount":"Importe",
|
||||||
"WidgetCount":"Recuento",
|
"WidgetCount":"Recuento",
|
||||||
"WidgetActive":"Activa",
|
|
||||||
"WidgetRoles":"Funciones",
|
"WidgetRoles":"Funciones",
|
||||||
"WidgetStartDate":"Fecha de comienzo",
|
"WidgetStartDate":"Fecha de comienzo",
|
||||||
"WidgetEndDate":"Fecha de fin",
|
"WidgetEndDate":"Fecha de fin",
|
||||||
|
|||||||
@@ -1435,7 +1435,6 @@
|
|||||||
"WidgetSerial":"Numéro de série",
|
"WidgetSerial":"Numéro de série",
|
||||||
"WidgetDollarAmount":"Montant",
|
"WidgetDollarAmount":"Montant",
|
||||||
"WidgetCount":"Nombre",
|
"WidgetCount":"Nombre",
|
||||||
"WidgetActive":"Actif",
|
|
||||||
"WidgetRoles":"Rôles",
|
"WidgetRoles":"Rôles",
|
||||||
"WidgetStartDate":"Date de début",
|
"WidgetStartDate":"Date de début",
|
||||||
"WidgetEndDate":"Date de fin",
|
"WidgetEndDate":"Date de fin",
|
||||||
|
|||||||
Reference in New Issue
Block a user