biz9-logic 4.0.23 → 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 +130 -48
- 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
|
};
|
|
@@ -105,33 +104,37 @@ class Product{
|
|
|
105
104
|
};
|
|
106
105
|
}
|
|
107
106
|
class Service{
|
|
108
|
-
static get_test = (
|
|
107
|
+
static get_test = (option) =>{
|
|
109
108
|
let service = DataItem.get_new_full_item(
|
|
110
109
|
DataItem.get_new(DataType.SERVICE,Number.get_id()),
|
|
111
110
|
DataItem.get_new(DataType.SERVICE,0),
|
|
112
111
|
DataItem.get_new(DataType.SERVICE,0),
|
|
113
|
-
Field.get_test(
|
|
112
|
+
Field.get_test("Service "+Number.get_id(),{get_value:false}));
|
|
114
113
|
service = Sub_Item.get_test_bind_new_child(Number.get_id(),title,service,service,service);
|
|
115
114
|
service.cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
116
115
|
service.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
117
116
|
service.type = "Type "+String(Number.get_id());
|
|
118
117
|
service.sub_type = "Sub Type "+String(Number.get_id());
|
|
119
118
|
service.stock = String(Number.get_id(3-1));
|
|
120
|
-
|
|
121
|
-
|
|
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);
|
|
122
126
|
}
|
|
123
|
-
|
|
124
|
-
return service;
|
|
127
|
+
return service;
|
|
125
128
|
};
|
|
126
129
|
}
|
|
127
130
|
class Event{
|
|
128
|
-
static get_test = (
|
|
131
|
+
static get_test = (option) =>{
|
|
129
132
|
let event = DataItem.get_new_full_item(
|
|
130
133
|
DataItem.get_new(DataType.EVENT,Number.get_id()),
|
|
131
134
|
DataItem.get_new(DataType.EVENT,0),
|
|
132
135
|
DataItem.get_new(DataType.EVENT,0),
|
|
133
|
-
Field.get_test(
|
|
134
|
-
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);
|
|
135
138
|
event.cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
136
139
|
event.old_cost = String(Number.get_id()) + "." + String(Number.get_id());
|
|
137
140
|
event.date = String(String(Number.get_id(2030)) + "-" + String(Number.get_id(13)) + "-" + String(Number.get_id(30))).trim();
|
|
@@ -140,15 +143,26 @@ class Event{
|
|
|
140
143
|
event.location = "Location "+String(Number.get_id());
|
|
141
144
|
event.meeting_link = "Meeting Link "+String(Number.get_id());
|
|
142
145
|
event.stock = String(Number.get_id(3-1));
|
|
143
|
-
|
|
144
|
-
|
|
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);
|
|
145
153
|
}
|
|
146
|
-
event = Sub_Item.get_test_bind_item_sub_item(event);
|
|
147
154
|
return event;
|
|
148
155
|
};
|
|
149
156
|
}
|
|
150
157
|
class Field{
|
|
151
|
-
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);
|
|
152
166
|
let item = {
|
|
153
167
|
date_create:new moment().toISOString(),
|
|
154
168
|
date_save:new moment().toISOString(),
|
|
@@ -159,8 +173,10 @@ class Field{
|
|
|
159
173
|
sub_note : "Sub Note "+String(Number.get_id()),
|
|
160
174
|
note : "Note "+String(Number.get_id())
|
|
161
175
|
}
|
|
162
|
-
|
|
163
|
-
|
|
176
|
+
if(option.get_value){
|
|
177
|
+
for(let b = 1;b<20;b++){
|
|
178
|
+
item['value_'+String(b)] = 'value ' + String(b);
|
|
179
|
+
}
|
|
164
180
|
}
|
|
165
181
|
return item;
|
|
166
182
|
}
|
|
@@ -195,8 +211,12 @@ class PageType {
|
|
|
195
211
|
static HOME='home';
|
|
196
212
|
static ABOUT='about';
|
|
197
213
|
static CONTACT='contact';
|
|
214
|
+
static BLOG_POST='blog_post';
|
|
215
|
+
static GALLERY='gallery';
|
|
216
|
+
static EVENT='event';
|
|
198
217
|
static SERVICE='service';
|
|
199
218
|
static PRODUCT='product';
|
|
219
|
+
static PROJECT='project';
|
|
200
220
|
static TEAM='team';
|
|
201
221
|
static SECTION_1='section_1';
|
|
202
222
|
static SECTION_2='section_2';
|
|
@@ -247,11 +267,11 @@ class DataType {
|
|
|
247
267
|
}
|
|
248
268
|
static get_item_list = () =>{
|
|
249
269
|
return [
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
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}
|
|
255
275
|
]
|
|
256
276
|
};
|
|
257
277
|
static ADMIN='admin_biz';
|
|
@@ -277,27 +297,89 @@ class DataType {
|
|
|
277
297
|
static USER='user_biz';
|
|
278
298
|
static VIDEO='video_biz';
|
|
279
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
|
+
}
|
|
280
356
|
class Business {
|
|
281
|
-
static get_new = () =>{
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
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,
|
|
285
366
|
email:"",
|
|
286
367
|
phone:"",
|
|
287
368
|
address_1:"",
|
|
288
369
|
address_2:"",
|
|
289
370
|
city:"",
|
|
290
371
|
state:"",
|
|
291
|
-
zip:""
|
|
292
|
-
});
|
|
372
|
+
zip:""});
|
|
293
373
|
};
|
|
294
374
|
static get_test = () =>{
|
|
295
375
|
let item = DataItem.get_new(DataType.BUSINESS,Number.get_id());
|
|
296
|
-
let city_list = ["
|
|
297
|
-
let state_list = ["
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
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()));
|
|
301
383
|
item.email="ceo@business.com";
|
|
302
384
|
item.phone="123-456-"+Number.get_id();
|
|
303
385
|
item.address_1=Number.get_id()+" Apple St.";
|
|
@@ -432,17 +514,17 @@ class Category {
|
|
|
432
514
|
DataItem.get_new(DataType.CATEGORY,0),
|
|
433
515
|
DataItem.get_new(DataType.CATEGORY,0),
|
|
434
516
|
Field.get_test("Category " +Number.get_id()));
|
|
435
|
-
|
|
517
|
+
category.type = Category.get_category_list()[Number.get_id(category_list.length-1)].data_type;
|
|
436
518
|
return category;
|
|
437
519
|
}
|
|
438
520
|
static get_type_category_list(type,count){
|
|
439
521
|
let category_list = [];
|
|
440
522
|
for(let a=0;a<count;a++){
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
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()));
|
|
446
528
|
category.type = type
|
|
447
529
|
category_list.push(category);
|
|
448
530
|
}
|
|
@@ -802,13 +884,12 @@ class Sub_Item{
|
|
|
802
884
|
}
|
|
803
885
|
return item;
|
|
804
886
|
};
|
|
805
|
-
|
|
806
887
|
};
|
|
807
|
-
|
|
808
888
|
}
|
|
809
889
|
module.exports = {
|
|
810
890
|
BiZ_Url,
|
|
811
891
|
Business,
|
|
892
|
+
Blog_Post,
|
|
812
893
|
Category,
|
|
813
894
|
CMS,
|
|
814
895
|
DataItem,
|
|
@@ -821,6 +902,7 @@ module.exports = {
|
|
|
821
902
|
Page,
|
|
822
903
|
PageType,
|
|
823
904
|
Product,
|
|
905
|
+
Review,
|
|
824
906
|
TemplateType,
|
|
825
907
|
Template,
|
|
826
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:9,category_count:3}));
|
|
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
|
|