biz9-logic 4.8.19 → 4.8.22

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 CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='4.9.9'
1
+ VERSION='5.0.2'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
package/index.js CHANGED
@@ -33,9 +33,9 @@ class Item_Logic {
33
33
  DataItem.get_new(data_type,0),
34
34
  DataItem.get_new(data_type,0),
35
35
  Field_Logic.get_test(title,option));
36
-
37
36
  if(option.get_item){
38
37
  item.items = Sub_Item_Logic.get_test_item_list(item,item,option);
38
+ item = Sub_Item_Logic.bind_parent_child_list(item,item.items);
39
39
  }
40
40
  return item;
41
41
  }
@@ -50,10 +50,6 @@ class Item_Logic {
50
50
  }
51
51
  class Template_Logic {
52
52
  static get_test = (title,option) =>{
53
- if(!title){
54
- title = "Template "+ Number.get_id();
55
- option = {};
56
- }
57
53
  option = Field_Logic.get_option(DataType.TEMPLATE,option?option:{});
58
54
  let template = DataItem.get_new_full_item(
59
55
  DataItem.get_new(DataType.TEMPLATE,0),
@@ -62,16 +58,13 @@ class Template_Logic {
62
58
  Field_Logic.get_test(title,option));
63
59
  if(option.get_item){
64
60
  template.items = Sub_Item_Logic.get_test_item_list(template,template,option);
61
+ template = Sub_Item_Logic.bind_parent_child_list(template,template.items);
65
62
  }
66
63
  return template;
67
64
  };
68
65
  }
69
66
  class Team_Logic {
70
67
  static get_test = (title,option) =>{
71
- if(!title){
72
- title = "Team "+Number.get_id();
73
- option = {};
74
- }
75
68
  option = Field_Logic.get_option(DataType.TEAM,option?option:{});
76
69
  let team = DataItem.get_new_full_item(
77
70
  DataItem.get_new(DataType.TEAM,0),
@@ -119,18 +112,15 @@ class Team_Logic {
119
112
  }
120
113
  class Page_Logic {
121
114
  static get_test = (title,option) =>{
122
- if(!title){
123
- title = "Page "+ Number.get_id();
124
- option = {};
125
- }
126
115
  option = Field_Logic.get_option(DataType.PAGE,option?option:{});
127
116
  let page = DataItem.get_new_full_item(
128
117
  DataItem.get_new(DataType.PAGE,0),
129
118
  DataItem.get_new(DataType.PAGE,0),
130
119
  DataItem.get_new(DataType.PAGE,0),
131
120
  Field_Logic.get_test(title,option));
132
- if(option.get_item){
121
+ if(option.get_section){
133
122
  page.items = Sub_Item_Logic.get_test_section_list(page,page,option);
123
+ page = Sub_Item_Logic.bind_parent_child_list(page,page.items);
134
124
  }
135
125
  return page;
136
126
  };
@@ -145,10 +135,6 @@ class Page_Logic {
145
135
  }
146
136
  class Product_Logic {
147
137
  static get_test = (title,option) =>{
148
- if(!title){
149
- title = "Product 1";
150
- option = {};
151
- }
152
138
  option = Field_Logic.get_option(DataType.PRODUCT,option?option:{});
153
139
  let product = DataItem.get_new_full_item(
154
140
  DataItem.get_new(DataType.PRODUCT,0),
@@ -191,10 +177,6 @@ class Product_Logic {
191
177
  }
192
178
  class Service_Logic {
193
179
  static get_test = (title,option) =>{
194
- if(!title){
195
- title = "Service 1";
196
- option = {};
197
- }
198
180
  option = Field_Logic.get_option(DataType.SERVICE,option?option:{});
199
181
  let service = DataItem.get_new_full_item(
200
182
  DataItem.get_new(DataType.SERVICE,0),
@@ -237,10 +219,6 @@ class Service_Logic {
237
219
  }
238
220
  class Content_Logic {
239
221
  static get_test = (title,option) =>{
240
- if(!title){
241
- title = "Content 1";
242
- option = {};
243
- }
244
222
  option = Field_Logic.get_option(DataType.CONTENT,option?option:{});
245
223
  let content = DataItem.get_new_full_item(
246
224
  DataItem.get_new(DataType.CONTENT,0),
@@ -249,6 +227,7 @@ class Content_Logic {
249
227
  Field_Logic.get_test(title,option));
250
228
  if(option.get_item){
251
229
  content.items = Sub_Item_Logic.get_test_section_list(content,content,option);
230
+ content = Sub_Item_Logic.bind_parent_child_list(content,content.items);
252
231
  }
253
232
  return content;
254
233
  };
@@ -278,10 +257,6 @@ class Content_Logic {
278
257
  }
279
258
  class Blog_Post_Logic {
280
259
  static get_test = (title,option) =>{
281
- if(!title){
282
- title = "Blog Post 1";
283
- option = {};
284
- }
285
260
  option = Field_Logic.get_option(DataType.BLOG_POST,option?option:{});
286
261
  let blog_post = DataItem.get_new_full_item(
287
262
  DataItem.get_new(DataType.BLOG_POST,0),
@@ -321,10 +296,6 @@ class Blog_Post_Logic {
321
296
  }
322
297
  class Event_Logic {
323
298
  static get_test = (title,option) =>{
324
- if(!title){
325
- title = "Event " + Number.get_id();
326
- option = {};
327
- }
328
299
  option = Field_Logic.get_option(DataType.EVENT,option?option:{});
329
300
  let event = DataItem.get_new_full_item(
330
301
  DataItem.get_new(DataType.EVENT,0),
@@ -371,10 +342,6 @@ class Event_Logic {
371
342
  }
372
343
  class Field_Logic {
373
344
  static get_test = (title,option) =>{
374
- if(!title){
375
- title="";
376
- option={};
377
- }
378
345
  if(!option){
379
346
  option= {};
380
347
  }
@@ -437,6 +404,12 @@ class Field_Logic {
437
404
  if(!option.page_count){
438
405
  option.page_count=9;
439
406
  }
407
+ if(!option.section_count){
408
+ option.section_count=9;
409
+ }
410
+ if(!option.get_section){
411
+ option.get_section=false;
412
+ }
440
413
  }
441
414
  if(option.data_type==DataType.PRODUCT){
442
415
  if(!option.product_count){
@@ -612,10 +585,6 @@ class DataType {
612
585
  }
613
586
  class Blank_Logic {
614
587
  static get_test = (title,option) =>{
615
- if(!title){
616
- title = "Blank " + Number.get_id();
617
- option={};
618
- }
619
588
  option = Field_Logic.get_option(DataType.BLANK,option?option:{});
620
589
  let blank = DataItem.get_new_full_item(
621
590
  DataItem.get_new(DataType.BLANK,0),
@@ -624,6 +593,7 @@ class Blank_Logic {
624
593
  Field_Logic.get_test(title,option));
625
594
  if(option.get_item){
626
595
  blank.items = Sub_Item_Logic.get_test_item_list(blank,blank,option);
596
+ blank = Sub_Item_Logic.bind_parent_child_list(blank,blank.items);
627
597
  }
628
598
  return blank;
629
599
  };
@@ -653,10 +623,6 @@ class Blank_Logic {
653
623
  }
654
624
  class Faq_Logic {
655
625
  static get_test = (title,option) =>{
656
- if(!title){
657
- title = "Faq " + Number.get_id();
658
- option={};
659
- }
660
626
  option = Field_Logic.get_option(DataType.FAQ,option?option:{});
661
627
  option.get_value = false;
662
628
  let faq = DataItem.get_new_full_item(
@@ -735,10 +701,6 @@ class Business_Logic {
735
701
  });
736
702
  };
737
703
  static get_test = (title,option) =>{
738
- if(!title){
739
- title="Business "+Number.get_id();
740
- option={};
741
- }
742
704
  option = Field_Logic.get_option(DataType.BUSINESS,option?option:{});
743
705
  Log.w('option',option);
744
706
  let item = DataItem.get_new(DataType.BUSINESS,0);
@@ -966,9 +928,6 @@ class Team_Url {
966
928
  };
967
929
  }
968
930
  class Url{
969
- static get_search = (data_type,filter,sort_by,page_current,page_size) => {
970
- return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
971
- };
972
931
  static copy_item = (biz9_config,data_type,id) => {
973
932
  let action_url = "main/crud/copy/"+data_type + "/" + id;
974
933
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,null);
@@ -1018,8 +977,8 @@ class Url{
1018
977
  };
1019
978
  }
1020
979
  class Obj {
1021
- static get_data_param = (biz9_config,data_type,filter,sort_by,page_current,page_size) => {
1022
- return get_cloud_filter_obj_main(data_type,filter,sort_by,page_current,page_size);
980
+ static get_search = (biz9_config,data_type,filter,sort_by,page_current,page_size) => {
981
+ return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
1023
982
  }
1024
983
  };
1025
984
  class Category_Logic {
@@ -1056,7 +1015,7 @@ class Category_Logic {
1056
1015
  DataItem.get_new(DataType.CATEGORY,0),
1057
1016
  DataItem.get_new(DataType.CATEGORY,0),
1058
1017
  Field_Logic.get_test("Category " +String(parseInt(a+1)),option));
1059
- category.type = type;
1018
+ category.type = type;
1060
1019
  category_list.push(category);
1061
1020
  }
1062
1021
  return category_list;
@@ -1405,6 +1364,13 @@ class Sub_Item_Logic {
1405
1364
  }
1406
1365
  return new_list;
1407
1366
  }
1367
+
1368
+ static bind_parent_child_list(item,item_list){
1369
+ for(let a=0;a<item_list.length;a++){
1370
+ item[Str.get_title_url(item_list[a].title)] = item_list[a];
1371
+ }
1372
+ return item;
1373
+ }
1408
1374
  }
1409
1375
  module.exports = {
1410
1376
  Business_Logic,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.8.19",
3
+ "version": "4.8.22",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/test.js CHANGED
@@ -59,7 +59,7 @@ describe("connect", () => {
59
59
 
60
60
 
61
61
  /* --SEARCH--START */
62
- console.log(Url.get_search(DataType.BLOG_POST,{title:-1},{cool:-1},1,10));
62
+ //console.log(Url.get_search(DataType.BLOG_POST,{title:-1},{cool:-1},1,10));
63
63
  /* --SEARCH--END */
64
64
 
65
65
  /* --CATEGORY--START */
@@ -147,8 +147,8 @@ describe("connect", () => {
147
147
  /* --PAGE--START */
148
148
  //let page = Page_Logic.get_test()
149
149
  //let page = Page_Logic.get_test("Page "+Number.get_id())
150
- //let page = Page_Logic.get_test("Page "+Number.get_id(),{get_value:true,value_count:5,get_item:true})
151
- //Log.w("page",page);
150
+ let page = Page_Logic.get_test("Page "+Number.get_id(),{get_value:true,value_count:5,get_section:true})
151
+ Log.w("page",page);
152
152
  //let page_list = Page_Logic.get_test_list({page_count:10});
153
153
  //Log.w("Page_list",page_list);
154
154
  /*