biz9-logic 4.8.31 → 4.8.41

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.
Files changed (4) hide show
  1. package/biz9_config +1 -1
  2. package/index.js +121 -174
  3. package/package.json +2 -2
  4. package/test.js +41 -27
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='5.1.1'
1
+ VERSION='5.2.1'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
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,Str,DateTime,Number } = require('biz9-utility');
9
+ const { Log,Str,DateTime,Number,Obj } = require('/home/think2/www/doqbox/biz9-framework/biz9-utility/code');
10
10
  class Message {
11
11
  static SUCCESS="Update Success";
12
12
  static LOGIN_GOOD="Login Success";
@@ -21,12 +21,8 @@ class TemplateType {
21
21
  }
22
22
  class Item_Logic {
23
23
  static get_test = (title,data_type,id,option)=>{
24
- if(!data_type){
25
- data_type=DataType.BLANK;
26
- }
27
- if(!id){
28
- id=0;
29
- }
24
+ data_type = data_type ? data_type : DataType.BLANK;
25
+ id = id ? id : 0;
30
26
  option = Field_Logic.get_option(data_type,option?option:{});
31
27
  let item = DataItem.get_new_full_item(
32
28
  DataItem.get_new(data_type,0),
@@ -47,6 +43,9 @@ class Item_Logic {
47
43
  }
48
44
  return item_list;
49
45
  }
46
+ static get_search = (data_type,filter,sort_by,page_current,page_size) => {
47
+ return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
48
+ }
50
49
  }
51
50
  class Template_Logic {
52
51
  static get_test = (title,option) =>{
@@ -128,7 +127,7 @@ class Page_Logic {
128
127
  option = Field_Logic.get_option(DataType.PAGE,option?option:{});
129
128
  let item_list = [];
130
129
  for(let a=0;a<option.page_count;a++){
131
- item_list.push(Page_Logic.get_test("Page " +parseInt(a+1),option));
130
+ item_list.push(Page_Logic.get_test( "Page " +parseInt(a+1)? !option.get_blank : "",option));
132
131
  }
133
132
  return item_list;
134
133
  }
@@ -141,11 +140,21 @@ class Product_Logic {
141
140
  DataItem.get_new(DataType.PRODUCT,0),
142
141
  DataItem.get_new(DataType.PRODUCT,0),
143
142
  Field_Logic.get_test(title,option));
144
- product.cost = String(Number.get_id()) + "." + String(Number.get_id());
145
- product.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
146
- product.type = "Type "+String(Number.get_id());
147
- product.sub_type = "Sub Type "+String(Number.get_id());
148
- product.stock = String(Number.get_id(3-1));
143
+
144
+ if(option.get_blank ==false){
145
+ product.cost = String(Number.get_id(999)) + "." + String(Number.get_id(99));
146
+ product.old_cost = String(Number.get_id(999)) + "." + String(Number.get_id(99));
147
+ product.type = "Type "+String(Number.get_id());
148
+ product.sub_type = "Sub Type "+String(Number.get_id());
149
+ product.stock = String(Number.get_id(3-1));
150
+ }else{
151
+ product.cost = "";
152
+ product.old_cost = "";
153
+ product.type = "";
154
+ product.sub_type = "";
155
+ product.stock = "";
156
+ }
157
+
149
158
  if(option.get_item){
150
159
  product.items = Sub_Item_Logic.get_test_item_list(product,product,option);
151
160
  }
@@ -183,8 +192,8 @@ class Service_Logic {
183
192
  DataItem.get_new(DataType.SERVICE,0),
184
193
  DataItem.get_new(DataType.SERVICE,0),
185
194
  Field_Logic.get_test(title,option));
186
- service.cost = String(Number.get_id()) + "." + String(Number.get_id());
187
- service.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
195
+ service.cost = String(Number.get_id(999)) + "." + String(Number.get_id(99));
196
+ service.old_cost = String(Number.get_id(999)) + "." + String(Number.get_id(99));
188
197
  service.type = "Type "+String(Number.get_id());
189
198
  service.sub_type = "Sub Type "+String(Number.get_id());
190
199
  service.stock = String(Number.get_id(3-1));
@@ -274,7 +283,7 @@ class Blog_Post_Logic {
274
283
  option = Field_Logic.get_option(DataType.BLOG_POST,option?option:{});
275
284
  let item_list = [];
276
285
  for(let a=0;a<option.blog_post_count;a++){
277
- item_list.push(Blog_Post_Logic.get_test("Blog_Post " +String(parseInt(a+1)),option));
286
+ item_list.push(Blog_Post_Logic.get_test("Blog Post " +String(parseInt(a+1)),option));
278
287
  }
279
288
  return item_list;
280
289
  }
@@ -286,7 +295,7 @@ class Blog_Post_Logic {
286
295
  for(let a=0;a<category_list.length;a++){
287
296
  for(let b=0;b<option.blog_post_count;b++){
288
297
  item_count++;
289
- let blog_post = Blog_Post_Logic.get_test("Blog_Post "+String(parseInt(b+1)),option);
298
+ let blog_post = Blog_Post_Logic.get_test("Blog Post "+String(parseInt(b+1)),option);
290
299
  blog_post.category = category_list[Number.get_id(category_list.length+1)].title;
291
300
  blog_post_list.push(blog_post);
292
301
  }
@@ -302,8 +311,8 @@ class Event_Logic {
302
311
  DataItem.get_new(DataType.EVENT,0),
303
312
  DataItem.get_new(DataType.EVENT,0),
304
313
  Field_Logic.get_test(title,option));
305
- event.cost = String(Number.get_id()) + "." + String(Number.get_id());
306
- event.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
314
+ event.cost = String(Number.get_id(999)) + "." + String(Number.get_id(99));
315
+ event.old_cost = String(Number.get_id(999)) + "." + String(Number.get_id(99));
307
316
  event.date = String(String(Number.get_id(2030)) + "-" + String(Number.get_id(13)) + "-" + String(Number.get_id(30))).trim();
308
317
  event.time = String(Number.get_id(24)) + ":" + String(Number.get_id(59));
309
318
  event.website = "Website "+String(Number.get_id());
@@ -342,19 +351,23 @@ class Event_Logic {
342
351
  }
343
352
  class Field_Logic {
344
353
  static get_test = (title,option) =>{
345
- if(!option){
346
- option= {};
347
- }
348
- if(!option.category_title){
349
- option.category_title = 'Category '+String(Number.get_id());
354
+ let sub_note = "Sub Note "+String(Number.get_id());
355
+ let note = "Note "+String(Number.get_id());
356
+ option = option ? option : {};
357
+ option.category_title = !Str.check_is_null(option.category_title) ? option.category_title : 'Category '+String(Number.get_id());
358
+ if(option.get_blank == true){
359
+ title = "";
360
+ sub_note = "";
361
+ note = "";
362
+ option.category_title = "";
350
363
  }
351
364
  let item = {
352
365
  title:title,
353
366
  setting_visible:"1",
354
367
  title_url:Str.get_title_url(title),
355
368
  category:option.category_title,
356
- sub_note:"Sub Note "+String(Number.get_id()),
357
- note:"Note "+String(Number.get_id())
369
+ sub_note:sub_note,
370
+ note:note
358
371
  }
359
372
  if(option.get_value){
360
373
  item = Field_Logic.get_value_list(item,option);
@@ -363,119 +376,96 @@ class Field_Logic {
363
376
  }
364
377
  static get_value_list(item,option){
365
378
  for(let b=0;b<option.value_count;b++){
366
- item['value_'+String(b+1)] = 'value ' + String(b+1);
367
- item['field_'+String(b+1)] = Str.get_title_url(item['value_'+String(b+1)]);
368
- item[Str.get_title_url('value ' + String(b+1))] = item.title + ' value ' + String(b+1);
379
+ if(option.get_blank == false){
380
+ item['value_'+String(b+1)] = 'value ' + String(b+1);
381
+ item['field_'+String(b+1)] = Str.get_title_url(item['value_'+String(b+1)]);
382
+ item[Str.get_title_url('value ' + String(b+1))] = item.title + ' value ' + String(b+1);
383
+ }else{
384
+ item['value_'+String(b+1)] = "";
385
+ item['field_'+String(b+1)] = "";
386
+ item[Str.get_title_url('value ' + String(b+1))] ="";
387
+ }
369
388
  }
370
389
  return item;
371
390
  };
372
391
  static get_option_admin(req){
373
- let option = {};
374
- option.category_product_count = req.query.category_product_count?parseInt(req.query.category_product_count): 9;
375
- option.product_count = req.query.product_count?parseInt(req.query.product_count): 19;
376
- option.category_blog_post_count = req.query.category_blog_post_count?parseInt(req.query.category_blog_post_count): 9;
377
- option.blog_post_count = req.query.blog_post_count?parseInt(req.query.blog_post_count): 19;
378
- option.category_service_count = req.query.category_service_count?parseInt(req.query.category_service_count): 9;
379
- option.service_count = req.query.service_count?parseInt(req.query.service_count): 19;
380
- option.category_event_count = req.query.category_event_count?parseInt(req.query.category_event_count): 9;
381
- option.event_count = req.query.event_count?parseInt(req.query.event_count): 19;
392
+ let option = {};
393
+ option.value_count = req.query.value_count ? req.query.value_count : 19;
394
+ option.section_count = req.query.section_count ? req.query.section_count : 19;
395
+ option.question_count = req.query.question_count ? req.query.question_count : 19;
382
396
 
383
- option.get_admin = req.query.get_admin?String(req.query.get_admin)=='true': false;
384
- option.get_business = req.query.get_business?String(req.query.get_business)=='true': false;
385
- option.get_blog_post = req.query.get_blog_post?String(req.query.get_blog_post)=='true': false;
386
- option.get_event = req.query.get_event?String(req.query.get_event)=='true': false;
387
- option.get_faq = req.query.get_faq?String(req.query.get_faq)=='true': false;
388
- option.get_template = req.query.get_template?String(req.query.get_template)=='true': false;
389
- option.get_page = req.query.get_page?String(req.query.get_page)=='true': false;
390
- option.get_product = req.query.get_product?String(req.query.get_product)=='true': false;
391
- option.get_service = req.query.get_service?String(req.query.get_service)=='true': false;
392
- option.get_team = req.query.get_team?String(req.query.get_team)=='true': false;
397
+ option.get_blog_post = req.query.get_blog_post ? req.query.get_blog_post : false;
398
+ option.get_category_blog_post = req.query.get_category_blog_post ? req.query.get_category_blog_post : false;
399
+ option.category_blog_post_count = req.query.category_blog_post_count ? req.query.category_blog_post_count : 9;
400
+ option.blog_post_count = req.query.blog_post_count ? req.query.blog_post_count : 9;
393
401
 
394
- return option;
395
402
 
403
+ option.get_product = req.query.get_product ? req.query.get_product : false;
404
+ option.get_category_product = req.query.get_category_product ? req.query.get_category_product : false;
405
+ option.category_product_count = req.query.category_product_count ? req.query.category_product_count : 9;
406
+ option.product_count = req.query.product_count ? req.query.product_count : 19;
407
+
408
+ option.get_service = req.query.get_service ? req.query.get_service : false;
409
+ option.get_category_service = req.query.get_category_service ? req.query.get_category_service : false;
410
+ option.category_service_count = req.query.category_service_count ? req.query.category_service_count : 9;
411
+ option.service_count = req.query.service_count ? req.query.service_count : 19;
412
+
413
+ option.get_event = req.query.get_event ? req.query.get_event : false;
414
+ option.get_category_event = req.query.get_category_event ? req.query.get_category_event : false;
415
+ option.category_event_count = req.query.category_event_count ? req.query.category_event_count : 9;
416
+ option.event_count = req.query.event_count ? req.query.event_count : 19;
417
+
418
+ option.get_admin = req.query.get_admin ? req.query.get_admin : false;
419
+ option.get_business = req.query.get_business ? req.query.get_business : false;
420
+ option.get_faq = req.query.get_faq ? req.query.get_faq : false;
421
+ option.get_template = req.query.get_template ? req.query.get_template : false;
422
+ option.get_page = req.query.get_page ? req.query.get_page : false;
423
+ option.get_team = req.query.get_team ? req.query.get_team : false;
424
+
425
+ return option;
396
426
  }
397
427
  static get_option(data_type,option){
398
- if(!data_type){
399
- data_type = DataType.BLANK;
400
- }
401
- if(!option){
402
- option = {get_value:false,get_item:false,get_photo:false,item_count:9,value_count:9};
403
- }
404
- if(!option.get_photo){
405
- option.get_photo=false;
406
- }
407
- if(!option.get_value){
408
- option.get_value=false;
409
- }
410
- if(!option.value_count){
411
- option.value_count=9;
412
- }
413
- if(!option.section_count){
414
- option.section_count=9;
415
- }
416
- if(!option.get_item){
417
- option.get_item=false;
418
- }
419
- if(!option.item_count){
420
- option.item_count=9;
421
- }
422
- if(!option.category_count){
423
- option.category_count=9;
424
- }
425
- if(!option.category_title){
426
- option.category_title=null;
427
- }
428
+ data_type = data_type ? data_type : DataType.BLANK;
429
+ option = !Obj.check_is_empty(option) ? option : {get_value:false,get_item:false,get_photo:false,item_count:9,value_count:9};
430
+ option.get_photo = option.get_photo ? true : false;
431
+ option.get_value = option.get_value ? true : false;
432
+ option.get_item = option.get_item ? true : false;
433
+ option.get_blank = option.get_blank ? true : false;
434
+ option.value_count = option.value_count ? option.value_count : 19;
435
+ option.section_count = option.section_count ? option.section_count : 19;
436
+ option.item_count = option.item_count ? option.item_count : 9;
437
+ option.category_count = option.category_count ? option.category_count : 9;
438
+ option.category_title = option.category_title ? option.category_title : "";
428
439
  if(option.data_type==DataType.PAGE){
429
- if(!option.page_count){
430
- option.page_count=9;
431
- }
432
- if(!option.section_count){
433
- option.section_count=9;
434
- }
435
- if(!option.get_section){
436
- option.get_section=false;
437
- }
440
+ option.page_count = option.page_count ? option.page_count : 9;
441
+ option.section_count = option.section_count ? option.section_count : 9;
442
+ option.get_section = option.get_section ? true : false;
438
443
  }
439
444
  if(option.data_type==DataType.PRODUCT){
440
- if(!option.product_count){
441
- option.product_count=9;
442
- }
445
+ option.product_count = option.product_count ? option.product_count : 9;
443
446
  }
444
447
  if(data_type==DataType.SERVICE){
445
- if(!option.service_count){
446
- option.service_count=9;
447
- }
448
+ option.service_count = option.service_count ? option.service_count : 9;
448
449
  }
449
450
  if(data_type==DataType.BLOG_POST){
450
- if(!option.blog_post_count){
451
- option.blog_post_count=9;
452
- }
451
+ option.blog_post_count = option.blog_post_count ? option.blog_post_count : 9;
453
452
  }
454
453
  if(data_type==DataType.EVENT){
455
- if(!option.event_count){
456
- option.event_count=9;
457
- }
454
+ option.event_count = option.event_count ? option.event_count : 9;
458
455
  }
459
456
  if(data_type==DataType.TEAM){
460
- if(!option.get_member){
461
- option.get_member=false;
462
- }
463
- if(!option.member_count){
464
- option.member_count=9;
465
- }
457
+ option.get_member = option.get_member ? true : false;
458
+ option.member_count = option.member_count ? option.member_count : 9;
466
459
  }
467
460
  if(data_type==DataType.FAQ){
468
- if(!option.get_question){
469
- option.get_question=false;
470
- }
471
- if(!option.question_count){
472
- option.question_count=9;
473
- }
461
+ option.get_question = option.get_question ? true : false;
462
+ option.question_count = option.question_count ? option.question_count : 9;
474
463
  }
475
464
  if(data_type==DataType.CONTENT){
476
- if(!option.content_count){
477
- option.content_count=9;
478
- }
465
+ option.content_count = option.content_count ? option.content_count : 9;
466
+ }
467
+ if(data_type==DataType.SUB_ITEM){
468
+ option.item_count = option.item_count ? option.item_count : 9;
479
469
  }
480
470
  return option;
481
471
  }
@@ -603,11 +593,7 @@ class PageType {
603
593
  }
604
594
  class DataType {
605
595
  static get_title = (data_type) => {
606
- if(!data_type){
607
- return "";
608
- }else{
609
- return String(Str.get_title(data_type.replaceAll('_',' ').replaceAll('dt','').replace('biz',''))).trim();
610
- }
596
+ return (!data_type) ? "" : String(Str.get_title(data_type.replaceAll('_',' ').replaceAll('dt','').replace('biz',''))).trim();
611
597
  }
612
598
  static get_item_list = () =>{
613
599
  return [
@@ -729,9 +715,7 @@ class Review_Logic {
729
715
  return review;
730
716
  };
731
717
  static get_test_list=(option)=>{
732
- if(!option){
733
- option = {review_count:19};
734
- }
718
+ option = !Obj.check_is_empty(option) ? option : {review_count:19};
735
719
  let item_list = [];
736
720
  for(let a=0;a<option.review_count;a++){
737
721
  item_list.push(Review_Logic.get_test());
@@ -741,9 +725,7 @@ class Review_Logic {
741
725
  }
742
726
  class Business_Logic {
743
727
  static get_new = (title) =>{
744
- if(!title){
745
- title="Business "+Number.get_id();
746
- }
728
+ title=(title) ? title : "Business "+Number.get_id();
747
729
  return DataItem.get_new_full_item(
748
730
  DataItem.get_new(DataType.BUSINESS,0),
749
731
  DataItem.get_new(DataType.BUSINESS,0),
@@ -765,7 +747,6 @@ class Business_Logic {
765
747
  };
766
748
  static get_test = (title,option) =>{
767
749
  option = Field_Logic.get_option(DataType.BUSINESS,option?option:{});
768
- Log.w('option',option);
769
750
  let item = DataItem.get_new(DataType.BUSINESS,0);
770
751
  let city_list = ["Miami","Atlanta","Chicago","Seattle","New York City"];
771
752
  let state_list = ["Georgia","New York","Illinois","Washington","Flordia"];
@@ -789,18 +770,11 @@ class Business_Logic {
789
770
  return item;
790
771
  };
791
772
  static get_full_address(business){
792
- if(!business.address_1){
793
- business.address_1 = "";
794
- }
795
- if(!business.address_2){
796
- business.address_2 = "";
797
- }
798
- if(!business.city){
799
- business.city = "";
800
- }
801
- if(!business.state){
802
- business.state = "";
803
- }
773
+ business.address_1 = (business.address_1) ? business.address_1 : "";
774
+ business.address_2 = (business.address_2) ? business.address_2 : "";
775
+ business.city = (business.city) ? business.city : "";
776
+ business.state = (business.state) ? business.state : "";
777
+ business.zip = (business.zip) ? business.zip : "";
804
778
  return business.address_1 + " "+ business.address_2 + " " + business.city + " " + business.state + " " + business.zip;
805
779
  }
806
780
  }
@@ -1043,17 +1017,9 @@ class Url{
1043
1017
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
1044
1018
  };
1045
1019
  }
1046
- class Obj {
1047
- static get_search = (data_type,filter,sort_by,page_current,page_size) => {
1048
- return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
1049
- }
1050
- };
1051
1020
  class Category_Logic {
1052
1021
  static get_test = (title,option) =>{
1053
- if(!title){
1054
- title="Category 1";
1055
- option={};
1056
- }
1022
+ title = (title) ? title : "Category 1";
1057
1023
  option = Field_Logic.get_option(DataType.CATEGORY,option?option:{});
1058
1024
  let category = DataItem.get_new_full_item(
1059
1025
  DataItem.get_new(DataType.CATEGORY,0),
@@ -1338,12 +1304,8 @@ class Stock {
1338
1304
  }
1339
1305
  class Schedule {
1340
1306
  static get_start_date_time = (item) => {
1341
- if(!item.date){
1342
- item.date = new Date();
1343
- }
1344
- if(!item.time){
1345
- item.time = new Date();
1346
- }
1307
+ item.date = (item.date) ? item.date : new Date();
1308
+ item.time = (item.time) ? item.time : new Date();
1347
1309
  item.start_date = DateTime.get_full_date_by_date_time(item.date,item.time);
1348
1310
  item.start_time = DateTime.get_full_time_by_date_time(item.date,item.time);
1349
1311
  item.start_date_time = DateTime.get_full_date_time_by_date_time(item.date,item.time);
@@ -1351,12 +1313,8 @@ class Schedule {
1351
1313
  }
1352
1314
  static get_start_date_time_by_list = (list) => {
1353
1315
  for(let a=0;a<list.length;a++){
1354
- if(!list[a].date){
1355
- list[a].date = new Date();
1356
- }
1357
- if(!list[a].time){
1358
- list[a].time = new Date();
1359
- }
1316
+ list[a].date = (list[a].date) ? list[a].date : new Date();
1317
+ list[a].time = (list[a].time) ? list[a].time : new Date();
1360
1318
  list[a].start_date = DateTime.get_full_date_by_date_time(list[a].date,list[a].time);
1361
1319
  list[a].start_time = DateTime.get_full_time_by_date_time(list[a].date,list[a].time);
1362
1320
  list[a].start_date_time = DateTime.get_full_date_time_by_date_time(list[a].date,list[a].time);
@@ -1385,18 +1343,7 @@ class Storage {
1385
1343
  }
1386
1344
  class Sub_Item_Logic {
1387
1345
  static get_test(title,parent_item,top_item,option){
1388
- if(option==null){
1389
- option={get_value:true,value_count:9};
1390
- }
1391
- if(option.item_count==null){
1392
- option.item_count = 9;
1393
- }
1394
- if(option.get_value==null){
1395
- option.get_value = true;
1396
- }
1397
- if(option.value_count==null){
1398
- option.value_count = 9;
1399
- }
1346
+ option = Field_Logic.get_option(DataType.ITEM,option?option:{});
1400
1347
  let item_title =title;
1401
1348
  let item = DataItem.get_new(
1402
1349
  DataType.ITEM,0, {
@@ -1415,7 +1362,8 @@ class Sub_Item_Logic {
1415
1362
  }
1416
1363
  return item;
1417
1364
  }
1418
- static get_test_item_list(parent_item,top_item,option){
1365
+ static get_test_list(parent_item,top_item,option){
1366
+ option = Field_Logic.get_option(DataType.SUB_ITEM,option?option:{});
1419
1367
  let new_list = [];
1420
1368
  for(let a=0;a<option.item_count;a++){
1421
1369
  let item_title ="Item " + String(parseInt(a+1));
@@ -1469,7 +1417,6 @@ module.exports = {
1469
1417
  Item_Logic,
1470
1418
  Event_Logic,
1471
1419
  Message,
1472
- Obj,
1473
1420
  Page_Logic,
1474
1421
  Page_Url,
1475
1422
  Product_Url,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.8.31",
3
+ "version": "4.8.41",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -10,7 +10,7 @@
10
10
  "dependencies": {
11
11
  "async-series": "^0.0.1",
12
12
  "biz9-scriptz": "^5.8.1",
13
- "biz9-utility": "^3.8.1",
13
+ "biz9-utility": "^3.8.5",
14
14
  "jest": "^29.7.0",
15
15
  "moment": "^2.30.1"
16
16
  },
package/test.js CHANGED
@@ -1,6 +1,6 @@
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_Logic,Category_Url,Blank_Url,Blank_Logic,Item_Logic,Service_Logic,Template_Logic,Page_Logic,Product_Logic,Event_Logic,Blog_Post_Logic,Content_Logic,Category_Logic,Team_Logic,Business_Logic,PageType,Page_Url} = require('./index');
3
+ const {DataItem,DataType,Url,Obj,BiZ_Url,Cat,Stock,Schedule,Storage,Business,Product,Service,Event,Template,Page,Category,Review,Blog_Post,Faq_Logic,Category_Url,Blank_Url,Blank_Logic,Item_Logic,Service_Logic,Template_Logic,Page_Logic,Product_Logic,Event_Logic,Blog_Post_Logic,Content_Logic,Category_Logic,Team_Logic,Business_Logic,PageType,Sub_Item_Logic,Page_Url} = require('./index');
4
4
  const {Log,Number} = require('biz9-utility');
5
5
  const {Scriptz}= require('biz9-scriptz');
6
6
 
@@ -31,22 +31,40 @@ describe("connect", () => {
31
31
  series([
32
32
 
33
33
  function(call) {
34
- console.log('GET-URL-START');
34
+ //console.log('GET-URL-START');
35
35
  //let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
36
36
  //let action_url = 'test_get_url';
37
37
  //let params = '&myparam1=p1&myparam2=p2'
38
38
  //let data_type = DataType.PRODUCT;
39
39
  //let id = "123";
40
- let cloud_url = Page_Url.home(biz9_config);
41
- console.log(biz9_config);
40
+ //let cloud_url = Page_Url.home(biz9_config);
41
+ //console.log(biz9_config);
42
42
  //let cloud_url = Category_Url.get_page(biz9_config,'cool');
43
43
  //let cloud_url = Category_Url.get_page(biz9_config,'cool');
44
- Log.w('cloud_url',cloud_url);
45
- console.log('GET-URL-SUCCESS');
46
- //call()
44
+ //Log.w('cloud_url',cloud_url);
45
+ //console.log('GET-URL-SUCCESS');
46
+ call();
47
47
  },
48
48
 
49
49
  function(call) {
50
+ /* --PAGE--START */
51
+ //let page = Page_Logic.get_test()
52
+ //let page = Page_Logic.get_test("Page "+Number.get_id())
53
+ //let page = Page_Logic.get_test("Page "+Number.get_id(),{get_value:true,value_count:5,get_section:false,section_count:2,get_photo:true,get_blank:true})
54
+ //Log.w("page",page);
55
+ //Log.w("page_section_1",page.section_1);
56
+ //Log.w("page_section_6",page.section_6.items);
57
+ //Log.w("page_section_1_section_1",page.section_1.section_1);
58
+ //let page_list = Page_Logic.get_test_list({page_count:10});
59
+ //Log.w("Page_list",page_list);
60
+ /*
61
+ let page = Page.get_test({item_count:9,page_count:19,get_item:true,get_value:true})
62
+ //let page = Page.get_test()
63
+ Log.w("Page_section_1_section_1_section_1",page.section_1.section_1.section_1);
64
+ */
65
+ /* --PAGE--END */
66
+
67
+
50
68
  /* --TEAM--START */
51
69
  //let team = Team_Logic.get_test()
52
70
  //let team = Team_Logic.get_test("Team 1",{get_value:true,get_member:true})
@@ -73,9 +91,23 @@ describe("connect", () => {
73
91
  //Log.w('category_list',category_list);
74
92
  /* --CATEGORY--END */
75
93
 
94
+ /* --SUB_ITEM--START */
95
+ console.log('TEST-SUB_ITEM-START');
96
+ let item = DataItem.get_new(DataType.BLANK,0);
97
+ let parent_item = DataItem.get_new(DataType.BLANK,0);
98
+ let top_item = DataItem.get_new(DataType.BLANK,0);
99
+ let sub_item = Sub_Item_Logic.get_test("cool 1",item,top_item);
100
+ //Log.w('sub_item',sub_item);
101
+ let sub_item_list = Sub_Item_Logic.get_test_list(item,top_item,{get_value:true});
102
+ // Log.w('sub_item',sub_item);
103
+ Log.w('sub_item_list',sub_item_list);
104
+ Log.w('sub_item_list_len',sub_item_list.length);
105
+ console.log('TEST-SUB_ITEM-END');
106
+ /* --SUB_ITEM--END */
107
+
76
108
 
77
109
  /* --CONTENT--START */
78
- //let content = Content_Logic.get_test()
110
+ //let content = Content_Logic.get_test("cool 1");
79
111
  //let content = Content_Logic.get_test("Content 1",{get_value:true,get_item:true})
80
112
  //Log.w("content",content);
81
113
  //let content_list = Content_Logic.get_test_list();
@@ -132,7 +164,7 @@ describe("connect", () => {
132
164
 
133
165
  //let product = Product_Logic.get_test("Product 1",{get_value:true,get_item:true})
134
166
  //Log.w("product",product);
135
- //let product_list = Product_Logic.get_test_list({product_count:10});
167
+ //let product_list = Product_Logic.get_test_list({product_count:10,get_blank:true});
136
168
  //let product_list = Product_Logic.get_test_list();
137
169
  //Log.w('product_list',product_list);
138
170
  //let [category_list,product_list]=Product.get_test_list_by_category({category_count:5,product_count:9});
@@ -144,24 +176,6 @@ describe("connect", () => {
144
176
  /* --PRODUCT--END */
145
177
 
146
178
 
147
- /* --PAGE--START */
148
- console.log(PageType.get_title(PageType.BLOG_POST));
149
- //let page = Page_Logic.get_test()
150
- //let page = Page_Logic.get_test("Page "+Number.get_id())
151
- //let page = Page_Logic.get_test("Page "+Number.get_id(),{get_value:true,value_count:5,get_section:true,section_count:20})
152
- //Log.w("page",page);
153
- //Log.w("page_section_1",page.section_1);
154
- //Log.w("page_section_6",page.section_6.items);
155
- //Log.w("page_section_1_section_1",page.section_1.section_1);
156
- //let page_list = Page_Logic.get_test_list({page_count:10});
157
- //Log.w("Page_list",page_list);
158
- /*
159
- let page = Page.get_test({item_count:9,page_count:19,get_item:true,get_value:true})
160
- //let page = Page.get_test()
161
- Log.w("Page_section_1_section_1_section_1",page.section_1.section_1.section_1);
162
- */
163
- /* --PAGE--END */
164
-
165
179
 
166
180
  /* --ITEM-TEST--START */
167
181
  //let item = Item_Logic.get_test("Item_" +Number.get_id(),DataType.SERVICE,0);