biz9-logic 4.8.131 → 4.8.135

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 +96 -30
  3. package/package.json +1 -1
  4. package/test.js +11 -4
package/biz9_config CHANGED
@@ -1,4 +1,4 @@
1
- VERSION='6.1.1'
1
+ VERSION='6.1.5'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
package/index.js CHANGED
@@ -4,8 +4,7 @@ Author: certifiedcoderz@gmail.com (Certified CoderZ)
4
4
  License GNU General Public License v3.0
5
5
  Description: BiZ9 Framework: Logic-JS
6
6
  */
7
- const moment = require('moment');
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');
7
+ const moment = require('moment'); 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
8
  const { Log,Str,DateTime,Number,Obj } = require('/home/think2/www/doqbox/biz9-framework/biz9-utility/code');
10
9
  class Message {
11
10
  static SUCCESS="Update Success";
@@ -19,8 +18,6 @@ class TemplateType {
19
18
  static BODY='body';
20
19
  static FOOTER='footer';
21
20
  }
22
-
23
-
24
21
  class Item_Logic {
25
22
  static get_test = (title,data_type,id,option)=>{
26
23
  data_type = data_type ? data_type : DataType.BLANK;
@@ -48,6 +45,9 @@ class Item_Logic {
48
45
  static get_search = (data_type,filter,sort_by,page_current,page_size) => {
49
46
  return {data_type:data_type,filter:filter,sort_by:sort_by,page_current:page_current,page_size:page_size};
50
47
  }
48
+ static get_note = () => {
49
+ return "Note "+String(Number.get_id()) + " Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
50
+ }
51
51
  static get_search_query(search){
52
52
  let url = "";
53
53
  if(search.data_type){
@@ -98,6 +98,14 @@ class Item_Logic {
98
98
  }
99
99
  }
100
100
  class Stat_Logic {
101
+ /*
102
+ static STAT_VIEW_ADD_ID='1';
103
+ static STAT_LIKE_ADD_ID='2';
104
+ static STAT_FAVORITE_ADD_ID='3';
105
+ static STAT_CART_ADD_ID='4';
106
+ static STAT_ORDER_ADD_ID='5';
107
+ static STAT_REVIEW_ADD_ID='6';
108
+ */
101
109
  static get_new = (parent_data_type,user_id,stat_type_id,item_list,option)=>{
102
110
  return {
103
111
  parent_data_type:parent_data_type,
@@ -592,8 +600,7 @@ class Field_Logic {
592
600
  static get_test = (title,option) =>{
593
601
  option = !Obj.check_is_empty(option) ? option : {};
594
602
  let sub_note = "Sub Note "+String(Number.get_id());
595
- let note = "Note "+String(Number.get_id()) + " Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
596
- if(option.get_blank == true){
603
+ if(option.get_blank == true){
597
604
  date_create:"";
598
605
  date_save:"";
599
606
  title = "";
@@ -606,7 +613,7 @@ class Field_Logic {
606
613
  setting_visible:"1",
607
614
  title_url:Str.get_title_url(title),
608
615
  sub_note:sub_note,
609
- note:note,
616
+ note:Item_Logic.get_note(),
610
617
  view_count:0,
611
618
  id:0,
612
619
  date_create:new moment().toISOString(),
@@ -784,6 +791,9 @@ class Field_Logic {
784
791
  option.category_event_count = req.query.category_event_count ? req.query.category_event_count : 9;
785
792
  option.event_count = req.query.event_count ? req.query.event_count : 9;
786
793
 
794
+ option.get_product_review = req.query.get_product_review ? req.query.get_product_review : false;
795
+ option.product_review_count = req.query.product_review_count ? req.query.product_review_count : 19;
796
+
787
797
  option.user_count = req.query.user_count ? req.query.user_count : 9;
788
798
  option.get_admin = req.query.get_admin ? req.query.get_admin : false;
789
799
  option.get_business = req.query.get_business ? req.query.get_business : false;
@@ -792,6 +802,7 @@ class Field_Logic {
792
802
  option.get_page = req.query.get_page ? req.query.get_page : false;
793
803
  option.get_team = req.query.get_team ? req.query.get_team : false;
794
804
 
805
+
795
806
  return option;
796
807
  }
797
808
 
@@ -1068,33 +1079,87 @@ class Faq_Logic {
1068
1079
  return item_list;
1069
1080
  }
1070
1081
  }
1082
+ class Favorite_Logic {
1083
+ static get_new = (parent_data_type,parent_id,user_id,option) =>{
1084
+ option = Field_Logic.get_option(DataType.FAVORITE,option?option:{});
1085
+ let favorite = DataItem.get_new(DataType.FAVORITE,0,{
1086
+ parent_data_type:parent_data_type,
1087
+ parent_id:parent_id,
1088
+ user_id:user_id,
1089
+ });
1090
+ return favorite;
1091
+ }
1092
+ static get_user_search_filter = (parent_data_type,user_id) =>{
1093
+ return {
1094
+ $and: [
1095
+ { parent_data_type: { $regex:parent_data_type, $options: "i" } },
1096
+ { user_id: { $regex:user_id, $options: "i" } }
1097
+ ] };
1098
+ }
1099
+ static get_search_filter = (parent_data_type,parent_id,user_id) =>{
1100
+ return {
1101
+ $and: [
1102
+ { parent_data_type: { $regex:parent_data_type, $options: "i" } },
1103
+ { parent_id: { $regex:parent_id, $options: "i" } },
1104
+ { user_id: { $regex:user_id, $options: "i" } }
1105
+ ] };
1106
+ }
1107
+ }
1071
1108
  class Review_Logic {
1072
- static get_test = () =>{
1073
- let city_list = ["Miami","Atlanta","Chicago","Seattle","New York City"];
1074
- let state_list = ["Georgia","New York","Illinois","Washington","Flordia"];
1075
- let review = DataItem.get_new_full_item(
1076
- DataItem.get_new(DataType.REVIEW,Number.get_id()),
1077
- DataItem.get_new(DataType.REVIEW,0),
1078
- DataItem.get_new(DataType.REVIEW,0),
1079
- Field_Logic.get_test("Review "+Number.get_id(),{get_value:false}));
1109
+ static get_new = (parent_data_type,parent_id,user_id,review) =>{
1110
+ if(!review){
1111
+ review = {};
1112
+ }
1113
+ return DataItem.get_new(DataType.REVIEW,0,{
1114
+ parent_data_type:parent_data_type,
1115
+ parent_id:parent_id,
1116
+ user_id:user_id,
1117
+ comment:review.comment ? review.comment : "",
1118
+ email:review.email ? review.email : "",
1119
+ first_name:review.first_name ? review.first_name : "",
1120
+ last_name:review.last_name ? review.last_name : "",
1121
+ title:review.title ? review.title : "",
1122
+ hometown:review.hometown ? review.hometown : "",
1123
+ position:review.position ? review.position : "",
1124
+ rating:review.rating ? review.rating : ""
1125
+ });
1126
+ }
1127
+ static get_search_filter = (parent_data_type,parent_id) =>{
1128
+ return {
1129
+ $and: [
1130
+ { parent_data_type: { $regex:parent_data_type, $options: "i" } },
1131
+ { parent_id: { $regex:parent_id, $options: "i" } },
1132
+ ] };
1133
+ }
1134
+ static get_test = (parent_data_type,parent_id,user_id,option) =>{
1135
+ option = Field_Logic.get_option(DataType.REVIEW,option?option:{});
1136
+ let review = DataItem.get_new(DataType.REVIEW,0);
1137
+ if(option.generate_id){
1138
+ review.id = Number.get_id();
1139
+ }
1080
1140
  review.email="ceo@biz"+String(Number.get_id())+".com";
1141
+ review.title="Review " + Number.get_id()+ Number.get_id();
1081
1142
  review.first_name="First Name "+ Number.get_id();
1082
1143
  review.last_name="Last Name "+ Number.get_id();
1083
1144
  review.hometown="Hometown "+ Number.get_id();
1084
1145
  review.position="Position "+ Number.get_id();
1085
- review.rating=parseInt(Number.get_id(6)+1);
1086
- review.comment="My comment "+ Number.get_id() + "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
1146
+ review.rating=Number.get_id(6);
1147
+ review.user_id=user_id;
1148
+ review.parent_data_type=parent_data_type;
1149
+ review.parent_id=parent_id;
1150
+ review.comment="My comment "+ Item_Logic.get_note();
1087
1151
  return review;
1088
1152
  };
1089
1153
  static get_test_list=(option)=>{
1090
1154
  option = !Obj.check_is_empty(option) ? option : {review_count:19};
1091
1155
  let item_list = [];
1092
1156
  for(let a=0;a<option.review_count;a++){
1093
- item_list.push(Review_Logic.get_test());
1157
+ item_list.push(Review_Logic.get_test(option));
1094
1158
  }
1095
1159
  return item_list;
1096
1160
  };
1097
1161
  }
1162
+
1098
1163
  class Admin_Logic {
1099
1164
  static get_new = (title,option) =>{
1100
1165
  [title,option] = Field_Logic.get_option_title(title,option);
@@ -1336,11 +1401,7 @@ class Product_Url {
1336
1401
  }
1337
1402
  class Review_Url {
1338
1403
  static update = (biz9_config,parent_data_type,parent_id,user_id,params) => {
1339
- let action_url="review/"+parent_data_type+"/"+parent_id+"/"+user_id;
1340
- return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
1341
- };
1342
- static search = (biz9_config,parent_data_type,parent_id,params) => {
1343
- let action_url="review/"+parent_data_type+"/"+parent_id;
1404
+ let action_url="review/update/"+parent_data_type+"/"+parent_id+"/"+user_id;
1344
1405
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
1345
1406
  };
1346
1407
  }
@@ -1417,16 +1478,18 @@ class Gallery_Url {
1417
1478
  };
1418
1479
  }
1419
1480
  class User_Url {
1420
- static favorite = (biz9_config,user_id,params) => {
1421
- let action_url="user/favorite/"+user_id;
1481
+ static search = (biz9_config,params) => {
1482
+ let action_url="user/search";
1422
1483
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
1423
1484
  };
1424
- static favorite_update = (biz9_config,parent_data_type,parent_id,user_id,params) => {
1425
- let action_url="user/favorite/"+parent_data_type+"/"+parent_id +"/"+user_id;
1485
+ }
1486
+ class Favorite_Url {
1487
+ static get = (biz9_config,parent_data_type,user_id,page_current,page_size,params) => {
1488
+ let action_url="favorite/get/"+parent_data_type+"/"+user_id+"/"+page_current+"/"+page_size;
1426
1489
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
1427
1490
  };
1428
- static search = (biz9_config,params) => {
1429
- let action_url="user/search";
1491
+ static update = (biz9_config,parent_data_type,parent_id,user_id,params) => {
1492
+ let action_url="favorite/update/"+parent_data_type+"/"+parent_id +"/"+user_id;
1430
1493
  return get_cloud_url_main(biz9_config.APP_ID,biz9_config.URL,action_url,params);
1431
1494
  };
1432
1495
  }
@@ -1929,7 +1992,7 @@ class Sub_Item_Logic {
1929
1992
  title:item_title,
1930
1993
  title_url:Str.get_title_url(item_title),
1931
1994
  sub_note:"Sub Note "+String(Number.get_id()),
1932
- note:"Note "+String(Number.get_id()),
1995
+ note:Item_Logic.get_note()
1933
1996
  }
1934
1997
  );
1935
1998
  if(option.get_value){
@@ -1980,6 +2043,7 @@ module.exports = {
1980
2043
  Blog_Post_Logic,
1981
2044
  Blog_Post_Url,
1982
2045
  Cart_Logic,
2046
+ Cart_Url,
1983
2047
  Category_Logic,
1984
2048
  Category_Url,
1985
2049
  Content_Url,
@@ -1992,6 +2056,8 @@ module.exports = {
1992
2056
  Field_Logic,
1993
2057
  FieldType,
1994
2058
  Faq_Logic,
2059
+ Favorite_Logic,
2060
+ Favorite_Url,
1995
2061
  Gallery_Url,
1996
2062
  Item_Logic,
1997
2063
  Event_Logic,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "4.8.131",
3
+ "version": "4.8.135",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/test.js CHANGED
@@ -205,6 +205,7 @@ describe("connect", () => {
205
205
  /* --SERVICE--END */
206
206
 
207
207
 
208
+ /*
208
209
  console.log('PRODUCT-START');
209
210
 
210
211
  console.log('PRODUCT-CART-START');
@@ -231,7 +232,8 @@ describe("connect", () => {
231
232
  //Log.w('product_cart_item_list',product_order.order_item_list.length);
232
233
  //Log.w('product_cart_item_list_len',product_order.order_item_list[0].order_sub_item_list.length);
233
234
  //Log.w('product_order',product_order.order_item_list[0].order_sub_item_list.length);
234
- console.log('PRODUCT-CART-END');
235
+ //console.log('PRODUCT-CART-END');
236
+ */
235
237
 
236
238
  /*
237
239
  console.log('PRODUCT-ORDER-START');
@@ -358,15 +360,20 @@ describe("connect", () => {
358
360
 
359
361
 
360
362
  /* --REVIEW--START */
361
- //Log.w("Review",Review.get_test());
362
- //Log.w("Review List",Review_Logic.get_test_list());
363
+ //console.log('REVIEW-START');
364
+ //let parent_data_type = DataType.PRODUCT;
365
+ //let parent_id = Number.get_id();
366
+ //let user_id = Number.get_id();
367
+ //Log.w("Review",Review_Logic.get_new(parent_data_type,parent_id,user_id));
368
+ //Log.w("Review",Review_Logic.get_test({generate_id:true}));
369
+ //Log.w("Review List",Review_Logic.get_test_list({generate_id:true,review_count:3}));
363
370
  /*
364
371
  let review_list = Review.get_test_list({review_count:3,get_item:true})
365
372
  Log.w("Review List",review_list);
366
373
  */
374
+ //console.log('REVIEW-END');
367
375
  /* --REVIEW--END */
368
376
 
369
-
370
377
  /* --BUSINESS--START */
371
378
  //Log.w("Business",Business_Logic.get_test("Business " + Number.get_id()));
372
379
  //Log.w("Business",Business_Logic.get_test());