biz9-logic 3.0.10 → 3.0.13
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 +87 -64
- package/package.json +1 -1
- package/test.js +15 -13
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -8,76 +8,99 @@ const { get_new_item_main,get_data_config_main,get_cloud_url_main,get_biz_item_m
|
|
|
8
8
|
const {Log,Test,Str} = require('biz9-utility');
|
|
9
9
|
|
|
10
10
|
class DataType {
|
|
11
|
-
|
|
11
|
+
static get_data_type_title = (data_type) => {
|
|
12
12
|
if(!data_type){
|
|
13
13
|
return "";
|
|
14
14
|
}else{
|
|
15
|
-
|
|
15
|
+
return String(Str.get_title(data_type.replaceAll('_',' ').replaceAll('dt','').replace('biz',''))).trim();
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
18
|
+
static ID = 'id';
|
|
19
|
+
static DATA_TYPE = 'data_type';
|
|
20
|
+
static TITLE = 'title';
|
|
21
|
+
static TITLE_URL = 'title_url';
|
|
22
|
+
static COST = 'cost';
|
|
23
|
+
static NOTE = 'note';
|
|
24
|
+
static SUB_NOTE = 'sub_note';
|
|
25
|
+
static ORDER = 'order';
|
|
26
|
+
static VISIBLE = 'visible';
|
|
27
|
+
static PHOTOFILENAME = 'photofilename';
|
|
28
|
+
static SETTING_SORT_TYPE = 'setting_sort_type';
|
|
29
|
+
static SETTING_SORT_ORDER = 'setting_sort_order';
|
|
30
|
+
static DELETE_PROTECTION = 'delete_protection';
|
|
31
|
+
static TOP_ID = 'top_id';
|
|
32
|
+
static TOP_DATA_TYPE = 'top_data_type';
|
|
33
|
+
static PARENT_ID = 'parent_id';
|
|
34
|
+
static PARENT_DATA_TYPE = 'parent_data_type';
|
|
35
|
+
static DT_ADMIN='admin_biz';
|
|
36
|
+
static DT_BLANK='blank_biz';
|
|
37
|
+
static DT_BLOG_POST='blog_post_biz';
|
|
38
|
+
static DT_CART_ITEM="cart_item_biz";
|
|
39
|
+
static DT_CATEGORY='category_biz';
|
|
40
|
+
static DT_EVENT='event_biz';
|
|
41
|
+
static DT_GALLERY='gallery_biz';
|
|
42
|
+
static DT_ITEM_MAP='item_map_biz';
|
|
43
|
+
static DT_ITEM='item_biz';
|
|
44
|
+
static DT_ORDER="order_biz";
|
|
45
|
+
static DT_ORDER_ITEM="order_item_biz";
|
|
46
|
+
static DT_PROJECT='project_biz';
|
|
47
|
+
static DT_PRODUCT='product_biz';
|
|
48
|
+
static DT_PHOTO='photo_biz';
|
|
49
|
+
static DT_PAGE='page_biz';
|
|
50
|
+
static DT_REVIEW='review_biz';
|
|
51
|
+
static DT_SERVICE='service_biz';
|
|
52
|
+
static DT_USER='user_biz';
|
|
53
|
+
static DT_VIDEO='video_biz';
|
|
37
54
|
}
|
|
38
|
-
class
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
55
|
+
class Item {
|
|
56
|
+
static get_new = (data_type,id) => {
|
|
57
|
+
return get_new_item_main(data_type,id);
|
|
58
|
+
};
|
|
59
|
+
static get_biz = (biz9_config,item,options)=>{
|
|
60
|
+
return get_biz_item_main(biz9_config,item,options);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
class Url {
|
|
64
|
+
static get = (biz9_config,action_url,params)=>{
|
|
65
|
+
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,params);
|
|
66
|
+
}
|
|
67
|
+
static get_action_connect = (biz9_config) => {
|
|
68
|
+
let action_url= "main/test/connect/";
|
|
69
|
+
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
70
|
+
};
|
|
71
|
+
static get_action_update_item = (biz9_config,data_type,id) => {
|
|
72
|
+
let action_url= "main/crud/update/"+data_type + "/" + id;
|
|
73
|
+
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
74
|
+
};
|
|
75
|
+
static get_action_get_item = (biz9_config,data_type,id) => {
|
|
76
|
+
let action_url= "main/crud/get/"+data_type + "/" + id;
|
|
77
|
+
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
78
|
+
};
|
|
79
|
+
static get_action_delete_item = (biz9_config,data_type,id) => {
|
|
80
|
+
let action_url= "main/crud/delete/"+data_type + "/" + id;
|
|
81
|
+
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
82
|
+
};
|
|
83
|
+
static get_action_get_list = (biz9_config,data_type) => {
|
|
84
|
+
let action_url= "main/crud/get_list/"+data_type;
|
|
85
|
+
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
86
|
+
};
|
|
87
|
+
static get_action_delete_list = (biz9_config,data_type) => {
|
|
88
|
+
let action_url= "main/crud/delete_list/"+data_type;
|
|
89
|
+
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
90
|
+
};
|
|
91
|
+
static get_action_update_list = (biz9_config,data_type) => {
|
|
92
|
+
let action_url= "main/crud/update_list/"+data_type;
|
|
93
|
+
return get_cloud_url_main(biz9_config.APP_TITLE_ID,biz9_config.URL,action_url,null);
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
class Obj {
|
|
97
|
+
static get_filter = (biz9_config,data_type,filter,sort_by,page_current,page_size)=>{
|
|
98
|
+
return get_cloud_filter_obj_main(data_type,filter,sort_by,page_current,page_size);
|
|
99
|
+
}
|
|
79
100
|
};
|
|
80
101
|
module.exports = {
|
|
81
|
-
|
|
82
|
-
|
|
102
|
+
DataType,
|
|
103
|
+
Item,
|
|
104
|
+
Url,
|
|
105
|
+
Obj
|
|
83
106
|
};
|
package/package.json
CHANGED
package/test.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const series = require('async-series');
|
|
3
|
-
const {
|
|
3
|
+
const {Item,DataType,Url,Obj} = require('./');
|
|
4
4
|
const {Log,Test} = require('biz9-utility');
|
|
5
5
|
const { Scriptz }= require('biz9-scriptz');
|
|
6
6
|
|
|
@@ -31,7 +31,10 @@ describe("connect", () => {
|
|
|
31
31
|
function(call) {
|
|
32
32
|
console.log('GET-BIZ9-GET-DATA-TYPE-START');
|
|
33
33
|
console.log(DataType.get_data_type_title(DataType.DT_CART_ITEM));
|
|
34
|
+
console.log(DataType.ID);
|
|
35
|
+
console.log(DataType.TITLE);
|
|
34
36
|
console.log('GET-BIZ9-GET-DATA-TYPE-END');
|
|
37
|
+
call();
|
|
35
38
|
},
|
|
36
39
|
function(call) {
|
|
37
40
|
console.log('GET-BIZ9-CONFIG-FILE-START');
|
|
@@ -52,7 +55,7 @@ describe("connect", () => {
|
|
|
52
55
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
53
56
|
let action_url = 'test_get_url_action';
|
|
54
57
|
let params = '&myparam1=p1&myparam2=p2'
|
|
55
|
-
let cloud_url =
|
|
58
|
+
let cloud_url = Url.get(biz9_config,action_url,params);
|
|
56
59
|
Log.w('connect_url',cloud_url);
|
|
57
60
|
console.log('GET-URL-SUCCESS');
|
|
58
61
|
call()
|
|
@@ -60,7 +63,7 @@ describe("connect", () => {
|
|
|
60
63
|
function(call) {
|
|
61
64
|
console.log('CONNECT-START');
|
|
62
65
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
63
|
-
let cloud_url =
|
|
66
|
+
let cloud_url = Url.get_action_connect(biz9_config);
|
|
64
67
|
Log.w('connect_url',cloud_url);
|
|
65
68
|
console.log('CONNECT-SUCCESS');
|
|
66
69
|
call()
|
|
@@ -70,7 +73,7 @@ describe("connect", () => {
|
|
|
70
73
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
71
74
|
let data_type = 'dt_blank';
|
|
72
75
|
let id = 0;
|
|
73
|
-
let cloud_url =
|
|
76
|
+
let cloud_url = Url.get_action_update_item(biz9_config,data_type,id);
|
|
74
77
|
Log.w('get_url_action_update_item',cloud_url);
|
|
75
78
|
console.log('GET_URL-ACTION-UPDATE-ITEM-SUCCESS');
|
|
76
79
|
call()
|
|
@@ -80,7 +83,7 @@ describe("connect", () => {
|
|
|
80
83
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
81
84
|
let data_type = 'dt_blank';
|
|
82
85
|
let id = 0;
|
|
83
|
-
let cloud_url =
|
|
86
|
+
let cloud_url = Url.get_action_get_item(biz9_config,data_type,id);
|
|
84
87
|
Log.w('get_url_action_get_item',cloud_url);
|
|
85
88
|
console.log('GET_URL-ACTION-GET-ITEM-SUCCESS');
|
|
86
89
|
call()
|
|
@@ -90,7 +93,7 @@ describe("connect", () => {
|
|
|
90
93
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
91
94
|
let data_type = 'dt_blank';
|
|
92
95
|
let id = 0;
|
|
93
|
-
let cloud_url =
|
|
96
|
+
let cloud_url = Url.get_action_delete_item(biz9_config,data_type,id);
|
|
94
97
|
Log.w('get_url_action_delete_item',cloud_url);
|
|
95
98
|
console.log('GET_URL-ACTION-DELETE-ITEM-SUCCESS');
|
|
96
99
|
call()
|
|
@@ -99,7 +102,7 @@ describe("connect", () => {
|
|
|
99
102
|
console.log('GET_URL-ACTION-GET-LIST-ITEM-START');
|
|
100
103
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
101
104
|
let data_type = 'dt_blank';
|
|
102
|
-
let cloud_url =
|
|
105
|
+
let cloud_url = Url.get_action_get_list(biz9_config,data_type);
|
|
103
106
|
Log.w('get_url_action_get_list_item',cloud_url);
|
|
104
107
|
console.log('GET_URL-ACTION-GET-LIST-ITEM-SUCCESS');
|
|
105
108
|
call()
|
|
@@ -108,7 +111,7 @@ describe("connect", () => {
|
|
|
108
111
|
console.log('GET_URL-ACTION-DELETE-LIST-ITEM-START');
|
|
109
112
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
110
113
|
let data_type = 'dt_blank';
|
|
111
|
-
let cloud_url =
|
|
114
|
+
let cloud_url = Url.get_action_delete_list(biz9_config,data_type);
|
|
112
115
|
Log.w('get_url_action_delete_list_item',cloud_url);
|
|
113
116
|
console.log('GET_URL-ACTION-DELETE-LIST-ITEM-SUCCESS');
|
|
114
117
|
call()
|
|
@@ -117,7 +120,7 @@ describe("connect", () => {
|
|
|
117
120
|
console.log('GET_URL-ACTION-UPDATE-LIST-ITEM-START');
|
|
118
121
|
let biz9_config = Scriptz.get_biz9_config({biz9_config_file:path.resolve('../../biz9_config')});
|
|
119
122
|
let data_type = 'dt_blank';
|
|
120
|
-
let cloud_url =
|
|
123
|
+
let cloud_url = Url.get_action_update_list(biz9_config,data_type);
|
|
121
124
|
Log.w('get_url_action_update_list_item',cloud_url);
|
|
122
125
|
console.log('GET_URL-ACTION-UPDATE-LIST-ITEM-SUCCESS');
|
|
123
126
|
call()
|
|
@@ -129,14 +132,14 @@ describe("connect", () => {
|
|
|
129
132
|
let sort_by = {title:-1};
|
|
130
133
|
let page_current = 0;
|
|
131
134
|
let page_size = 15;
|
|
132
|
-
let filter_obj =
|
|
135
|
+
let filter_obj = Obj.get_filter(data_type,filter,sort_by,page_current,page_size);
|
|
133
136
|
Log.w('get_url_action_filter_obj',filter_obj);
|
|
134
137
|
console.log('GET_FILTER-OBJECT-SUCCESS');
|
|
135
138
|
call()
|
|
136
139
|
},
|
|
137
140
|
function(call) {
|
|
138
141
|
console.log('GET-NEW-ITEM-START');
|
|
139
|
-
var new_item =
|
|
142
|
+
var new_item = Item.get_new(DATA_TYPE,0);
|
|
140
143
|
console.log(new_item);
|
|
141
144
|
console.log('GET-NEW-ITEM-SUCCESS');
|
|
142
145
|
call()
|
|
@@ -151,7 +154,7 @@ describe("connect", () => {
|
|
|
151
154
|
item_test.value_2 = 'my_value_2';
|
|
152
155
|
item_test.field_3 = 'my_field_3';
|
|
153
156
|
item_test.value_3 = 'my_value_3';
|
|
154
|
-
let item_biz =
|
|
157
|
+
let item_biz = Item.get_biz(biz9_config,item_test,{get_photo:true,get_date:true,get_count:true,get_biz_map:true});
|
|
155
158
|
console.log(item_biz);
|
|
156
159
|
console.log('SET-ITEM-BIZ-SUCCESS');
|
|
157
160
|
call();
|
|
@@ -163,7 +166,6 @@ describe("connect", () => {
|
|
|
163
166
|
], function(err) {
|
|
164
167
|
console.log(err.message) // "another thing"
|
|
165
168
|
})
|
|
166
|
-
|
|
167
169
|
});
|
|
168
170
|
});
|
|
169
171
|
|