biz9-logic 1.0.14 → 1.0.16
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/README.md +62 -0
- package/biz9_config +1 -1
- package/index.js +5 -1
- package/main.js +85 -0
- package/package.json +3 -3
- package/test.js +32 -14
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# BiZ9 Logic
|
|
2
|
+
|
|
3
|
+
**The BiZ9-Logic Package**
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
Use the [npm](https://npm.com) installer to install.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm i biz9-logic
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Contents
|
|
13
|
+
* [Credit](#credit)
|
|
14
|
+
|
|
15
|
+
#### <a id="credit"></a>Credits
|
|
16
|
+
|
|
17
|
+
#### Company
|
|
18
|
+
- **BiZ9 Framework LLC**
|
|
19
|
+
|
|
20
|
+
#### Code
|
|
21
|
+
- [BiZ9 Framework Github](https://github.com/biz9framework)
|
|
22
|
+
|
|
23
|
+
#### E-mail
|
|
24
|
+
- certifiedcoderz@gmail.com
|
|
25
|
+
|
|
26
|
+
#### The BiZ9 Framework 🦾
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+
**The BiZ9 Framework** is a developer friendly platform for building premium, polished, fast, professional and scalable business applications using the lastest rapid application development tools and techniques. The framework consists of libraries, commands, scripts, and packages for creating, maintaining, testing, and deploying both **mobile** and **website applications**. The primary 3rd party framework used are [**React**](https://react.dev/), [**React Native**](https://reactnative.dev/), [**Node.js**](http://Node.js), [**ExpressJS**](https://expressjs.com/), [**MongoDB**](https://www.mongodb.com/), [**Nginx**](https://nginx.org/), [**Redis**](https://redis.io/), [**Git**](https://git-scm.com/), and [**Bash**](https://www.gnu.org/software/bash/). [The BiZ9 Framework] focus is to be precise, routine, rapid, and customizable. The primary target devices for **The BiZ9 Framework** are [**Apple iOS**](https://developer.apple.com/), [**Android**](https://www.android.com/), [**Chrome**](https://www.google.com/chrome/), [**Safari**](https://www.apple.com/safari/), [**Firefox**](https://www.mozilla.org/en-US/firefox/), and [**Edge**](https://www.microsoft.com/en-us/edge/?form=MA13FJ). Other 3rd party Application Programming Interfaces (API) that are pre included are [**Amazon Web Service**](https://aws.amazon.com/), [**Stripe**](https://stripe.com/) and [**Bravely**](https://workbravely.com/).
|
|
30
|
+
|
|
31
|
+
- [Biz9 Framework GitHub](https://github.com/biz9framework)
|
|
32
|
+
- [Biz9 Framework Blog](https://bossappz.medium.com/what-is-the-biz9-framework-29731c49ad79)
|
|
33
|
+
- [BoSS Mobile App Youtube Demo](https://youtu.be/W_ZUmwZMFoc?si=4b5_6q9vPgi1IxPL)
|
|
34
|
+
|
|
35
|
+
#### TaNK9 Code 👽
|
|
36
|
+

|
|
37
|
+
|
|
38
|
+
**Brandon Poole Sr** also known as **‘TaNK’** is a technical lead and full stack software engineer with over 19 years of professional experience. He was born and raised in **Atlanta, Ga** and graduated with a [**Computer Information Systems Bachelor of Science Degree**] from [**Fort Valley State University**](https://www.fvsu.edu/). He is proficient in [**ASP.NET C#**](http://ASP.NET), [**ASP.NET MVC**](https://dotnet.microsoft.com/en-us/apps/aspnet/mvc), [**.NET Core**](https://dotnet.microsoft.com/en-us/download), [**Microsoft SQL Server**](https://www.microsoft.com/en-us/sql-server), [**IIS Web Server**](https://learn.microsoft.com/en-us/iis/get-started/introduction-to-iis/iis-web-server-overview), [**Node.js**](http://Node.js), [**React**](https://react.dev/), [**React Native**](https://reactnative.dev/), [**Framework7**](https://framework7.io/), [**Redis**](https://redis.io/), [**Amazon Web Services**](https://aws.amazon.com/), [**Apple iOS**](https://developer.apple.com/ios/), [**Android SDK**](https://developer.android.com/studio), [**MongoDB**](https://www.mongodb.com/), [**Redis**](https://redis.io/), [**NGINX**](https://nginx.org/), and [**Git**](https://git-scm.com/). He has worked as a software developer for Fortune 500 companies such as [**The Boeing Company**](https://www.boeing.com/), [**Georgia Pacific**](https://www.gp.com/), [**Colonial Pipeline**](https://www.colpipe.com/), [**Home Depot**] and [**United Parcel Services**].
|
|
39
|
+
|
|
40
|
+
He is sometimes referred to as “the real Tank” from the movie [**The Matrix**](https://www.imdb.com/title/tt0133093/).
|
|
41
|
+
|
|
42
|
+
- [Tank9Code Blog](https://medium.com/@tank9code/about-brandon-poole-sr-ac2fe8e06a09)
|
|
43
|
+
- [Tank9Code Twitter](https://instagram.com/tank9code)
|
|
44
|
+
- [Tank9Code Instagram](https://instagram.com/tank9code)
|
|
45
|
+
- [Tank9Code Youtube](https://youtube.com/@tank9code)
|
|
46
|
+
|
|
47
|
+
#### TagZ:
|
|
48
|
+
##### #BoSSAppZ
|
|
49
|
+
##### #BiZ9Framework
|
|
50
|
+
##### #EBook
|
|
51
|
+
##### #Mobile
|
|
52
|
+
##### #Apple
|
|
53
|
+
##### #Android
|
|
54
|
+
##### #IOS
|
|
55
|
+
##### #Linux
|
|
56
|
+
##### #AmazonWebServices
|
|
57
|
+
##### #AppMoneyNoteZ
|
|
58
|
+
##### #TaNK9Code
|
|
59
|
+
##### Thank you for your time.
|
|
60
|
+
##### Looking forward to working with you.
|
|
61
|
+
### License
|
|
62
|
+
[MIT](https://choosealicense.com/licenses/mit/)
|
package/biz9_config
CHANGED
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ Author: certifiedcoderz@gmail.com (Certified CoderZ)
|
|
|
4
4
|
License GNU General Public License v3.0
|
|
5
5
|
Description: BiZ9 Framework: Logic
|
|
6
6
|
*/
|
|
7
|
-
const { get_new_item_main,get_data_config_main,get_cloud_url_main } = require('./main.js');
|
|
7
|
+
const { get_new_item_main,get_data_config_main,get_cloud_url_main,get_biz_item_main } = require('./main.js');
|
|
8
8
|
|
|
9
9
|
const get_new_item = (data_type,id) => {
|
|
10
10
|
return get_new_item_main(data_type,id);
|
|
@@ -15,9 +15,13 @@ const get_data_config = (biz9_config,params) => {
|
|
|
15
15
|
const get_cloud_url = (app_title_id,domain_url,action_url)=>{
|
|
16
16
|
return get_cloud_url_main(app_title_id,domain_url,action_url);
|
|
17
17
|
}
|
|
18
|
+
const get_biz_item = (biz9_config,item,options)=>{
|
|
19
|
+
return get_biz_item_main(biz9_config,item,options);
|
|
20
|
+
}
|
|
18
21
|
|
|
19
22
|
module.exports = {
|
|
20
23
|
get_data_config,
|
|
21
24
|
get_cloud_url,
|
|
22
25
|
get_new_item,
|
|
26
|
+
get_biz_item
|
|
23
27
|
};
|
package/main.js
CHANGED
|
@@ -5,6 +5,8 @@ License GNU General Public License v3.0
|
|
|
5
5
|
Description: BiZ9 Framework: Logic - Main
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
const moment = require('moment');
|
|
9
|
+
const { get_date_time_pretty,get_date_str,get_date_time_str,get_month_title_short,get_date_time_obj,get_time_str } = require('biz9-utility');
|
|
8
10
|
const get_new_item_main = (data_type,id) => {
|
|
9
11
|
if(!id){
|
|
10
12
|
id=0;
|
|
@@ -21,9 +23,92 @@ const get_data_config_main = (biz9_config,query) =>{
|
|
|
21
23
|
}
|
|
22
24
|
return biz9_config;
|
|
23
25
|
}
|
|
26
|
+
const get_biz_item_main=(biz9_config,item,options) =>{
|
|
27
|
+
/* option
|
|
28
|
+
* get_photo = true
|
|
29
|
+
* get_date = true
|
|
30
|
+
* get_count = true
|
|
31
|
+
* get_biz_map = true
|
|
32
|
+
*/
|
|
33
|
+
if(options.get_count){
|
|
34
|
+
if(!item.view_count){
|
|
35
|
+
item.view_count='0';
|
|
36
|
+
}
|
|
37
|
+
if(!item.like_count){
|
|
38
|
+
item.like_count='0';
|
|
39
|
+
}
|
|
40
|
+
if(!item.review_count){
|
|
41
|
+
item.review_count='0';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//photo setting - start
|
|
45
|
+
if(options.get_photo){
|
|
46
|
+
//photo
|
|
47
|
+
if(!item.photofilename){
|
|
48
|
+
item.photofilename=null;
|
|
49
|
+
}
|
|
50
|
+
let no_photo_str='/images/no_image.png';
|
|
51
|
+
let _photo_size_thumb='thumb_size_';
|
|
52
|
+
let _photo_size_mid='mid_size_';
|
|
53
|
+
let _photo_size_large='large_size_';
|
|
54
|
+
let _photo_size_square_thumb='square_thumb_size_';
|
|
55
|
+
let _photo_size_square_mid='square_mid_size_';
|
|
56
|
+
let _photo_size_square_large='square_large_size_';
|
|
57
|
+
item.photo_obj={
|
|
58
|
+
album_url : (item.photofilename) ? biz9_config.PHOTO_URL+item.photofilename : no_photo_str,
|
|
59
|
+
thumb_url : (item.photofilename) ? biz9_config.PHOTO_URL+_photo_size_thumb+item.photofilename : no_photo_str,
|
|
60
|
+
mid_url : (item.photofilename) ? biz9_config.PHOTO_URL+_photo_size_mid+item.photofilename : no_photo_str,
|
|
61
|
+
large_url : (item.photofilename) ? biz9_config.PHOTO_URL+_photo_size_large+item.photofilename : no_photo_str,
|
|
62
|
+
thumb_url : (item.photofilename) ? biz9_config.PHOTO_URL+_photo_size_thumb+item.photofilename : no_photo_str,
|
|
63
|
+
square_thumb_url : (item.photofilename) ? biz9_config.PHOTO_URL+_photo_size_square_thumb+item.photofilename : no_photo_str,
|
|
64
|
+
square_mid_url : (item.photofilename) ? biz9_config.PHOTO_URL+_photo_size_square_thumb+item.photofilename : no_photo_str,
|
|
65
|
+
square_large_url : (item.photofilename) ? biz9_config.PHOTO_URL+_photo_size_square_thumb+item.photofilename : no_photo_str,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
//photo setting - end
|
|
69
|
+
//date setting - start
|
|
70
|
+
if(options.get_date){
|
|
71
|
+
no_date_str='';
|
|
72
|
+
if(!item.date_create){
|
|
73
|
+
item.date_create= new moment().toISOString();
|
|
74
|
+
item.date_save= new moment().toISOString();
|
|
75
|
+
}
|
|
76
|
+
item.date_obj={
|
|
77
|
+
pretty_create: (item.date_create) ? get_date_time_pretty(item.date_create) : no_date_str,
|
|
78
|
+
pretty_update: (item.date_create) ? get_date_time_pretty(item.date_save): no_date_str,
|
|
79
|
+
full_date_create: (item.date_create) ? get_date_str(item.date_create) : no_date_str,
|
|
80
|
+
full_date_update: (item.date_create) ? get_date_str(item.date_save) : no_date_str,
|
|
81
|
+
full_date_time_create: (item.date_create) ? get_date_time_str(item.date_create) : no_date_str,
|
|
82
|
+
full_date_time_update: (item.date_create) ? get_date_time_str(item.date_save) : no_date_str,
|
|
83
|
+
month_create: (item.date_create) ? get_month_title_short(1+get_date_time_obj(item.date_create).month()) : no_date_str,
|
|
84
|
+
month_update: (item.date_create) ? get_month_title_short(1+get_date_time_obj(item.date_save).month()) : no_date_str,
|
|
85
|
+
mo_create: (item.date_create) ? (1+get_date_time_obj(item.date_create).month()) : no_date_str,
|
|
86
|
+
mo_update: (item.date_create) ? (1+get_date_time_obj(item.date_save).month()) : no_date_str,
|
|
87
|
+
date_create: (item.date_create) ? get_date_time_obj(item.date_create).date() : no_date_str,
|
|
88
|
+
year_create: (item.date_create) ? get_date_time_obj(item.date_create).year() : no_date_str,
|
|
89
|
+
year_update: (item.date_create) ? get_date_time_obj(item.date_save).year() : no_date_str,
|
|
90
|
+
time_create: (item.date_create) ? get_time_str(item.date_create) : no_date_str,
|
|
91
|
+
time_update: (item.date_create) ? get_time_str(item.date_save) : no_date_str,
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//date setting - end
|
|
95
|
+
//biz_map setting - start
|
|
96
|
+
if(options.get_biz_map){
|
|
97
|
+
for(a=0;a<20;a++){
|
|
98
|
+
if(item['field_'+a]){
|
|
99
|
+
item[item['field_'+a]]=item['value_'+a];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//biz_map setting - end
|
|
104
|
+
|
|
105
|
+
return item;
|
|
106
|
+
}
|
|
107
|
+
|
|
24
108
|
|
|
25
109
|
module.exports = {
|
|
26
110
|
get_data_config_main,
|
|
27
111
|
get_new_item_main,
|
|
28
112
|
get_cloud_url_main,
|
|
113
|
+
get_biz_item_main
|
|
29
114
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "biz9-logic",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"license": "ISC",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"async": "^3.2.6",
|
|
12
|
-
"biz9-scriptz": "^5.2.
|
|
12
|
+
"biz9-scriptz": "^5.2.34",
|
|
13
|
+
"biz9-utility": "^1.0.53"
|
|
13
14
|
},
|
|
14
15
|
"repository": {
|
|
15
16
|
"type": "git",
|
|
@@ -19,6 +20,5 @@
|
|
|
19
20
|
"url": "https://github.com/biz9framework/biz9-logic/issues"
|
|
20
21
|
},
|
|
21
22
|
"homepage": "https://github.com/biz9framework/biz9-logic#readme",
|
|
22
|
-
"devDependencies": {},
|
|
23
23
|
"description": ""
|
|
24
24
|
}
|
package/test.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const async = require('async');
|
|
2
|
-
const { get_data_config, get_new_item, get_cloud_url } = require('./');
|
|
2
|
+
const { get_data_config, get_new_item, get_cloud_url, get_biz_item } = require('./');
|
|
3
|
+
const { get_test_item,w } = require('biz9-utility');
|
|
3
4
|
/* --- TEST CONFIG START --- */
|
|
4
5
|
//const ID='0';
|
|
5
6
|
const ID='f23c2372-df8e-4c09-a919-677fe32ba0bb';
|
|
@@ -19,7 +20,8 @@ const biz9_config ={
|
|
|
19
20
|
MONGO_CONFIG_FILE_PATH:'/etc/mongod.conf',
|
|
20
21
|
SSH_KEY:"",
|
|
21
22
|
REDIS_URL:"0.0.0.0",
|
|
22
|
-
REDIS_PORT_ID:"27019"
|
|
23
|
+
REDIS_PORT_ID:"27019",
|
|
24
|
+
PHOTO_URL:"http://localhost:1901/"
|
|
23
25
|
};
|
|
24
26
|
/* --- TEST DATA CONFIG END --- */
|
|
25
27
|
|
|
@@ -27,36 +29,52 @@ describe("connect", () => {
|
|
|
27
29
|
it("_connect", () => {
|
|
28
30
|
async.series([
|
|
29
31
|
function(call) {
|
|
30
|
-
console.log('TEST-BIZ9-
|
|
32
|
+
console.log('TEST-BIZ9-LOGIC-CONNECT-START');
|
|
31
33
|
call();
|
|
32
34
|
},
|
|
33
35
|
function(call) {
|
|
34
|
-
console.log('TEST-BIZ9-
|
|
36
|
+
console.log('TEST-BIZ9-LOGIC-GET-NEW-ITEM-START');
|
|
35
37
|
var _new_item = get_new_item(DATA_TYPE,0);
|
|
36
38
|
console.log(_new_item);
|
|
37
|
-
console.log('TEST-BIZ9-
|
|
39
|
+
console.log('TEST-BIZ9-LOGIC-GET-NEW-ITEM-SUCCESS');
|
|
38
40
|
call();
|
|
39
41
|
},
|
|
40
42
|
function(call) {
|
|
41
|
-
console.log('TEST-BIZ9-
|
|
43
|
+
console.log('TEST-BIZ9-LOGIC-GET-DATA-CONFIG-START');
|
|
42
44
|
var _data_config = get_data_config(biz9_config,{app_title_id:'local_app_title_id'});
|
|
43
45
|
console.log(_data_config);
|
|
44
|
-
console.log('TEST-BIZ9-
|
|
46
|
+
console.log('TEST-BIZ9-LOGIC-GET-DATA-CONFIG-SUCCESS');
|
|
45
47
|
call();
|
|
46
48
|
},
|
|
47
49
|
function(call) {
|
|
48
|
-
console.log('TEST-BIZ9-
|
|
50
|
+
console.log('TEST-BIZ9-LOGIC-GET-CLOUD-URL-START');
|
|
49
51
|
var _cloud_url = get_cloud_url(biz9_config.APP_TITLE_ID,CLOUD_URL,'/get/test/');
|
|
50
52
|
console.log(_cloud_url);
|
|
51
|
-
console.log('TEST-BIZ9-
|
|
53
|
+
console.log('TEST-BIZ9-LOGIC-GET-CLOUD-URL-SUCCESS');
|
|
54
|
+
call();
|
|
55
|
+
},
|
|
56
|
+
function(call) {
|
|
57
|
+
console.log('TEST-BIZ9-LOGIC-SET-ITEM-BIZ-START');
|
|
58
|
+
let item_test = get_test_item();
|
|
59
|
+
item_test.photofilename='abc.png';
|
|
60
|
+
item_test.field_1 = 'my_field_1';
|
|
61
|
+
item_test.value_1 = 'my_value_1';
|
|
62
|
+
item_test.field_2 = 'my_field_2';
|
|
63
|
+
item_test.value_2 = 'my_value_2';
|
|
64
|
+
item_test.field_3 = 'my_field_3';
|
|
65
|
+
item_test.value_3 = 'my_value_3';
|
|
66
|
+
let item_biz = get_biz_item(biz9_config,item_test,{get_photo:true,get_date:true,get_count:true,get_biz_map:true});
|
|
67
|
+
//let item_biz = get_biz_item(biz9_config,item_test,{get_photo:false,get_date:false,get_count:false,get_biz_map:false});
|
|
68
|
+
console.log(item_biz);
|
|
69
|
+
console.log('TEST-BIZ9-LOGIC-SET-ITEM-BIZ-SUCCESS');
|
|
52
70
|
call();
|
|
53
71
|
},
|
|
54
72
|
], function(err, results) {
|
|
55
|
-
console.log('TEST-BIZ9-
|
|
56
|
-
console.log('TEST-BIZ9-
|
|
57
|
-
console.log('TEST-BIZ9-
|
|
58
|
-
console.log('TEST-BIZ9-
|
|
59
|
-
console.log('TEST-BIZ9-
|
|
73
|
+
console.log('TEST-BIZ9-LOGIC-CONNECT-SUCCESS');
|
|
74
|
+
console.log('TEST-BIZ9-LOGIC-GET-DATA-CONFIG-SUCCESS');
|
|
75
|
+
console.log('TEST-BIZ9-LOGIC-GET-NEW-ITEM-SUCCESS');
|
|
76
|
+
console.log('TEST-BIZ9-LOGIC-GET-CLOUD-URL-SUCCESS');
|
|
77
|
+
console.log('TEST-BIZ9-LOGIC-CONNECT-DONE');
|
|
60
78
|
});
|
|
61
79
|
});
|
|
62
80
|
});
|