biz9-logic 3.0.15 → 3.0.17

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='3.1.5'
1
+ VERSION='3.1.7'
2
2
  TITLE='BiZ9-Logic';
3
3
  REPO='git@github.com:biz9framework/biz9-logic.git';
4
4
  BRANCH='main';
package/index.js CHANGED
@@ -84,12 +84,28 @@ class Url {
84
84
  let action_url= "main/crud/get_list/"+data_type;
85
85
  return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
86
86
  };
87
+ static update_list = (biz9_config,data_type) => {
88
+ let action_url= "main/crud/update_list/"+data_type;
89
+ return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
90
+ };
87
91
  static delete_list = (biz9_config,data_type) => {
88
92
  let action_url= "main/crud/delete_list/"+data_type;
89
93
  return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
90
94
  };
91
- static update_list = (biz9_config,data_type) => {
92
- let action_url= "main/crud/update_list/"+data_type;
95
+ static get_biz_item = (biz9_config,data_type,id) => {
96
+ let action_url= "main/biz_item/get/"+data_type + "/" + id;
97
+ return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
98
+ };
99
+ static delete_biz_item = (biz9_config,data_type,id) => {
100
+ let action_url= "main/biz_item/delete/"+data_type + "/" + id;
101
+ return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
102
+ };
103
+ static get_biz_list = (biz9_config,data_type) => {
104
+ let action_url= "main/biz_item/get_list/"+data_type;
105
+ return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
106
+ };
107
+ static delete_biz_list = (biz9_config,data_type) => {
108
+ let action_url= "main/biz_item/delete_list/"+data_type;
93
109
  return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
94
110
  };
95
111
  }
package/main.js CHANGED
@@ -26,11 +26,8 @@ const get_cloud_url_main = (app_title_id,domain_url,action_url,params) =>{
26
26
  }
27
27
  const get_biz_item_main=(biz9_config,item,options) =>{
28
28
  //option
29
- //get_photo = true
30
- //get_date = true
31
29
  //get_count = true
32
30
  //get_biz_map = true
33
- //
34
31
  if(options.get_count){
35
32
  if(!item.view_count){
36
33
  item.view_count='0';
@@ -42,31 +39,6 @@ const get_biz_item_main=(biz9_config,item,options) =>{
42
39
  item.review_count='0';
43
40
  }
44
41
  }
45
- //photo setting - start
46
- if(options.get_photo){
47
- //photo
48
- if(!item.photofilename){
49
- item.photofilename=null;
50
- }
51
- let no_photo_str='/images/no_image.png';
52
- let _photo_size_thumb='thumb_size_';
53
- let _photo_size_mid='mid_size_';
54
- let _photo_size_large='large_size_';
55
- let _photo_size_square_thumb='square_thumb_size_';
56
- let _photo_size_square_mid='square_mid_size_';
57
- let _photo_size_square_large='square_large_size_';
58
- item.photo_obj={
59
- album_url : (item.photofilename) ? biz9_config.PHOTO_URL+item.photofilename : no_photo_str,
60
- thumb_url : (item.photofilename) ? biz9_config.PHOTO_URL+_photo_size_thumb+item.photofilename : no_photo_str,
61
- mid_url : (item.photofilename) ? biz9_config.PHOTO_URL+_photo_size_mid+item.photofilename : no_photo_str,
62
- large_url : (item.photofilename) ? biz9_config.PHOTO_URL+_photo_size_large+item.photofilename : no_photo_str,
63
- thumb_url : (item.photofilename) ? biz9_config.PHOTO_URL+_photo_size_thumb+item.photofilename : no_photo_str,
64
- square_thumb_url : (item.photofilename) ? biz9_config.PHOTO_URL+_photo_size_square_thumb+item.photofilename : no_photo_str,
65
- square_mid_url : (item.photofilename) ? biz9_config.PHOTO_URL+_photo_size_square_thumb+item.photofilename : no_photo_str,
66
- square_large_url : (item.photofilename) ? biz9_config.PHOTO_URL+_photo_size_square_thumb+item.photofilename : no_photo_str,
67
- };
68
- }
69
- //photo setting - end
70
42
  //date setting - start
71
43
  if(options.get_date){
72
44
  let no_date_str='';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biz9-logic",
3
- "version": "3.0.15",
3
+ "version": "3.0.17",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
package/test.js CHANGED
@@ -1,8 +1,8 @@
1
1
  const path = require('path');
2
2
  const series = require('async-series');
3
- const {Item,DataType,Url,Obj} = require('./');
3
+ const { Item,DataType,Url,Obj } = require('./');
4
4
  const {Log,Test} = require('biz9-utility');
5
- const { Scriptz }= require('biz9-scriptz');
5
+ const { Scriptz }= require('biz9-scriptz');
6
6
 
7
7
  /* --- TEST CONFIG START --- */
8
8
  //const ID='0';
@@ -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-BIZ9-GET-DATA-TYPE-START');
33
34
  console.log(DataType.get_data_type_title(DataType.DT_CART_ITEM));
@@ -53,7 +54,7 @@ describe("connect", () => {
53
54
  function(call) {
54
55
  console.log('GET-URL-START');
55
56
  let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
56
- let action_url = 'test_get_url_action';
57
+ let action_url = 'test_get_url';
57
58
  let params = '&myparam1=p1&myparam2=p2'
58
59
  let cloud_url = Url.get(biz9_config,action_url,params);
59
60
  Log.w('connect_url',cloud_url);
@@ -63,66 +64,66 @@ describe("connect", () => {
63
64
  function(call) {
64
65
  console.log('CONNECT-START');
65
66
  let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
66
- let cloud_url = Url.get_action_connect(biz9_config);
67
+ let cloud_url = Url.connect(biz9_config);
67
68
  Log.w('connect_url',cloud_url);
68
69
  console.log('CONNECT-SUCCESS');
69
70
  call()
70
71
  },
71
72
  function(call) {
72
- console.log('GET_URL-ACTION-UPDATE-ITEM-START');
73
+ console.log('GET_URL-UPDATE-ITEM-START');
73
74
  let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
74
75
  let data_type = 'dt_blank';
75
76
  let id = 0;
76
- let cloud_url = Url.get_action_update_item(biz9_config,data_type,id);
77
- Log.w('get_url_action_update_item',cloud_url);
78
- console.log('GET_URL-ACTION-UPDATE-ITEM-SUCCESS');
77
+ let cloud_url = Url.update_item(biz9_config,data_type,id);
78
+ Log.w('get_url_update_item',cloud_url);
79
+ console.log('GET_URL-UPDATE-ITEM-SUCCESS');
79
80
  call()
80
81
  },
81
82
  function(call) {
82
- console.log('GET_URL-ACTION-GET-ITEM-START');
83
+ console.log('GET_URL-GET-ITEM-START');
83
84
  let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
84
85
  let data_type = 'dt_blank';
85
86
  let id = 0;
86
- let cloud_url = Url.get_action_get_item(biz9_config,data_type,id);
87
- Log.w('get_url_action_get_item',cloud_url);
88
- console.log('GET_URL-ACTION-GET-ITEM-SUCCESS');
87
+ let cloud_url = Url.get_item(biz9_config,data_type,id);
88
+ Log.w('get_url_get_item',cloud_url);
89
+ console.log('GET_URL-GET-ITEM-SUCCESS');
89
90
  call()
90
91
  },
91
92
  function(call) {
92
- console.log('GET_URL-ACTION-DELETE-ITEM-START');
93
+ console.log('GET_URL-DELETE-ITEM-START');
93
94
  let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
94
95
  let data_type = 'dt_blank';
95
96
  let id = 0;
96
- let cloud_url = Url.get_action_delete_item(biz9_config,data_type,id);
97
- Log.w('get_url_action_delete_item',cloud_url);
98
- console.log('GET_URL-ACTION-DELETE-ITEM-SUCCESS');
97
+ let cloud_url = Url.delete_item(biz9_config,data_type,id);
98
+ Log.w('get_url_delete_item',cloud_url);
99
+ console.log('GET_URL-DELETE-ITEM-SUCCESS');
99
100
  call()
100
101
  },
101
102
  function(call) {
102
- console.log('GET_URL-ACTION-GET-LIST-ITEM-START');
103
+ console.log('GET_URL-GET-LIST-ITEM-START');
103
104
  let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
104
105
  let data_type = 'dt_blank';
105
- let cloud_url = Url.get_action_get_list(biz9_config,data_type);
106
- Log.w('get_url_action_get_list_item',cloud_url);
107
- console.log('GET_URL-ACTION-GET-LIST-ITEM-SUCCESS');
106
+ let cloud_url = Url.get_list(biz9_config,data_type);
107
+ Log.w('get_url_get_list',cloud_url);
108
+ console.log('GET_URL-GET-LIST-ITEM-SUCCESS');
108
109
  call()
109
110
  },
110
111
  function(call) {
111
- console.log('GET_URL-ACTION-DELETE-LIST-ITEM-START');
112
+ console.log('GET_URL-DELETE-LIST-ITEM-START');
112
113
  let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
113
114
  let data_type = 'dt_blank';
114
- let cloud_url = Url.get_action_delete_list(biz9_config,data_type);
115
- Log.w('get_url_action_delete_list_item',cloud_url);
116
- console.log('GET_URL-ACTION-DELETE-LIST-ITEM-SUCCESS');
115
+ let cloud_url = Url.delete_list(biz9_config,data_type);
116
+ Log.w('get_url_delete_list_item',cloud_url);
117
+ console.log('GET_URL-DELETE-LIST-ITEM-SUCCESS');
117
118
  call()
118
119
  },
119
120
  function(call) {
120
- console.log('GET_URL-ACTION-UPDATE-LIST-ITEM-START');
121
+ console.log('GET_URL-UPDATE-LIST-ITEM-START');
121
122
  let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
122
123
  let data_type = 'dt_blank';
123
- let cloud_url = Url.get_action_update_list(biz9_config,data_type);
124
- Log.w('get_url_action_update_list_item',cloud_url);
125
- console.log('GET_URL-ACTION-UPDATE-LIST-ITEM-SUCCESS');
124
+ let cloud_url = Url.update_list(biz9_config,data_type);
125
+ Log.w('get_url_update_list_item',cloud_url);
126
+ console.log('GET_URL-UPDATE-LIST-ITEM-SUCCESS');
126
127
  call()
127
128
  },
128
129
  function(call) {
@@ -133,7 +134,7 @@ describe("connect", () => {
133
134
  let page_current = 0;
134
135
  let page_size = 15;
135
136
  let filter_obj = Obj.get_filter(data_type,filter,sort_by,page_current,page_size);
136
- Log.w('get_url_action_filter_obj',filter_obj);
137
+ Log.w('get_filter_obj',filter_obj);
137
138
  console.log('GET_FILTER-OBJECT-SUCCESS');
138
139
  call()
139
140
  },
@@ -154,11 +155,22 @@ describe("connect", () => {
154
155
  item_test.value_2 = 'my_value_2';
155
156
  item_test.field_3 = 'my_field_3';
156
157
  item_test.value_3 = 'my_value_3';
157
- let item_biz = Item.get_biz(biz9_config,item_test,{get_photo:true,get_date:true,get_count:true,get_biz_map:true});
158
+ let item_biz = Item.get_biz(biz9_config,item_test,{get_date:true,get_count:true,get_biz_map:true});
158
159
  console.log(item_biz);
159
160
  console.log('SET-ITEM-BIZ-SUCCESS');
160
161
  call();
161
162
  },
163
+ */
164
+ function(call) {
165
+ console.log('GET_URL-BIZ-ITEM-START');
166
+ let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
167
+ let data_type = 'dt_blank';
168
+ //let cloud_url = Url.get_biz_item(biz9_config,data_type,ID);
169
+ let cloud_url = Url.delete_biz_item(biz9_config,data_type,ID);
170
+ Log.w('get_url_biz_item',cloud_url);
171
+ console.log('GET_URL-BIZ-ITEM-SUCCESS');
172
+ call()
173
+ },
162
174
  function(call) {
163
175
  // never happens, because "second thing"
164
176
  // passed an error to the done() callback