pure-orm 2.2.0 → 4.0.0-0
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/.eslintrc.json +2 -2
- package/README.md +169 -242
- package/examples/basic/bo/person.js +4 -3
- package/examples/basic/dao/person.js +1 -2
- package/examples/basic/db.js +6 -15
- package/examples/basic/orm.js +8 -0
- package/examples/blog/bo/article.js +5 -2
- package/examples/blog/bo/article_tag.js +5 -2
- package/examples/blog/bo/article_tags.js +4 -3
- package/examples/blog/bo/articles.js +4 -3
- package/examples/blog/bo/person.js +4 -2
- package/examples/blog/bo/tag.js +4 -2
- package/examples/blog/business-objects.js +1 -10
- package/examples/blog/orm.js +14 -0
- package/examples/order/bo/line-item.js +5 -2
- package/examples/order/bo/line-items.js +4 -3
- package/examples/order/bo/order.js +5 -2
- package/examples/order/bo/orders.js +4 -3
- package/examples/order/bo/product-variant.js +5 -2
- package/examples/order/bo/product-variants.js +4 -3
- package/examples/order/bo/product.js +5 -2
- package/examples/order/bo/products.js +4 -3
- package/examples/order/bo/utm-source.js +4 -2
- package/examples/order/orm.js +20 -0
- package/examples/order-more/bo/actual-product-variant.js +5 -2
- package/examples/order-more/bo/actual-product-variants.js +4 -3
- package/examples/order-more/bo/color.js +5 -2
- package/examples/order-more/bo/colors.js +4 -3
- package/examples/order-more/bo/customer.js +5 -2
- package/examples/order-more/bo/customers.js +4 -3
- package/examples/order-more/bo/gender.js +5 -2
- package/examples/order-more/bo/genders.js +4 -3
- package/examples/order-more/bo/inventory-level.js +5 -2
- package/examples/order-more/bo/inventory-levels.js +4 -3
- package/examples/order-more/bo/line-item.js +5 -2
- package/examples/order-more/bo/line-items.js +4 -3
- package/examples/order-more/bo/order.js +5 -2
- package/examples/order-more/bo/orders.js +4 -3
- package/examples/order-more/bo/parcel-event.js +5 -2
- package/examples/order-more/bo/parcel-events.js +4 -3
- package/examples/order-more/bo/parcel-line-item.js +5 -2
- package/examples/order-more/bo/parcel-line-items.js +4 -3
- package/examples/order-more/bo/parcel.js +5 -2
- package/examples/order-more/bo/parcels.js +4 -3
- package/examples/order-more/bo/physical-address.js +5 -2
- package/examples/order-more/bo/physical-addresses.js +4 -3
- package/examples/order-more/bo/product-variant-image.js +5 -2
- package/examples/order-more/bo/product-variant-images.js +4 -3
- package/examples/order-more/bo/product-variant.js +5 -2
- package/examples/order-more/bo/product-variants.js +4 -3
- package/examples/order-more/bo/product.js +5 -2
- package/examples/order-more/bo/products.js +4 -3
- package/examples/order-more/bo/refund.js +5 -2
- package/examples/order-more/bo/refunds.js +4 -3
- package/examples/order-more/bo/shipment-actual-product-variant.js +5 -2
- package/examples/order-more/bo/shipment-actual-product-variants.js +4 -3
- package/examples/order-more/bo/shipment.js +5 -2
- package/examples/order-more/bo/shipments.js +4 -3
- package/examples/order-more/bo/size.js +5 -2
- package/examples/order-more/bo/sizes.js +4 -3
- package/examples/order-more/bo/utm-medium.js +4 -2
- package/examples/order-more/bo/utm-source.js +4 -2
- package/examples/order-more/orm.js +49 -0
- package/package.json +4 -2
- package/src/bo.js +393 -0
- package/src/{bo/base-bo.spec.js → bo.spec.js} +73 -37
- package/src/factory.js +167 -0
- package/src/factory.spec.js +11 -0
- package/src/index.js +49 -6
- package/test-utils/five/bo/line-item.js +5 -2
- package/test-utils/five/bo/line-items.js +4 -3
- package/test-utils/five/bo/order.js +5 -2
- package/test-utils/five/bo/orders.js +4 -3
- package/test-utils/five/bo/parcel-event.js +5 -2
- package/test-utils/five/bo/parcel-events.js +4 -3
- package/test-utils/five/bo/parcel-line-item.js +5 -2
- package/test-utils/five/bo/parcel-line-items.js +4 -3
- package/test-utils/five/bo/parcel.js +5 -2
- package/test-utils/five/bo/parcels.js +4 -3
- package/test-utils/five/orm.js +19 -0
- package/test-utils/nine/bo/feature-switch.js +5 -2
- package/test-utils/nine/bo/feature-switches.js +4 -3
- package/test-utils/nine/orm.js +9 -0
- package/test-utils/six/bo/customer.js +5 -2
- package/test-utils/six/bo/customers.js +4 -3
- package/test-utils/six/bo/line-item.js +5 -2
- package/test-utils/six/bo/line-items.js +4 -3
- package/test-utils/six/bo/order.js +5 -2
- package/test-utils/six/bo/orders.js +4 -3
- package/test-utils/six/bo/parcel-line-item.js +5 -2
- package/test-utils/six/bo/parcel-line-items.js +4 -3
- package/test-utils/six/bo/parcel.js +5 -2
- package/test-utils/six/bo/parcels.js +4 -3
- package/test-utils/six/orm.js +19 -0
- package/test-utils/thirteen/bo/audience.js +21 -0
- package/test-utils/thirteen/bo/audiences.js +10 -0
- package/{examples/basic → test-utils/thirteen}/bo/base.js +0 -0
- package/test-utils/thirteen/bo/brand.js +21 -0
- package/test-utils/thirteen/bo/brands.js +10 -0
- package/test-utils/thirteen/bo/categories.js +13 -0
- package/test-utils/thirteen/bo/category.js +21 -0
- package/test-utils/thirteen/bo/member.js +21 -0
- package/test-utils/thirteen/bo/members.js +10 -0
- package/test-utils/thirteen/bo/passion.js +21 -0
- package/test-utils/thirteen/bo/passions.js +10 -0
- package/test-utils/thirteen/bo/product.js +22 -0
- package/test-utils/thirteen/bo/products.js +10 -0
- package/test-utils/thirteen/bo/recommendation-audience.js +27 -0
- package/test-utils/thirteen/bo/recommendation-audiences.js +10 -0
- package/test-utils/thirteen/bo/recommendation.js +33 -0
- package/test-utils/thirteen/bo/recommendations.js +10 -0
- package/test-utils/thirteen/orm.js +25 -0
- package/test-utils/thirteen/results.json +74 -0
- package/test-utils/twelve/bo/member.js +5 -2
- package/test-utils/twelve/bo/members.js +4 -3
- package/test-utils/twelve/bo/prompt.js +5 -2
- package/test-utils/twelve/bo/prompts.js +4 -3
- package/test-utils/twelve/orm.js +10 -0
- package/examples/basic/business-objects.js +0 -9
- package/examples/basic/dao/base.js +0 -9
- package/examples/blog/bo/base.js +0 -5
- package/examples/order/bo/base.js +0 -5
- package/examples/order/business-objects.js +0 -11
- package/examples/order-more/bo/base.js +0 -5
- package/examples/order-more/business-objects.js +0 -26
- package/src/bo/base-bo-collection.js +0 -15
- package/src/bo/base-bo.js +0 -379
- package/src/dao/base-dao.js +0 -146
- package/src/dao/base-dao.spec.js +0 -6
- package/src/util/helpers.js +0 -28
- package/src/util/helpers.spec.js +0 -6
- package/test-utils/five/business-objects.js +0 -11
- package/test-utils/nine/business-objects.js +0 -7
- package/test-utils/six/business-objects.js +0 -11
- package/test-utils/twelve/business-objects.js +0 -8
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
class Customers extends BaseBoCollection {
|
|
1
|
+
class Customers {
|
|
4
2
|
static get Bo() {
|
|
5
3
|
return require('./customer'); // eslint-disable-line
|
|
6
4
|
}
|
|
5
|
+
constructor(props = {}) {
|
|
6
|
+
this.models = props.models || [];
|
|
7
|
+
}
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
module.exports = Customers;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
const Base = require('./base');
|
|
2
1
|
const Order = require('./order');
|
|
3
2
|
const LineItems = require('./customers');
|
|
4
3
|
|
|
5
|
-
class LineItem
|
|
4
|
+
class LineItem {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
Object.assign(this, props);
|
|
7
|
+
}
|
|
8
|
+
|
|
6
9
|
get BoCollection() {
|
|
7
10
|
return LineItems;
|
|
8
11
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
class LineItems extends BaseBoCollection {
|
|
1
|
+
class LineItems {
|
|
4
2
|
static get Bo() {
|
|
5
3
|
return require('./line-item'); // eslint-disable-line
|
|
6
4
|
}
|
|
5
|
+
constructor(props = {}) {
|
|
6
|
+
this.models = props.models || [];
|
|
7
|
+
}
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
module.exports = LineItems;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
const Base = require('./base');
|
|
2
1
|
const Customer = require('./customer');
|
|
3
2
|
const Orders = require('./orders');
|
|
4
3
|
|
|
5
|
-
class Order
|
|
4
|
+
class Order {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
Object.assign(this, props);
|
|
7
|
+
}
|
|
8
|
+
|
|
6
9
|
get BoCollection() {
|
|
7
10
|
return Orders;
|
|
8
11
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
class Orders extends BaseBoCollection {
|
|
1
|
+
class Orders {
|
|
4
2
|
static get Bo() {
|
|
5
3
|
return require('./order'); // eslint-disable-line
|
|
6
4
|
}
|
|
5
|
+
constructor(props = {}) {
|
|
6
|
+
this.models = props.models || [];
|
|
7
|
+
}
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
module.exports = Orders;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
const Base = require('./base');
|
|
2
1
|
const ParcelLineItems = require('./parcel-line-items');
|
|
3
2
|
const Parcel = require('./parcel');
|
|
4
3
|
const LineItem = require('./line-item');
|
|
5
4
|
|
|
6
|
-
class ParcelLineItem
|
|
5
|
+
class ParcelLineItem {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
Object.assign(this, props);
|
|
8
|
+
}
|
|
9
|
+
|
|
7
10
|
get BoCollection() {
|
|
8
11
|
return ParcelLineItems;
|
|
9
12
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
class ParcelLineItems extends BaseBoCollection {
|
|
1
|
+
class ParcelLineItems {
|
|
4
2
|
static get Bo() {
|
|
5
3
|
return require('./parcel-line-item'); // eslint-disable-line
|
|
6
4
|
}
|
|
5
|
+
constructor(props = {}) {
|
|
6
|
+
this.models = props.models || [];
|
|
7
|
+
}
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
module.exports = ParcelLineItems;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
class Parcels extends BaseBoCollection {
|
|
1
|
+
class Parcels {
|
|
4
2
|
static get Bo() {
|
|
5
3
|
return require('./parcel'); // eslint-disable-line
|
|
6
4
|
}
|
|
5
|
+
constructor(props = {}) {
|
|
6
|
+
this.models = props.models || [];
|
|
7
|
+
}
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
module.exports = Parcels;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const { create } = require('pure-orm');
|
|
2
|
+
const Parcel = require('./bo/parcel');
|
|
3
|
+
const ParcelLineItem = require('./bo/parcel-line-item');
|
|
4
|
+
const LineItem = require('./bo/line-item');
|
|
5
|
+
const Order = require('./bo/order');
|
|
6
|
+
const Customer = require('./bo/customer');
|
|
7
|
+
const getBusinessObjects = () => [
|
|
8
|
+
Parcel,
|
|
9
|
+
ParcelLineItem,
|
|
10
|
+
LineItem,
|
|
11
|
+
Order,
|
|
12
|
+
Customer
|
|
13
|
+
];
|
|
14
|
+
const orm = create({
|
|
15
|
+
getBusinessObjects,
|
|
16
|
+
db: void 0
|
|
17
|
+
});
|
|
18
|
+
module.exports = orm;
|
|
19
|
+
module.exports.getBusinessObjects = getBusinessObjects;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const Audiences = require('./audiences');
|
|
2
|
+
|
|
3
|
+
class Audience {
|
|
4
|
+
constructor(props) {
|
|
5
|
+
Object.assign(this, props);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get BoCollection() {
|
|
9
|
+
return Audiences;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static get tableName() {
|
|
13
|
+
return 'audience';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static get sqlColumnsData() {
|
|
17
|
+
return ['id'];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = Audience;
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const Brands = require('./brands');
|
|
2
|
+
|
|
3
|
+
class Brand {
|
|
4
|
+
constructor(props) {
|
|
5
|
+
Object.assign(this, props);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get BoCollection() {
|
|
9
|
+
return Brands;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static get tableName() {
|
|
13
|
+
return 'brand';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static get sqlColumnsData() {
|
|
17
|
+
return ['id'];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = Brand;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
class Categories {
|
|
2
|
+
static get Bo() {
|
|
3
|
+
return require('./category'); // eslint-disable-line
|
|
4
|
+
}
|
|
5
|
+
static get displayName() {
|
|
6
|
+
return 'categories';
|
|
7
|
+
}
|
|
8
|
+
constructor(props = {}) {
|
|
9
|
+
this.models = props.models || [];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = Categories;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const Categories = require('./categories');
|
|
2
|
+
|
|
3
|
+
class Category {
|
|
4
|
+
constructor(props) {
|
|
5
|
+
Object.assign(this, props);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get BoCollection() {
|
|
9
|
+
return Categories;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static get tableName() {
|
|
13
|
+
return 'category';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static get sqlColumnsData() {
|
|
17
|
+
return ['id'];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = Category;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const Members = require('./members');
|
|
2
|
+
|
|
3
|
+
class Member {
|
|
4
|
+
constructor(props) {
|
|
5
|
+
Object.assign(this, props);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get BoCollection() {
|
|
9
|
+
return Members;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static get tableName() {
|
|
13
|
+
return 'member';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static get sqlColumnsData() {
|
|
17
|
+
return ['id'];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = Member;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const Passions = require('./passions');
|
|
2
|
+
|
|
3
|
+
class Passion {
|
|
4
|
+
constructor(props) {
|
|
5
|
+
Object.assign(this, props);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get BoCollection() {
|
|
9
|
+
return Passions;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static get tableName() {
|
|
13
|
+
return 'passion';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static get sqlColumnsData() {
|
|
17
|
+
return ['id'];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = Passion;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const Brand = require('./brand');
|
|
2
|
+
const Products = require('./products');
|
|
3
|
+
|
|
4
|
+
class Product {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
Object.assign(this, props);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
get BoCollection() {
|
|
10
|
+
return Products;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static get tableName() {
|
|
14
|
+
return 'product';
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static get sqlColumnsData() {
|
|
18
|
+
return ['id', { column: 'brand_id', references: Brand }];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
module.exports = Product;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const RecommendationAudiences = require('./recommendation-audiences');
|
|
2
|
+
const Recommendation = require('./recommendation');
|
|
3
|
+
const Audience = require('./audience');
|
|
4
|
+
|
|
5
|
+
class RecommendationAudience {
|
|
6
|
+
constructor(props) {
|
|
7
|
+
Object.assign(this, props);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
get BoCollection() {
|
|
11
|
+
return RecommendationAudiences;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
static get tableName() {
|
|
15
|
+
return 'recommendation_audience';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static get sqlColumnsData() {
|
|
19
|
+
return [
|
|
20
|
+
'id',
|
|
21
|
+
{ column: 'recommendation_id', references: Recommendation },
|
|
22
|
+
{ column: 'audience_id', references: Audience }
|
|
23
|
+
];
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = RecommendationAudience;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const Recommendations = require('./recommendations');
|
|
2
|
+
const Member = require('./member');
|
|
3
|
+
const Brand = require('./brand');
|
|
4
|
+
const Product = require('./product');
|
|
5
|
+
const Category = require('./category');
|
|
6
|
+
const Passion = require('./passion');
|
|
7
|
+
|
|
8
|
+
class Recommendation {
|
|
9
|
+
constructor(props) {
|
|
10
|
+
Object.assign(this, props);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get BoCollection() {
|
|
14
|
+
return Recommendations;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static get tableName() {
|
|
18
|
+
return 'recommendation';
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
static get sqlColumnsData() {
|
|
22
|
+
return [
|
|
23
|
+
'id',
|
|
24
|
+
{ column: 'member_id', references: Member },
|
|
25
|
+
{ column: 'brand_id', references: Brand },
|
|
26
|
+
{ column: 'product_id', references: Product },
|
|
27
|
+
{ column: 'category_id', references: Category },
|
|
28
|
+
{ column: 'passion_id', references: Passion }
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
module.exports = Recommendation;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const { create } = require('pure-orm');
|
|
2
|
+
const Member = require('./bo/member');
|
|
3
|
+
const Recommendation = require('./bo/recommendation');
|
|
4
|
+
const Brand = require('./bo/brand');
|
|
5
|
+
const Product = require('./bo/product');
|
|
6
|
+
const Category = require('./bo/category');
|
|
7
|
+
const Passion = require('./bo/passion');
|
|
8
|
+
const RecommendationAudience = require('./bo/recommendation-audience');
|
|
9
|
+
const Audience = require('./bo/audience');
|
|
10
|
+
const getBusinessObjects = () => [
|
|
11
|
+
Member,
|
|
12
|
+
Recommendation,
|
|
13
|
+
Brand,
|
|
14
|
+
Product,
|
|
15
|
+
Category,
|
|
16
|
+
Passion,
|
|
17
|
+
RecommendationAudience,
|
|
18
|
+
Audience
|
|
19
|
+
];
|
|
20
|
+
const orm = create({
|
|
21
|
+
getBusinessObjects,
|
|
22
|
+
db: void 0
|
|
23
|
+
});
|
|
24
|
+
module.exports = orm;
|
|
25
|
+
module.exports.getBusinessObjects = getBusinessObjects;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"member#id": 1,
|
|
4
|
+
"recommendation#id": 1,
|
|
5
|
+
"recommendation#member_id": 1,
|
|
6
|
+
"recommendation#brand_id": 2,
|
|
7
|
+
"recommendation#product_id": 7,
|
|
8
|
+
"recommendation#category_id": 1,
|
|
9
|
+
"recommendation#passion_id": 2,
|
|
10
|
+
"brand#id": 2,
|
|
11
|
+
"product#id": 7,
|
|
12
|
+
"product#brand_id": 2,
|
|
13
|
+
"category#id": 1,
|
|
14
|
+
"passion#id": 2,
|
|
15
|
+
"recommendation_audience#id": 1,
|
|
16
|
+
"recommendation_audience#recommendation_id": 1,
|
|
17
|
+
"recommendation_audience#audience_id": 1,
|
|
18
|
+
"audience#id": 1
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"member#id": 1,
|
|
22
|
+
"recommendation#id": 2,
|
|
23
|
+
"recommendation#member_id": 1,
|
|
24
|
+
"recommendation#brand_id": 2,
|
|
25
|
+
"recommendation#product_id": 1,
|
|
26
|
+
"recommendation#category_id": 2,
|
|
27
|
+
"recommendation#passion_id": 2,
|
|
28
|
+
"brand#id": 2,
|
|
29
|
+
"product#id": 1,
|
|
30
|
+
"product#brand_id": 2,
|
|
31
|
+
"category#id": 2,
|
|
32
|
+
"passion#id": 2,
|
|
33
|
+
"recommendation_audience#id": 2,
|
|
34
|
+
"recommendation_audience#recommendation_id": 2,
|
|
35
|
+
"recommendation_audience#audience_id": 1,
|
|
36
|
+
"audience#id": 1
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"member#id": 1,
|
|
40
|
+
"recommendation#id": 3,
|
|
41
|
+
"recommendation#member_id": 1,
|
|
42
|
+
"recommendation#brand_id": 3,
|
|
43
|
+
"recommendation#product_id": 27,
|
|
44
|
+
"recommendation#category_id": 3,
|
|
45
|
+
"recommendation#passion_id": 2,
|
|
46
|
+
"brand#id": 3,
|
|
47
|
+
"product#id": 27,
|
|
48
|
+
"product#brand_id": 3,
|
|
49
|
+
"category#id": 3,
|
|
50
|
+
"passion#id": 2,
|
|
51
|
+
"recommendation_audience#id": 3,
|
|
52
|
+
"recommendation_audience#recommendation_id": 3,
|
|
53
|
+
"recommendation_audience#audience_id": 1,
|
|
54
|
+
"audience#id": 1
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"member#id": 1,
|
|
58
|
+
"recommendation#id": 4,
|
|
59
|
+
"recommendation#member_id": 1,
|
|
60
|
+
"recommendation#brand_id": 6,
|
|
61
|
+
"recommendation#product_id": 75,
|
|
62
|
+
"recommendation#category_id": 4,
|
|
63
|
+
"recommendation#passion_id": 2,
|
|
64
|
+
"brand#id": 6,
|
|
65
|
+
"product#id": 75,
|
|
66
|
+
"product#brand_id": 6,
|
|
67
|
+
"category#id": 4,
|
|
68
|
+
"passion#id": 2,
|
|
69
|
+
"recommendation_audience#id": 4,
|
|
70
|
+
"recommendation_audience#recommendation_id": 4,
|
|
71
|
+
"recommendation_audience#audience_id": 1,
|
|
72
|
+
"audience#id": 1
|
|
73
|
+
}
|
|
74
|
+
]
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
class Members extends BaseBoCollection {
|
|
1
|
+
class Members {
|
|
4
2
|
static get Bo() {
|
|
5
3
|
return require('./member'); // eslint-disable-line
|
|
6
4
|
}
|
|
5
|
+
constructor(props = {}) {
|
|
6
|
+
this.models = props.models || [];
|
|
7
|
+
}
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
module.exports = Members;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
const Base = require('./base');
|
|
2
1
|
const Prompts = require('./prompts');
|
|
3
2
|
const Member = require('./member');
|
|
4
3
|
|
|
5
|
-
class Prompt
|
|
4
|
+
class Prompt {
|
|
5
|
+
constructor(props) {
|
|
6
|
+
Object.assign(this, props);
|
|
7
|
+
}
|
|
8
|
+
|
|
6
9
|
get BoCollection() {
|
|
7
10
|
return Prompts;
|
|
8
11
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
class Prompts extends BaseBoCollection {
|
|
1
|
+
class Prompts {
|
|
4
2
|
static get Bo() {
|
|
5
3
|
return require('./prompt'); // eslint-disable-line
|
|
6
4
|
}
|
|
5
|
+
constructor(props = {}) {
|
|
6
|
+
this.models = props.models || [];
|
|
7
|
+
}
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
module.exports = Prompts;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const { create } = require('pure-orm');
|
|
2
|
+
const Prompt = require('./bo/prompt');
|
|
3
|
+
const Member = require('./bo/member');
|
|
4
|
+
const getBusinessObjects = () => [Prompt, Member];
|
|
5
|
+
const orm = create({
|
|
6
|
+
getBusinessObjects,
|
|
7
|
+
db: void 0
|
|
8
|
+
});
|
|
9
|
+
module.exports = orm;
|
|
10
|
+
module.exports.getBusinessObjects = getBusinessObjects;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/* eslint-disable global-require */
|
|
2
|
-
const getBusinessObjects = () => [
|
|
3
|
-
// These need to be imported here to get around circular dependencies
|
|
4
|
-
require('./bo/article'),
|
|
5
|
-
require('./bo/person'),
|
|
6
|
-
require('./bo/tag')
|
|
7
|
-
];
|
|
8
|
-
|
|
9
|
-
module.exports = getBusinessObjects;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const { createBaseDAO } = require('pure-orm');
|
|
2
|
-
const getTableData = require('../table-data');
|
|
3
|
-
const db = require('../db');
|
|
4
|
-
|
|
5
|
-
const logError = console.log.bind(console);
|
|
6
|
-
|
|
7
|
-
const constructor = createBaseDAO({ getTableData, db, logError });
|
|
8
|
-
|
|
9
|
-
module.exports = constructor;
|
package/examples/blog/bo/base.js
DELETED