This commit is contained in:
2019-06-25 00:00:56 +00:00
parent 52b2c16ccb
commit 20c5af6626
4 changed files with 40 additions and 3 deletions

View File

@@ -36,6 +36,8 @@ UI FEATURE - The ability to customize forms:
- According to the docs https://www.postgresql.org/docs/9.1/datatype-character.html this is pretty efficient
- I don't like the idea of an outside table holding all custom values, it would be hammered pretty hard, this way the data stays with it's record
- The server doesn't validate it or anything, just stores what the client provides and retrieves what the client needs and the client co-erces the value to the correct type
- If a user changes the underlying objects type then the client must handle discrepencies and attempt to fix it.
- So the client end must handle adapting the value if the type changes
## TODO

View File

@@ -53,8 +53,8 @@ namespace AyaNova.Api.Controllers
/// Any
///
/// </summary>
/// <param name="formkey"></param>
/// <param name="concurrencyToken"></param>
/// <param name="formkey">The official form key used by AyaNova</param>
/// <param name="concurrencyToken">A prior concurrency token used to check if there are any changes without using up bandwidth sending unnecessary data</param>
/// <returns>A single FormCustom</returns>
[HttpGet("{formkey}")]
public async Task<IActionResult> GetFormCustom([FromRoute] string formkey, [FromQuery] uint? concurrencyToken)

View File

@@ -14,7 +14,7 @@ namespace AyaNova.Biz
get
{
List<string> l = new List<string>{
WIDGET_FORM_KEY//,USER_CRUD, WIDGET etc
WIDGET_FORM_KEY, USER_FORM_KEY
};
return l;
}

View File

@@ -76,6 +76,25 @@ namespace AyaNova.Util
ct.SaveChanges();
}
//WIDGET sample form customization
{
var ct = ServiceProviderProvider.DBContext;
var fc = new FormCustom()
{
FormKey = "widget",
Template = "{template:[{fld:\"WidgetNotes\",required:\"true\"}" +
",{fld:\"WidgetCustom1\",hide:\"false\",required:\"false\", type:\"date\"}" +
",{fld:\"WidgetCustom2\",hide:\"false\",required:\"true\", type:\"text\"}" +
",{fld:\"WidgetCustom3\",hide:\"false\",required:\"false\", type:\"int\"}" +
",{fld:\"WidgetCustom4\",hide:\"false\",required:\"false\", type:\"bool\"}" +
",{fld:\"WidgetCustom5\",hide:\"false\",required:\"false\", type:\"decimal\"}" +
"]"
};
ct.FormCustom.Add(fc);
ct.SaveChanges();
}
//Seed special test data for integration testing
//log.LogInformation("Seeding known users");
@@ -462,6 +481,7 @@ namespace AyaNova.Util
for (int x = 0; x < count; x++)
{
Widget o = new Widget();
@@ -475,6 +495,21 @@ namespace AyaNova.Util
o.Roles = randomRole;
o.Notes = f.Lorem.Paragraph();
o.Tags = RandomTags(f);
//RANDOM CUSTOM FIELD DATA
var custDate=GetSomeDateHereThatIsThenMadeIntoText;
// Template = "{template:[{fld:\"WidgetNotes\",required:\"true\"}" +
// ",{fld:\"WidgetCustom1\",hide:\"false\",required:\"false\", type:\"date\"}" +
// ",{fld:\"WidgetCustom2\",hide:\"false\",required:\"true\", type:\"text\"}" +
// ",{fld:\"WidgetCustom3\",hide:\"false\",required:\"false\", type:\"int\"}" +
// ",{fld:\"WidgetCustom4\",hide:\"false\",required:\"false\", type:\"bool\"}" +
// ",{fld:\"WidgetCustom5\",hide:\"false\",required:\"false\", type:\"decimal\"}" +
// "]"
var NewObject = Biz.Create(ServiceProviderProvider.DBContext, o);
if (NewObject == null)
{