biz9-logic 4.0.22 → 4.0.24
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 +133 -49
- package/package.json +1 -1
- package/test.js +38 -2
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -51,7 +51,7 @@ class Page{
|
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
class Product{
|
|
54
|
-
static get_test = (
|
|
54
|
+
static get_test = (option) =>{
|
|
55
55
|
if(!option){
|
|
56
56
|
option={};
|
|
57
57
|
}
|
|
@@ -59,20 +59,19 @@ class Product{
|
|
|
59
59
|
DataItem.get_new(DataType.PRODUCT,Number.get_id()),
|
|
60
60
|
DataItem.get_new(DataType.PRODUCT,0),
|
|
61
61
|
DataItem.get_new(DataType.PRODUCT,0),
|
|
62
|
-
Field.get_test(
|
|
62
|
+
Field.get_test("Product "+Number.get_id(),{get_value:false}));
|
|
63
63
|
product.cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
64
64
|
product.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
65
65
|
product.type = "Type "+String(Number.get_id());
|
|
66
66
|
product.sub_type = "Sub Type "+String(Number.get_id());
|
|
67
67
|
product.stock = String(Number.get_id(3-1));
|
|
68
|
-
//product.category = Category.get_type_category_list(DataType.PRODUCT)[Number.get_id(Category.get_type_category_list(DataType.PRODUCT).length-1)].title;
|
|
69
68
|
product.category ="Category " + String(Number.get_id());
|
|
70
|
-
if(option.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
if(option.get_item){
|
|
70
|
+
product = Sub_Item.get_test_bind_new_child(Number.get_id(),"Product "+Number.get_id(),product,product,product);
|
|
71
|
+
for(let a=0;a<10;a++){
|
|
72
|
+
product=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section " + String(a),product,product,product);
|
|
73
|
+
}
|
|
74
|
+
product = Sub_Item.get_test_bind_item_sub_item(product);
|
|
76
75
|
}
|
|
77
76
|
return product;
|
|
78
77
|
};
|
|
@@ -92,9 +91,11 @@ class Product{
|
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
93
|
let category_list = Category.get_type_category_list(DataType.PRODUCT,category_count);
|
|
94
|
+
let item_count = 0;
|
|
95
95
|
for(let a=0;a<category_list.length;a++){
|
|
96
96
|
for(let b=0;b<product_count;b++){
|
|
97
|
-
|
|
97
|
+
item_count++;
|
|
98
|
+
let product = Product.get_test("Product " + String(item_count));
|
|
98
99
|
product.category = category_list[Number.get_id(category_list.length-1)].title;
|
|
99
100
|
product_list.push(product);
|
|
100
101
|
}
|
|
@@ -103,33 +104,37 @@ class Product{
|
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
106
|
class Service{
|
|
106
|
-
static get_test = (
|
|
107
|
+
static get_test = (option) =>{
|
|
107
108
|
let service = DataItem.get_new_full_item(
|
|
108
109
|
DataItem.get_new(DataType.SERVICE,Number.get_id()),
|
|
109
110
|
DataItem.get_new(DataType.SERVICE,0),
|
|
110
111
|
DataItem.get_new(DataType.SERVICE,0),
|
|
111
|
-
Field.get_test(
|
|
112
|
+
Field.get_test("Service "+Number.get_id(),{get_value:false}));
|
|
112
113
|
service = Sub_Item.get_test_bind_new_child(Number.get_id(),title,service,service,service);
|
|
113
114
|
service.cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
114
115
|
service.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
115
116
|
service.type = "Type "+String(Number.get_id());
|
|
116
117
|
service.sub_type = "Sub Type "+String(Number.get_id());
|
|
117
118
|
service.stock = String(Number.get_id(3-1));
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
service.category ="Category " + String(Number.get_id());
|
|
120
|
+
if(option.get_item){
|
|
121
|
+
service = Sub_Item.get_test_bind_new_child(Number.get_id(),"Service "+Number.get_id(),service,service,service);
|
|
122
|
+
for(let a=0;a<10;a++){
|
|
123
|
+
service=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section " + String(a),service,service,service);
|
|
124
|
+
}
|
|
125
|
+
service = Sub_Item.get_test_bind_item_sub_item(service);
|
|
120
126
|
}
|
|
121
|
-
|
|
122
|
-
return service;
|
|
127
|
+
return service;
|
|
123
128
|
};
|
|
124
129
|
}
|
|
125
130
|
class Event{
|
|
126
|
-
static get_test = (
|
|
131
|
+
static get_test = (option) =>{
|
|
127
132
|
let event = DataItem.get_new_full_item(
|
|
128
133
|
DataItem.get_new(DataType.EVENT,Number.get_id()),
|
|
129
134
|
DataItem.get_new(DataType.EVENT,0),
|
|
130
135
|
DataItem.get_new(DataType.EVENT,0),
|
|
131
|
-
Field.get_test(
|
|
132
|
-
event = Sub_Item.get_test_bind_new_child(Number.get_id(),
|
|
136
|
+
Field.get_test("Event "+Number.get_id(),{get_value:false}));
|
|
137
|
+
event = Sub_Item.get_test_bind_new_child(Number.get_id(),"Event "+Number.get_id(),event,event,event);
|
|
133
138
|
event.cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
134
139
|
event.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
135
140
|
event.date = String(String(Number.get_id(2030)) + "-" + String(Number.get_id(13)) + "-" + String(Number.get_id(30))).trim();
|
|
@@ -138,15 +143,26 @@ class Event{
|
|
|
138
143
|
event.location = "Location "+String(Number.get_id());
|
|
139
144
|
event.meeting_link = "Meeting Link "+String(Number.get_id());
|
|
140
145
|
event.stock = String(Number.get_id(3-1));
|
|
141
|
-
|
|
142
|
-
|
|
146
|
+
event.category ="Category " + String(Number.get_id());
|
|
147
|
+
if(option.get_item){
|
|
148
|
+
event=Sub_Item.get_test_bind_new_child(Number.get_id(),"Event "+Number.get_id(),event,event,event);
|
|
149
|
+
for(let a=0;a<10;a++){
|
|
150
|
+
event=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section " + String(a),event,event,event);
|
|
151
|
+
}
|
|
152
|
+
event=Sub_Item.get_test_bind_item_sub_item(event);
|
|
143
153
|
}
|
|
144
|
-
event = Sub_Item.get_test_bind_item_sub_item(event);
|
|
145
154
|
return event;
|
|
146
155
|
};
|
|
147
156
|
}
|
|
148
157
|
class Field{
|
|
149
|
-
static get_test = (title) =>{
|
|
158
|
+
static get_test = (title,option) =>{
|
|
159
|
+
if(!title){
|
|
160
|
+
title="";
|
|
161
|
+
}
|
|
162
|
+
if(!option){
|
|
163
|
+
option={get_value:true};
|
|
164
|
+
}
|
|
165
|
+
Log.w('option',option);
|
|
150
166
|
let item = {
|
|
151
167
|
date_create:new moment().toISOString(),
|
|
152
168
|
date_save:new moment().toISOString(),
|
|
@@ -157,8 +173,10 @@ class Field{
|
|
|
157
173
|
sub_note : "Sub Note "+String(Number.get_id()),
|
|
158
174
|
note : "Note "+String(Number.get_id())
|
|
159
175
|
}
|
|
160
|
-
|
|
161
|
-
|
|
176
|
+
if(option.get_value){
|
|
177
|
+
for(let b = 1;b<20;b++){
|
|
178
|
+
item['value_'+String(b)] = 'value ' + String(b);
|
|
179
|
+
}
|
|
162
180
|
}
|
|
163
181
|
return item;
|
|
164
182
|
}
|
|
@@ -193,8 +211,12 @@ class PageType {
|
|
|
193
211
|
static HOME='home';
|
|
194
212
|
static ABOUT='about';
|
|
195
213
|
static CONTACT='contact';
|
|
214
|
+
static BLOG_POST='blog_post';
|
|
215
|
+
static GALLERY='gallery';
|
|
216
|
+
static EVENT='event';
|
|
196
217
|
static SERVICE='service';
|
|
197
218
|
static PRODUCT='product';
|
|
219
|
+
static PROJECT='project';
|
|
198
220
|
static TEAM='team';
|
|
199
221
|
static SECTION_1='section_1';
|
|
200
222
|
static SECTION_2='section_2';
|
|
@@ -245,11 +267,11 @@ class DataType {
|
|
|
245
267
|
}
|
|
246
268
|
static get_item_list = () =>{
|
|
247
269
|
return [
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
270
|
+
{ title:DataType.get_title(DataType.BLOG_POST),type:DataType.BLOG_POST},
|
|
271
|
+
{ title:DataType.get_title(DataType.SERVICE),type:DataType.SERVICE},
|
|
272
|
+
{ title:DataType.get_title(DataType.EVENT),type:DataType.EVENT},
|
|
273
|
+
{ title:DataType.get_title(DataType.GALLERY),type:DataType.GALLERY},
|
|
274
|
+
{ title:DataType.get_title(DataType.PRODUCT),type:DataType.PRODUCT}
|
|
253
275
|
]
|
|
254
276
|
};
|
|
255
277
|
static ADMIN='admin_biz';
|
|
@@ -275,27 +297,89 @@ class DataType {
|
|
|
275
297
|
static USER='user_biz';
|
|
276
298
|
static VIDEO='video_biz';
|
|
277
299
|
}
|
|
300
|
+
class Blog_Post{
|
|
301
|
+
static get_test = (option) =>{
|
|
302
|
+
if(!option){
|
|
303
|
+
option = {get_value:false,get_item:false};
|
|
304
|
+
}
|
|
305
|
+
let blog_post = DataItem.get_new_full_item(
|
|
306
|
+
DataItem.get_new(DataType.BLOG_POST,Number.get_id()),
|
|
307
|
+
DataItem.get_new(DataType.BLOG_POST,0),
|
|
308
|
+
DataItem.get_new(DataType.BLOG_POST,0),
|
|
309
|
+
Field.get_test("Blog Post "+Number.get_id(),{get_value:false}));
|
|
310
|
+
blog_post.author="First Name "+ Number.get_id();
|
|
311
|
+
blog_post.tag="tag 1,tag 2,tag 3";
|
|
312
|
+
blog_post.category ="Category " + String(Number.get_id());
|
|
313
|
+
if(option.get_item){
|
|
314
|
+
blog_post = Sub_Item.get_test_bind_new_child(Number.get_id(),"Blog Post "+Number.get_id(),blog_post,blog_post,blog_post);
|
|
315
|
+
for(let a=0;a<10;a++){
|
|
316
|
+
blog_post=Sub_Item.get_test_bind_new_child(Number.get_id(),"Section " + String(a),blog_post,blog_post,blog_post);
|
|
317
|
+
}
|
|
318
|
+
blog_post = Sub_Item.get_test_bind_item_sub_item(blog_post);
|
|
319
|
+
}
|
|
320
|
+
return blog_post;
|
|
321
|
+
};
|
|
322
|
+
static get_test_list = () =>{
|
|
323
|
+
let item_list = [];
|
|
324
|
+
for(let a=0;a<20;a++){
|
|
325
|
+
item_list.push(Blog_Post.get_test());
|
|
326
|
+
}
|
|
327
|
+
return item_list;
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
class Review{
|
|
331
|
+
static get_test = () =>{
|
|
332
|
+
let city_list = ["Miami","Atlanta","Chicago","Seattle","New York City"];
|
|
333
|
+
let state_list = ["Georgia","New York","Illinois","Washington","Flordia"];
|
|
334
|
+
let review = DataItem.get_new_full_item(
|
|
335
|
+
DataItem.get_new(DataType.REVIEW,Number.get_id()),
|
|
336
|
+
DataItem.get_new(DataType.REVIEW,0),
|
|
337
|
+
DataItem.get_new(DataType.REVIEW,0),
|
|
338
|
+
Field.get_test("Review "+Number.get_id(),{get_value:false}));
|
|
339
|
+
review.email="ceo@biz"+String(Number.get_id())+".com";
|
|
340
|
+
review.first_name="First Name "+ Number.get_id();
|
|
341
|
+
review.last_name="Last Name "+ Number.get_id();
|
|
342
|
+
review.position="Position "+ Number.get_id();
|
|
343
|
+
review.comment="My comment "+ Number.get_id();
|
|
344
|
+
review.city=city_list[Number.get_id(city_list.length-1)];
|
|
345
|
+
review.state=state_list[Number.get_id(state_list.length-1)];
|
|
346
|
+
return review;
|
|
347
|
+
};
|
|
348
|
+
static get_test_list = () =>{
|
|
349
|
+
let item_list = [];
|
|
350
|
+
for(let a=0;a<20;a++){
|
|
351
|
+
item_list.push(Review.get_test());
|
|
352
|
+
}
|
|
353
|
+
return item_list;
|
|
354
|
+
};
|
|
355
|
+
}
|
|
278
356
|
class Business {
|
|
279
|
-
static get_new = () =>{
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
357
|
+
static get_new = (title) =>{
|
|
358
|
+
if(!title){
|
|
359
|
+
title="";
|
|
360
|
+
}
|
|
361
|
+
return DataItem.get_new_full_item(
|
|
362
|
+
DataItem.get_new(DataType.BUSINESS,0),
|
|
363
|
+
DataItem.get_new(DataType.BUSINESS,0),
|
|
364
|
+
DataItem.get_new(DataType.BUSINESS,0),{
|
|
365
|
+
title:title,
|
|
283
366
|
email:"",
|
|
284
367
|
phone:"",
|
|
285
368
|
address_1:"",
|
|
286
369
|
address_2:"",
|
|
287
370
|
city:"",
|
|
288
371
|
state:"",
|
|
289
|
-
zip:""
|
|
290
|
-
});
|
|
372
|
+
zip:""});
|
|
291
373
|
};
|
|
292
374
|
static get_test = () =>{
|
|
293
375
|
let item = DataItem.get_new(DataType.BUSINESS,Number.get_id());
|
|
294
|
-
let city_list = ["
|
|
295
|
-
let state_list = ["
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
376
|
+
let city_list = ["Miami","Atlanta","Chicago","Seattle","New York City"];
|
|
377
|
+
let state_list = ["Georgia","New York","Illinois","Washington","Flordia"];
|
|
378
|
+
let business = DataItem.get_new_full_item(
|
|
379
|
+
DataItem.get_new(DataType.BUSINESS,Number.get_id()),
|
|
380
|
+
DataItem.get_new(DataType.BUSINESS,0),
|
|
381
|
+
DataItem.get_new(DataType.BUSINESS,0),
|
|
382
|
+
Field.get_test("Title "+Number.get_id()));
|
|
299
383
|
item.email="ceo@business.com";
|
|
300
384
|
item.phone="123-456-"+Number.get_id();
|
|
301
385
|
item.address_1=Number.get_id()+" Apple St.";
|
|
@@ -430,17 +514,17 @@ class Category {
|
|
|
430
514
|
DataItem.get_new(DataType.CATEGORY,0),
|
|
431
515
|
DataItem.get_new(DataType.CATEGORY,0),
|
|
432
516
|
Field.get_test("Category " +Number.get_id()));
|
|
433
|
-
|
|
517
|
+
category.type = Category.get_category_list()[Number.get_id(category_list.length-1)].data_type;
|
|
434
518
|
return category;
|
|
435
519
|
}
|
|
436
520
|
static get_type_category_list(type,count){
|
|
437
521
|
let category_list = [];
|
|
438
522
|
for(let a=0;a<count;a++){
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
523
|
+
let category = DataItem.get_new_full_item(
|
|
524
|
+
DataItem.get_new(DataType.CATEGORY,"Category "+Number.get_id()),
|
|
525
|
+
DataItem.get_new(DataType.CATEGORY,0),
|
|
526
|
+
DataItem.get_new(DataType.CATEGORY,0),
|
|
527
|
+
Field.get_test("Category " +Number.get_id()));
|
|
444
528
|
category.type = type
|
|
445
529
|
category_list.push(category);
|
|
446
530
|
}
|
|
@@ -800,13 +884,12 @@ class Sub_Item{
|
|
|
800
884
|
}
|
|
801
885
|
return item;
|
|
802
886
|
};
|
|
803
|
-
|
|
804
887
|
};
|
|
805
|
-
|
|
806
888
|
}
|
|
807
889
|
module.exports = {
|
|
808
890
|
BiZ_Url,
|
|
809
891
|
Business,
|
|
892
|
+
Blog_Post,
|
|
810
893
|
Category,
|
|
811
894
|
CMS,
|
|
812
895
|
DataItem,
|
|
@@ -819,6 +902,7 @@ module.exports = {
|
|
|
819
902
|
Page,
|
|
820
903
|
PageType,
|
|
821
904
|
Product,
|
|
905
|
+
Review,
|
|
822
906
|
TemplateType,
|
|
823
907
|
Template,
|
|
824
908
|
Url,
|
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 {DataItem,DataType,Url,Obj,BiZ_Url,Cat,Stock,Schedule,Storage,Business,Product,Service,Event,Template,Page,Category} = require('./index');
|
|
3
|
+
const {DataItem,DataType,Url,Obj,BiZ_Url,Cat,Stock,Schedule,Storage,Business,Product,Service,Event,Template,Page,Category,Review,Blog_Post} = require('./index');
|
|
4
4
|
const {Log,Test,Number} = require('biz9-utility');
|
|
5
5
|
const {Scriptz}= require('biz9-scriptz');
|
|
6
6
|
|
|
@@ -42,6 +42,42 @@ describe("connect", () => {
|
|
|
42
42
|
//Log.w('data_type_list',DataType.get_item_list());
|
|
43
43
|
/* --DATA_TYPE--END */
|
|
44
44
|
|
|
45
|
+
/* --REVIEW--START */
|
|
46
|
+
Log.w("Review",Review.get_test());
|
|
47
|
+
Log.w("Review List",Review.get_test_list());
|
|
48
|
+
/* --REVIEW--END */
|
|
49
|
+
|
|
50
|
+
/* --BLOG_POST--START */
|
|
51
|
+
//let blog_post = Blog_Post.get_test({get_item:true})
|
|
52
|
+
//Log.w("Blog Post",blog_post);
|
|
53
|
+
//Log.w("Blog Post Section 1",blog_post.section_1);
|
|
54
|
+
//Log.w("Blog Post Section 1, Section 1",blog_post.section_1.section_1);
|
|
55
|
+
/* --BLOG_POST--END */
|
|
56
|
+
|
|
57
|
+
/* --EVENT--START */
|
|
58
|
+
//let event = Event.get_test({get_item:true})
|
|
59
|
+
//Log.w("Event",event);
|
|
60
|
+
//Log.w("Event Section 1",event.section_1);
|
|
61
|
+
//Log.w("Event Section 1, Section 1",event.section_1.section_1);
|
|
62
|
+
/* --EVENT--END */
|
|
63
|
+
|
|
64
|
+
/* --PRODUCT--START */
|
|
65
|
+
/*
|
|
66
|
+
let product = Product.get_test({get_item:true})
|
|
67
|
+
Log.w("Product",product);
|
|
68
|
+
Log.w("Product Section 1",product.section_1);
|
|
69
|
+
Log.w("Product Section 1, Section 1",product.section_1.section_1);
|
|
70
|
+
*/
|
|
71
|
+
/* --PRODUCT--END */
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
/* --BUSINESS--START */
|
|
77
|
+
//Log.w("Business",Business.get_new("Business " + Number.get_id()));
|
|
78
|
+
/* --BUSINESS--END */
|
|
79
|
+
|
|
80
|
+
|
|
45
81
|
|
|
46
82
|
/* --CATEGORY--START */
|
|
47
83
|
//Log.w("Category",Category.get_test("Category " + Number.get_id(),{get_items:false}));
|
|
@@ -52,7 +88,7 @@ describe("connect", () => {
|
|
|
52
88
|
/* --PRODUCT--START */
|
|
53
89
|
//let product = Product.get_test_list_by_category();
|
|
54
90
|
//Log.w('product_test',Product.get_test("Product " + Number.get_id(),{get_items:false}));
|
|
55
|
-
Log.w('product_list_test',Product.get_test_list_by_category({get_items:false,product_count:
|
|
91
|
+
//Log.w('product_list_test',Product.get_test_list_by_category({get_items:false,product_count:9,category_count:3}));
|
|
56
92
|
//console.log(Product.get_test("Product " + Number.get_id(),{get_items:false}));
|
|
57
93
|
/* --PRODUCT--END */
|
|
58
94
|
|