MASTER/ MOST TABLES (MT) CRUD Operations

CRUD = Create Read Update Delete

Flow Diagram

Diagram

MT Server

config.json

It defines databases & it's collections(tables) which can be CRUD via API or UI

{
products: [{
productCode: 'ModQuestionnaire',
dbCode: 'ModAccessControl', // diff database
allowedCollections: [{
collectionName: 'activityMaster',
schemaURL: '/path/to/activityMasterSchema.json'
}, {
collectionName: 'activityGroupMaster',
schemaURL: '/path/to/activityGroupMasterSchema.json'
}]
},
{
productCode: 'ModParasol',
dbCode: 'ModParasol', // same database
allowedCollections: [{
collectionName: 'activityMaster',
schemaURL: '/path/to/activityMasterSchema.json'
}, {
collectionName: 'activityGroupMaster',
schemaURL: '/path/to/activityGroupMasterSchema.json'
}]
}
]
}

Note: dbCode == productCode => then same product database

dbCode != productCode => then different/ centralized module database

All collections will have productId property

Diagram 2

Diagram

Extending JSON Schema

{
properties: {
customerEmail: {
type: "string",
format: "email",
description: "must be an date and is required",
title: 'Vendor Email',
default:'',
customAttr: { //************
placeHolder: 'abc@example.com'
}
},
country: {
type: "int",
description: "must be an integer and is required",
title: 'Country', //************
default:786,
customAttr: {
placeHolder: '-- select --',
dataSource: 'MASTER_TBL_GROUP_REGION_LEVEL_1',
displayType:''//radio, longTextBox, medTextBox
}
}
},
customDesign:{
layoutSmall:[
"Name",
"Email"
"Description",
"Age",
"Gender"
],
layoutMed:[
"Name*3, Email",
"Description",
"Age, Gender"
]
}
}
Other prop:
readOnly ?
dependencies?

Create design, validatiosn by using extended JSON Schema

Using existing attributes

  • 'title' can be used as label,

  • 'description' as help text,

  • 'default' as initial value

    Using available context

  • Validations can be entirely used (mandatory, field level types & limits)

  • If String type, based on maxLength pick textbox/ textArea

  • If number type, pick number box

  • If enum/ dataSource property exists pick dropdown

  • If boolean type, pick checkbox

Other attributes in customAttr

  • displayType = 'radio/ checkbox/ dropdown'
  • all other needed types must be defined here

design specific in customDesign

  • we always preferred flex layout because of browser support . But CSS Grid gives more power as DOM structure is simplified.

  • To override classes element, label, row & form level : use proper naming style

    //something like
    .form-field-label-age{}
    .form-field-elm-age.select{}
    .form-field-elm-age.text-box{}
    .form-row-1{}
    .form {}
  • think of buttons, action icons & action criteria (based on conditions) ..etc //check readme.txt

  • Have interface for schema, don't directly depend on it

  • Entire MT can be used as module or due to components nature UI components & server code can be reused separately (for hooks)

  • Can later nested structure, reference structure ??