biz9-logic 4.7.10 → 4.7.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/biz9_config +1 -1
- package/index.js +165 -9
- package/package.json +3 -3
- package/test.js +33 -6
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -6,7 +6,7 @@ Description: BiZ9 Framework: Logic-JS
|
|
|
6
6
|
*/
|
|
7
7
|
const moment = require('moment');
|
|
8
8
|
const { get_new_item_main,get_data_config_main,get_cloud_url_main,get_biz_item_main,get_cloud_filter_obj_main,get_new_full_item_main } = require('./main');
|
|
9
|
-
const { Log,
|
|
9
|
+
const { Log,Str,DateTime,Number } = require('biz9-utility');
|
|
10
10
|
class Message {
|
|
11
11
|
static SUCCESS="Update Success";
|
|
12
12
|
static LOGIN_GOOD="Login Success";
|
|
@@ -19,6 +19,81 @@ class TemplateType {
|
|
|
19
19
|
static BODY='body';
|
|
20
20
|
static FOOTER='footer';
|
|
21
21
|
}
|
|
22
|
+
class Item_Logic {
|
|
23
|
+
static get_test_item = (data_type,id,option)=>{
|
|
24
|
+
if(option==null){
|
|
25
|
+
option ={get_value:false};
|
|
26
|
+
}
|
|
27
|
+
if(option.get_value == null){
|
|
28
|
+
option.get_value = false;
|
|
29
|
+
}
|
|
30
|
+
if(!data_type){
|
|
31
|
+
data_type=DataType.BLANK;
|
|
32
|
+
}
|
|
33
|
+
if(!id){
|
|
34
|
+
id=0;
|
|
35
|
+
}
|
|
36
|
+
let _id=Number.get_id(9999);
|
|
37
|
+
let item_test = {data_type:data_type,id:id};
|
|
38
|
+
item_test.title='title_'+_id;
|
|
39
|
+
item_test.title_url=Str.get_title_url(item_test.title);
|
|
40
|
+
item_test.sub_note='sub_note_'+_id;
|
|
41
|
+
item_test.note='note_'+_id;
|
|
42
|
+
item_test.category='category_'+_id;
|
|
43
|
+
item_test.group_id=_id;
|
|
44
|
+
if(option.get_value){
|
|
45
|
+
for(let b=1;b<20;b++){
|
|
46
|
+
item_test['value_'+String(b)] = 'value ' + String(b);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if(data_type == DataType.BLOG_POST)
|
|
50
|
+
{
|
|
51
|
+
item_test.author = "Author "+String(Number.get_id());
|
|
52
|
+
item_test.tag = "tag 1, tag 2, tag 3";
|
|
53
|
+
}else if(data_type == DataType.PRODUCT)
|
|
54
|
+
{
|
|
55
|
+
item_test.cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
56
|
+
item_test.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
57
|
+
item_test.type = "Type "+String(Number.get_id());
|
|
58
|
+
item_test.sub_type = "Sub Type "+String(Number.get_id());
|
|
59
|
+
item_test.stock = String(Number.get_id(3-1));
|
|
60
|
+
}else if(data_type == DataType.SERVICE)
|
|
61
|
+
{
|
|
62
|
+
item_test.cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
63
|
+
item_test.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
64
|
+
item_test.type = "Type "+String(Number.get_id());
|
|
65
|
+
item_test.sub_type = "Sub Type "+String(Number.get_id());
|
|
66
|
+
item_test.stock = String(Number.get_id(3-1));
|
|
67
|
+
}else if(data_type == DataType.EVENT){
|
|
68
|
+
item_test.cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
69
|
+
item_test.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
70
|
+
item_test.date = String(String(Number.get_id(2030)) + "-" + String(Number.get_id(13)) + "-" + String(Number.get_id(30))).trim();
|
|
71
|
+
item_test.time = String(Number.get_id(24)) + ":" + String(Number.get_id(59));
|
|
72
|
+
item_test.website = "Website "+String(Number.get_id());
|
|
73
|
+
item_test.location = "Location "+String(Number.get_id());
|
|
74
|
+
item_test.meeting_link = "Meeting Link "+String(Number.get_id());
|
|
75
|
+
item_test.stock = String(Number.get_id(3-1));
|
|
76
|
+
}
|
|
77
|
+
return item_test;
|
|
78
|
+
}
|
|
79
|
+
static get_test_item_list = (data_type,option) =>{
|
|
80
|
+
if(data_type==null){
|
|
81
|
+
data_type = DataType.BLANK;
|
|
82
|
+
}
|
|
83
|
+
if(option==null){
|
|
84
|
+
option = {item_count:9};
|
|
85
|
+
}
|
|
86
|
+
if(option.item_count==null){
|
|
87
|
+
option.item_count = 10;
|
|
88
|
+
}
|
|
89
|
+
let new_list = [];
|
|
90
|
+
for(let a=1;a<option.item_count;a++){
|
|
91
|
+
new_list.push(DataItem.get_new(data_type,0,Item_Logic.get_test_item(data_type,0,option)));
|
|
92
|
+
}
|
|
93
|
+
return new_list;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
22
97
|
class Template_Logic {
|
|
23
98
|
static get_test = () =>{
|
|
24
99
|
let template = DataItem.get_new_full_item(
|
|
@@ -410,6 +485,68 @@ class DataType {
|
|
|
410
485
|
static USER='user_biz';
|
|
411
486
|
static VIDEO='video_biz';
|
|
412
487
|
}
|
|
488
|
+
class Blank_Logic {
|
|
489
|
+
static get_test = (option) =>{
|
|
490
|
+
if(!option){
|
|
491
|
+
option = {item_count:10,get_value:false,get_item:false,value_count:20};
|
|
492
|
+
}
|
|
493
|
+
if(!option.item_count){
|
|
494
|
+
option.item_count=10;
|
|
495
|
+
}
|
|
496
|
+
let blank = DataItem.get_new_full_item(
|
|
497
|
+
DataItem.get_new(DataType.BLANK,Number.get_id()),
|
|
498
|
+
DataItem.get_new(DataType.BLANK,0),
|
|
499
|
+
DataItem.get_new(DataType.BLANK,0),
|
|
500
|
+
Field.get_test("Blog Post "+Number.get_id(),option));
|
|
501
|
+
blank.tag="tag 1,tag 2,tag 3";
|
|
502
|
+
blank.category ="Category " + String(Number.get_id());
|
|
503
|
+
if(option.get_item){
|
|
504
|
+
for(let a=0;a<option.item_count;a++){
|
|
505
|
+
blank=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section "+a,blank,blank,blank);
|
|
506
|
+
}
|
|
507
|
+
blank=Sub_Item.get_test_bind_item_sub_item(blank);
|
|
508
|
+
}
|
|
509
|
+
return blank;
|
|
510
|
+
};
|
|
511
|
+
static get_test_list=(option)=>{
|
|
512
|
+
if(!option){
|
|
513
|
+
option = {blank_count:10,get_value:false,get_item:false,value_count:20};
|
|
514
|
+
}
|
|
515
|
+
let item_list=[];
|
|
516
|
+
for(let a=0;a<option.blank_count;a++){
|
|
517
|
+
item_list.push(Blank_Logic.get_test(option));
|
|
518
|
+
}
|
|
519
|
+
return item_list;
|
|
520
|
+
};
|
|
521
|
+
static get_test_list_by_category = (option) =>{
|
|
522
|
+
let blank_list = [];
|
|
523
|
+
let category_count = 9;
|
|
524
|
+
let blank_count = 19;
|
|
525
|
+
if(!option){
|
|
526
|
+
option={};
|
|
527
|
+
}
|
|
528
|
+
else{
|
|
529
|
+
if(option.category_count){
|
|
530
|
+
category_count = parseInt(option.category_count);
|
|
531
|
+
}
|
|
532
|
+
if(option.category_count){
|
|
533
|
+
blank_count = parseInt(option.blank_count);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
let category_list = Category_Logic.get_type_category_list(DataType.BLANK,category_count);
|
|
537
|
+
let item_count = 0;
|
|
538
|
+
for(let a=0;a<category_list.length;a++){
|
|
539
|
+
for(let b=0;b<blank_count;b++){
|
|
540
|
+
item_count++;
|
|
541
|
+
let blank = Blank_Logic.get_test({item_count:0,blank_count:blank_count,get_value:false,get_item:false,value_count:20});
|
|
542
|
+
blank.category = category_list[Number.get_id(category_list.length-1)].title;
|
|
543
|
+
blank_list.push(blank);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
return [category_list,blank_list]
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
|
|
413
550
|
class Blog_Post_Logic {
|
|
414
551
|
static get_test = (option) =>{
|
|
415
552
|
if(!option){
|
|
@@ -604,6 +741,20 @@ class DataItem {
|
|
|
604
741
|
return r_list;
|
|
605
742
|
}
|
|
606
743
|
}
|
|
744
|
+
class Blank_Url {
|
|
745
|
+
static get = (biz9_config,title_url,params) => {
|
|
746
|
+
let action_url="blank/get/"+title_url;
|
|
747
|
+
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
748
|
+
};
|
|
749
|
+
static browse = (biz9_config,params) => {
|
|
750
|
+
let action_url="blank/browse";
|
|
751
|
+
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
752
|
+
};
|
|
753
|
+
static category = (biz9_config,category,params) => {
|
|
754
|
+
let action_url="blank/category/"+category;
|
|
755
|
+
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
756
|
+
};
|
|
757
|
+
}
|
|
607
758
|
class Blog_Post_Url {
|
|
608
759
|
static get = (biz9_config,title_url,params) => {
|
|
609
760
|
let action_url="blog_post/get/"+title_url;
|
|
@@ -714,7 +865,7 @@ class Content_Url {
|
|
|
714
865
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
715
866
|
};
|
|
716
867
|
static category = (biz9_config,category,params) => {
|
|
717
|
-
let action_url="content/category"+category;
|
|
868
|
+
let action_url="content/category/"+category;
|
|
718
869
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
719
870
|
};
|
|
720
871
|
}
|
|
@@ -728,7 +879,7 @@ class Gallery_Url {
|
|
|
728
879
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
729
880
|
};
|
|
730
881
|
static category = (biz9_config,category,params) => {
|
|
731
|
-
let action_url="gallery/category"+category;
|
|
882
|
+
let action_url="gallery/category/"+category;
|
|
732
883
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
|
|
733
884
|
};
|
|
734
885
|
}
|
|
@@ -760,7 +911,7 @@ class Team_Url {
|
|
|
760
911
|
}
|
|
761
912
|
class Url{
|
|
762
913
|
static copy_item = (biz9_config,data_type,id) => {
|
|
763
|
-
let action_url= "main/
|
|
914
|
+
let action_url= "main/crud/copy/"+data_type + "/" + id;
|
|
764
915
|
return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
|
|
765
916
|
};
|
|
766
917
|
static delete_item = (biz9_config,data_type,id) => {
|
|
@@ -857,11 +1008,11 @@ class Category_Logic {
|
|
|
857
1008
|
};
|
|
858
1009
|
static get_category_list = () => {
|
|
859
1010
|
return [
|
|
860
|
-
{data_type:DataType.BLOG_POST,value:DataType.BLOG_POST,label:"Blog Posts"},
|
|
861
|
-
{data_type:DataType.CATEGORY,value:DataType.CATEGORY,label:"Category"},
|
|
862
|
-
{data_type:DataType.CONTENT,value:DataType.CONTENT,label:"Content"}
|
|
863
|
-
{data_type:DataType.EVENT,value:DataType.EVENT,label:"Events"}
|
|
864
|
-
{data_type:DataType.GALLERY,value:DataType.GALLERY,label:"Galleries"},
|
|
1011
|
+
{data_type:DataType.BLOG_POST,value:DataType.BLOG_POST,label:"Blog Posts"}, //
|
|
1012
|
+
{data_type:DataType.CATEGORY,value:DataType.CATEGORY,label:"Category"}, //
|
|
1013
|
+
{data_type:DataType.CONTENT,value:DataType.CONTENT,label:"Content"},//
|
|
1014
|
+
{data_type:DataType.EVENT,value:DataType.EVENT,label:"Events"},//
|
|
1015
|
+
{data_type:DataType.GALLERY,value:DataType.GALLERY,label:"Galleries"}, //
|
|
865
1016
|
{data_type:DataType.SERVICE,value:DataType.SERVICE,label:"Services"},
|
|
866
1017
|
{data_type:DataType.PRODUCT,value:DataType.PRODUCT,label:"Product"},
|
|
867
1018
|
{data_type:DataType.TEMPLATE,value:DataType.TEMPLATE,label:"Template"},
|
|
@@ -1214,19 +1365,24 @@ class Sub_Item {
|
|
|
1214
1365
|
}
|
|
1215
1366
|
module.exports = {
|
|
1216
1367
|
Business_Logic,
|
|
1368
|
+
Blank_Logic,
|
|
1369
|
+
Blank_Url,
|
|
1217
1370
|
Blog_Post_Logic,
|
|
1218
1371
|
Blog_Post_Url,
|
|
1219
1372
|
Category_Logic,
|
|
1220
1373
|
Category_Url,
|
|
1374
|
+
Content_Url,
|
|
1221
1375
|
Custom_Field_Url,
|
|
1222
1376
|
CMS,
|
|
1223
1377
|
DataItem,
|
|
1224
1378
|
DataType,
|
|
1379
|
+
Event_Url,
|
|
1225
1380
|
Field,
|
|
1226
1381
|
FieldType,
|
|
1227
1382
|
Faq_Logic,
|
|
1228
1383
|
Gallery_Url,
|
|
1229
1384
|
Event_Logic,
|
|
1385
|
+
Item_Logic,
|
|
1230
1386
|
Message,
|
|
1231
1387
|
Obj,
|
|
1232
1388
|
Page_Logic,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "biz9-logic",
|
|
3
|
-
"version": "4.7.
|
|
3
|
+
"version": "4.7.15",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"async-series": "^0.0.1",
|
|
12
|
-
"biz9-scriptz": "^5.
|
|
13
|
-
"biz9-utility": "^3.
|
|
12
|
+
"biz9-scriptz": "^5.8.1",
|
|
13
|
+
"biz9-utility": "^3.8.1",
|
|
14
14
|
"jest": "^29.7.0",
|
|
15
15
|
"moment": "^2.30.1"
|
|
16
16
|
},
|
package/test.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const series = require('async-series');
|
|
3
|
-
const {DataItem,DataType,Url,Obj,BiZ_Url,Cat,Stock,Schedule,Storage,Business,Product,Service,Event,Template,Page,Category,Review,Blog_Post,Faq,Category_Url} = require('./index');
|
|
4
|
-
const {Log,
|
|
3
|
+
const {DataItem,DataType,Url,Obj,BiZ_Url,Cat,Stock,Schedule,Storage,Business,Product,Service,Event,Template,Page,Category,Review,Blog_Post,Faq,Category_Url,Blank_Url,Blank_Logic,Item_Logic} = require('./index');
|
|
4
|
+
const {Log,Number} = require('biz9-utility');
|
|
5
5
|
const {Scriptz}= require('biz9-scriptz');
|
|
6
6
|
|
|
7
7
|
/* --- TEST CONFIG START --- */
|
|
@@ -28,6 +28,7 @@ const biz9_config ={
|
|
|
28
28
|
describe("connect", () => {
|
|
29
29
|
it("_connect", () => {
|
|
30
30
|
series([
|
|
31
|
+
/*
|
|
31
32
|
function(call) {
|
|
32
33
|
console.log('GET-URL-START');
|
|
33
34
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
@@ -41,9 +42,35 @@ describe("connect", () => {
|
|
|
41
42
|
console.log('GET-URL-SUCCESS');
|
|
42
43
|
//call()
|
|
43
44
|
},
|
|
45
|
+
*/
|
|
44
46
|
|
|
45
47
|
function(call) {
|
|
46
|
-
|
|
48
|
+
|
|
49
|
+
//let item_test = Item_Logic.get_test_item(DataType.SERVICE,0);
|
|
50
|
+
let item_test_list = Item_Logic.get_test_item_list(DataType.BLANK,{item_count:10,get_value:true});
|
|
51
|
+
|
|
52
|
+
Log.w('item_test_list',item_test_list);
|
|
53
|
+
|
|
54
|
+
//console.log('CONNECT-START');
|
|
55
|
+
/* --BLANK--START */
|
|
56
|
+
//let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
57
|
+
|
|
58
|
+
//let title_url = "blank_1";
|
|
59
|
+
//let cloud_url = Blank_Url.browse(biz9_config);
|
|
60
|
+
//Log.w('cloud_url',cloud_url);
|
|
61
|
+
//let blank_list=Blank_Logic.get_test_list({category_count:5,blank_count:9,get_value:false,get_item:false});
|
|
62
|
+
//let [category_list,blank_list]=Blank.get_test_list_by_category({category_count:5,blank_count:9});
|
|
63
|
+
//Log.w('blank_list',blank_list);
|
|
64
|
+
//Log.w('category_list',category_list);
|
|
65
|
+
|
|
66
|
+
//let blank = Blank_Logic.get_test({item_count:9,blank_count:19,get_item:true,get_value:true})
|
|
67
|
+
//let blank = Blank.get_test()
|
|
68
|
+
//Log.w('blank_list',blank_list);
|
|
69
|
+
//Log.w("Blank",blank);
|
|
70
|
+
//Log.w("BLog_Post_section_1",blank.section_1);
|
|
71
|
+
//Log.w("BLog_Post_section_1_section_1_section_1",blank.section_1.section_1.section_1);
|
|
72
|
+
/* --BLANK--END */
|
|
73
|
+
|
|
47
74
|
|
|
48
75
|
/* --CONFIG--START */
|
|
49
76
|
//let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
@@ -224,14 +251,14 @@ describe("connect", () => {
|
|
|
224
251
|
function(call) {
|
|
225
252
|
console.log('SET-ITEM-BIZ-BY-LIST-START');
|
|
226
253
|
let item_test_list = [];
|
|
227
|
-
let item_test =
|
|
254
|
+
let item_test = Item_Logic.get_test_item('dt_blank',0);
|
|
228
255
|
item_test.cost = String(Number.get_id())+'.55';
|
|
229
256
|
item_test.old_cost = String(Number.get_id())+'.20';
|
|
230
257
|
item_test.title ='_title_'+Number.get_id();
|
|
231
258
|
|
|
232
259
|
item_test_list.push(item_test);
|
|
233
260
|
|
|
234
|
-
let item_test_1 =
|
|
261
|
+
let item_test_1 = Item_Logic.get_test_item('dt_blank',0);
|
|
235
262
|
item_test_1.cost = '5.55';
|
|
236
263
|
item_test_1.old_cost = '9.55';
|
|
237
264
|
item_test_1.title ='_title_'+Number.get_id();
|
|
@@ -245,7 +272,7 @@ describe("connect", () => {
|
|
|
245
272
|
},
|
|
246
273
|
function(call) {
|
|
247
274
|
console.log('SET-ITEM-BIZ-START');
|
|
248
|
-
let item_test =
|
|
275
|
+
let item_test = Item_Logic.get_test_item('dt_blank',0);
|
|
249
276
|
item_test.photofilename='abc.png';
|
|
250
277
|
item_test.cost = '5.55';
|
|
251
278
|
item_test.old_cost = '9.55';
|