add comments to initial scripts

parent 62202831
/**
* User: olga.sedneva
* Fill navigation shortcuts for RequestList model
*/
/**
* Initial script for create City Requests desktop navigation shortcuts for RequestList model
* Used by ubcli initialize command
* @param {ServerSession} session
*/
module.exports = function(session){
var
desktopID, folderID, conn = session.connection;
......
/**
* User: olga.sedneva
* Filling the ubm_enum entity with initial data
*/
/**
* Initial script for adding statuses as enumerator from csv-file
* Used by ubcli initialize command
* @param {ServerSession} session
*/
module.exports = function(session){
const path = require('path')
const fs = require('fs')
......@@ -13,7 +24,12 @@ module.exports = function(session){
conn.Repository('ubm_enum').where('code', '=', row[1]).ubql().whereList
)
)
if(!notExisted){
console.info('\t\tFill enumeration for RequestList model');
dataLoader.loadArrayData(conn, notExisted, 'ubm_enum', 'eGroup;code;name;sortOrder'.split(';'), [0, 1, 2, 3]);
}
else {
console.info('\t\tall records are existing in DB (ubm_enum)');
}
};
\ No newline at end of file
/**
* User: olga.sedneva
* Filling the req_depart entity with initial data
*/
/**
* Initial script for create Departments list from csv-file
* Used by ubcli initialize command
* @param {ServerSession} session
*/
module.exports = function(session){
const path = require('path')
const fs = require('fs')
......@@ -8,12 +19,18 @@ module.exports = function(session){
if (!fContent) { throw new Error(`File ${fn} is empty or not exist`) }
fContent = fContent.trim()
let csvData = csv.parse(fContent)
//check existing records in the DB
let notExisted = csvData.filter(
(row) => !conn.lookup('req_depart', 'ID',
conn.Repository('req_depart').where('name', '=', row[0]).ubql().whereList
)
)
if(!notExisted){
console.info('\t\tFill Departments field (req_depart)');
dataLoader.loadArrayData(conn, notExisted, 'req_depart', 'name;postAddr;phoneNum'.split(';'), [0,1,2], 1);
}
else {
console.info('\t\tall records are existing in DB (req_depart)');
}
};
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment