This commit is contained in:
2020-01-21 00:47:26 +00:00
parent efa2acc930
commit 426f0c9c9c
3 changed files with 112 additions and 0 deletions

View File

@@ -5,6 +5,29 @@ eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNTcxODU5OTU0IiwiZXhwIjoiMTU3MjQ
## IMMEDIATE ITEMS
REFACTOR OBJECT FIELDS AND DATA LISTS
AyaObjectFieldDefinitions is doing double duty for two completely different uses right now and needs to be split up
split ayaobjectfielddefinitions into two entities:
LISTS:
used for data list filter, sort template builder
used for building queries
etc
- AyaDataList abstract class containing
- AyaObjectFieldDefinitions (RENAMED to AyaDataListFieldDefinitions)
- Extracted from ayaobjectifielddefinitions
- SQL from query
- AyaDataList key (used by many things including the AyaDataListDisplayTemplates)
- LIkely rights as well maybe a down the road issue to be added later?
FORM FIELDS:
Used for form customization
available fields to select for show etc
Extracted from ayaobjectfielddefinitions
Essentially the same thing as it is now, so maybe just rename the existing one
MAKE DATALIST ROUTE FOR FETCHING LISTS BY KEY
- REMOVE LISTS FROM INDIVIDUAL OBJECT ROUTES AS MUCH AS POSSIBLE
- Accepts datalist key
- finds applicable AyaDataList object for the key specified (maybe keeps a static list of them rather than finding upon reflection)
GRID LISTS TODO NOW:
- Make a joined table list for development
@@ -17,6 +40,10 @@ GRID LISTS TODO NOW:
- Can it just make a default template if none is found? (no they are all required)
- Once both lists are working:
- abstract away the commonalities into other classes
- AyDataList containing
- AyaObjectFieldDefinitions
- SQL from query
- List key
- REFACTOR: There's going to be a fair number of data source lists in routes so..
- Do I make a route for each one or user provides a key of which list they want and that goes into a single route to return the data?
- What about when there are dozens of reports, do they all hang off each object type controller or is there just a central data list route for all combined?

View File

@@ -0,0 +1,65 @@
using AyaNova.Biz;
namespace AyaNova.DataList
{
//This class defines a field used for returning data in list format for UI grid lists and reporting
public class AyaDataListFieldDefinition
{
//CLIENT / SERVER Unique identifier used at BOTH client and server
//also the sql displaycolumnname if identical
public string FieldKey { get; set; }
//CLIENT Use only for display
public string LtKey { get; set; }
//CLIENT / SERVER - client display server validation purposes
public bool IsCustomField { get; set; }
//CLIENT / SERVER - client display server validation purposes
public bool IsFilterable { get; set; }
//CLIENT / SERVER - client display server validation purposes
public bool IsSortable { get; set; }
//CLIENT Use only for display
public int UiFieldDataType { get; set; }
//CLIENT Use only for display
public string EnumType { get; set; }
//CLIENT / SERVER - client display and to indicate what object to open , Server for formatting return object
public int AyaObjectType { get; set; }
//SERVER - for building sql queries
public string SqlIdColumnName { get; set; }
public string SqlValueColumnName { get; set; }
public AyaDataListFieldDefinition()
{
//most common defaults
IsCustomField = false;
IsFilterable = true;
IsSortable = true;
//Set openable object type to no type which is the default and means it's not a link to another object
AyaObjectType = (int)AyaType.NoType;
}
//Get column to query for display name or use FieldName if there is no difference
public string GetSqlValueColumnName()
{
if (string.IsNullOrEmpty(SqlValueColumnName))
{
return FieldKey.ToLowerInvariant();
}
else
{
return SqlValueColumnName;
}
}
}
}

View File

@@ -0,0 +1,20 @@
using System.Collections.Generic;
using AyaNova.Biz;
namespace AyaNova.DataList
{
internal interface IAyaDataList
{
//Unique key to identify this list
string ListKey { get; }
//sql query from fragment with table joins et
string SQLFrom { get; }
//List of fields for this object
List<AyaDataListFieldDefinition> FieldDefinitions { get; }
//allowed roles to access this list
public AuthorizationRoles AllowedRoles { get; }
}
}