@reachu/database 1.0.0 → 1.0.2

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.
Files changed (36) hide show
  1. package/README.md +1 -1
  2. package/dist/entity/Attribute.d.ts +8 -0
  3. package/dist/entity/Attribute.js +41 -0
  4. package/dist/entity/Attribute.js.map +1 -0
  5. package/dist/entity/Category.d.ts +7 -1
  6. package/dist/entity/Category.js +23 -1
  7. package/dist/entity/Category.js.map +1 -1
  8. package/dist/entity/CategoryImages.d.ts +12 -0
  9. package/dist/entity/CategoryImages.js +57 -0
  10. package/dist/entity/CategoryImages.js.map +1 -0
  11. package/dist/entity/Product.entity.d.ts +2 -0
  12. package/dist/entity/Product.entity.js +6 -0
  13. package/dist/entity/Product.entity.js.map +1 -1
  14. package/dist/entity/ProductAttribute.d.ts +9 -0
  15. package/dist/entity/ProductAttribute.js +49 -0
  16. package/dist/entity/ProductAttribute.js.map +1 -0
  17. package/dist/entity/index.d.ts +4 -1
  18. package/dist/entity/index.js +7 -1
  19. package/dist/entity/index.js.map +1 -1
  20. package/dist/helpers/products/storage/search.d.ts +1 -0
  21. package/dist/migrations/1677706695399-promote_to_production_2023_01_03.d.ts +6 -0
  22. package/dist/migrations/1677706695399-promote_to_production_2023_01_03.js +49 -0
  23. package/dist/migrations/1677706695399-promote_to_production_2023_01_03.js.map +1 -0
  24. package/dist/repositories/index.d.ts +9 -0
  25. package/dist/repositories/index.js +23 -2
  26. package/dist/repositories/index.js.map +1 -1
  27. package/dist/tsconfig.tsbuildinfo +86 -9
  28. package/package.json +74 -74
  29. package/src/entity/Attribute.ts +30 -0
  30. package/src/entity/Category.ts +28 -2
  31. package/src/entity/CategoryImages.ts +38 -0
  32. package/src/entity/Product.entity.ts +9 -0
  33. package/src/entity/ProductAttribute.ts +27 -0
  34. package/src/entity/index.ts +7 -0
  35. package/src/migrations/1677706695399-promote_to_production_2023_01_03.ts +34 -0
  36. package/src/repositories/index.ts +13 -0
@@ -1921,14 +1921,19 @@
1921
1921
  "signature": "7ecfaf1bbfdc6d7a697c4132049105fc3c6ca0972a57f7dd845011d10294ad2b",
1922
1922
  "affectsGlobalScope": false
1923
1923
  },
1924
+ "../src/entity/categoryimages.ts": {
1925
+ "version": "c5866556048c851f9c616bab5c1a40b1f0bb899c87f72f5e3e0b3a8c8940fa49",
1926
+ "signature": "3bba1dcb724720a0a0adaadba003bc6ab47fb41ce4b095a1c6e1974168b15bd7",
1927
+ "affectsGlobalScope": false
1928
+ },
1924
1929
  "../src/entity/subcategory.ts": {
1925
1930
  "version": "73b85383e0bd1ef6ed0a103cc3e247ea0f4507bbdafcaf78b38930c39c61e49b",
1926
1931
  "signature": "7b2670d549ce3013f7fe122e1ee02009ee3b2995a7ba2af385527d2f02329012",
1927
1932
  "affectsGlobalScope": false
1928
1933
  },
1929
1934
  "../src/entity/category.ts": {
1930
- "version": "9a4dee6903416f8ceabcd21c6b97d16a2edb41c070eacfbe77bd1017a580f6e8",
1931
- "signature": "bb0008e837e170275a056f56f3d1b6e37b5b2c7e5680658cf79afec5cb023fcc",
1935
+ "version": "6c751f3828cd94ca0c58c9eb6233dfd53911c8b724dacc4914831ebbf7e813be",
1936
+ "signature": "d6ddb14959258ec40c16686f1507aefb5ab53fca69c6fba9f12f887cacd4a89b",
1932
1937
  "affectsGlobalScope": false
1933
1938
  },
1934
1939
  "../src/entity/courier.ts": {
@@ -2451,9 +2456,19 @@
2451
2456
  "signature": "2be82cb7b1d51d45793ac845f76e09caf9d61beaf6341095b5dd10a4480c73e2",
2452
2457
  "affectsGlobalScope": false
2453
2458
  },
2459
+ "../src/entity/attribute.ts": {
2460
+ "version": "a9121f448ea5883738db27a9aab8c6a001b11e1a6c06d8bc9261349df04e64f7",
2461
+ "signature": "eb72ead21fda7d0b46b85ec8090ec67349827f28d5e395496ae5e32937269ff9",
2462
+ "affectsGlobalScope": false
2463
+ },
2464
+ "../src/entity/productattribute.ts": {
2465
+ "version": "2387efcbc67e98783730e013f56448c114f6420014bd7d35a407a9304248b065",
2466
+ "signature": "ad4af02efb2513ca7f4195e57e966e7cdd7c36d89081c66eb3c7e429bbd3c027",
2467
+ "affectsGlobalScope": false
2468
+ },
2454
2469
  "../src/entity/product.entity.ts": {
2455
- "version": "e9a0cfa57c08ac22459de639acdb0cb610e6f8a3cee9abf1de91997c46446654",
2456
- "signature": "983e7b198259edcd8ac405f6cb524318b3b617c15d9838f63a7ada5d5003d737",
2470
+ "version": "6cc247b47067da0a3020f8bc3c739841e185248db06e363cab7aea3a42545b2c",
2471
+ "signature": "a9727ab4468763426f159d56e046a2c6946eae96de4e53d98aeab749a5152f76",
2457
2472
  "affectsGlobalScope": false
2458
2473
  },
2459
2474
  "../src/entity/collectionitem.ts": {
@@ -2607,8 +2622,8 @@
2607
2622
  "affectsGlobalScope": false
2608
2623
  },
2609
2624
  "../src/entity/index.ts": {
2610
- "version": "4c58c3b2af6a940332d9941224ecc68d4bb3828d48efe41895a54204ec7c3da8",
2611
- "signature": "1a5fcadb5120bb63cdaf4e791a304fc8e6efdd91a3ccb750abba1fd4e32bda04",
2625
+ "version": "144582c2fc899b1b172056c49b698fa1d904a0c0c241bca68ded469236ead98f",
2626
+ "signature": "c41c2724dee5f5006abbec545a39e37670f3a02b7c049271016b91e2c181f5cb",
2612
2627
  "affectsGlobalScope": false
2613
2628
  },
2614
2629
  "../src/staticdata/productorigin.ts": {
@@ -2677,8 +2692,8 @@
2677
2692
  "affectsGlobalScope": false
2678
2693
  },
2679
2694
  "../src/repositories/index.ts": {
2680
- "version": "9123c913e01c83c57e9cb83de603cb21fc85a2ebcb1ceb9433f2e1ac20a1d14c",
2681
- "signature": "def20383e8a054bcb53ce5c24d5a6975ec721f908071271acce81f4c4af7cdbb",
2695
+ "version": "41ae69bf0100fe747918ed8545f4f23e4732c4c3b6dcd82fc50d15c298ccfff9",
2696
+ "signature": "0f96ae2ba8cc8b0cdc018c24d6fb8798235c281c12e33413d116dadda1e0004f",
2682
2697
  "affectsGlobalScope": false
2683
2698
  },
2684
2699
  "../src/subscribers/productsubscriber.ts": {
@@ -2798,7 +2813,7 @@
2798
2813
  },
2799
2814
  "../src/helpers/products/storage/search.ts": {
2800
2815
  "version": "56182ffa45a3411aaf6498d7b99d2711f01f529a523ec0839f286d1967252fa7",
2801
- "signature": "80f420af0279a48521635580bd75aa2da23dda0666ddadf18d007d7749b8cc67",
2816
+ "signature": "5fa34362b2f18f0df3727649a39c4c1f75d575a7c08c6135d33d3571efd7ceb1",
2802
2817
  "affectsGlobalScope": false
2803
2818
  },
2804
2819
  "../src/helpers/products/storage/index.ts": {
@@ -2981,6 +2996,11 @@
2981
2996
  "signature": "0e5a2728f9688b495318366870eb0f07503b29fab2d3ceb79915e144778ae2ac",
2982
2997
  "affectsGlobalScope": false
2983
2998
  },
2999
+ "../src/migrations/1677706695399-promote_to_production_2023_01_03.ts": {
3000
+ "version": "a71be0c98f088d4bb023f1a0d066bdf806a1cfacb07f3969e14d403c68fbc9d7",
3001
+ "signature": "5c4edd69708ca8a11f2aa55bcf1acfb520678afefba346a893b7697974dbdb8b",
3002
+ "affectsGlobalScope": false
3003
+ },
2984
3004
  "../src/migrations/execute/index.ts": {
2985
3005
  "version": "8b5bf13d095aeb57afd593adf3d799681176a13c327e2f77e0028e178c4ee3b9",
2986
3006
  "signature": "8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881",
@@ -4917,6 +4937,11 @@
4917
4937
  "../src/entity/auditedmodel.ts",
4918
4938
  "../src/entity/user.ts"
4919
4939
  ],
4940
+ "../src/entity/attribute.ts": [
4941
+ "../node_modules/typeorm/index.d.ts",
4942
+ "../src/entity/auditedmodel.ts",
4943
+ "../src/entity/productattribute.ts"
4944
+ ],
4920
4945
  "../src/entity/auditedmodel.ts": [
4921
4946
  "../node_modules/typeorm/index.d.ts"
4922
4947
  ],
@@ -4941,8 +4966,15 @@
4941
4966
  ],
4942
4967
  "../src/entity/category.ts": [
4943
4968
  "../node_modules/typeorm/index.d.ts",
4969
+ "../src/entity/auditedmodel.ts",
4970
+ "../src/entity/categoryimages.ts",
4944
4971
  "../src/entity/subcategory.ts"
4945
4972
  ],
4973
+ "../src/entity/categoryimages.ts": [
4974
+ "../node_modules/typeorm/index.d.ts",
4975
+ "../src/entity/auditedmodel.ts",
4976
+ "../src/entity/category.ts"
4977
+ ],
4946
4978
  "../src/entity/channel.ts": [
4947
4979
  "../node_modules/typeorm/index.d.ts",
4948
4980
  "../src/entity/auditedmodel.ts",
@@ -5070,12 +5102,14 @@
5070
5102
  "../src/entity/index.ts": [
5071
5103
  "../src/entity/address.ts",
5072
5104
  "../src/entity/apicredential.ts",
5105
+ "../src/entity/attribute.ts",
5073
5106
  "../src/entity/auditedmodel.ts",
5074
5107
  "../src/entity/bankaccount.ts",
5075
5108
  "../src/entity/business.ts",
5076
5109
  "../src/entity/businessproducts.ts",
5077
5110
  "../src/entity/cardregistration.ts",
5078
5111
  "../src/entity/category.ts",
5112
+ "../src/entity/categoryimages.ts",
5079
5113
  "../src/entity/channel.ts",
5080
5114
  "../src/entity/channelgroup.ts",
5081
5115
  "../src/entity/channeluser.ts",
@@ -5122,6 +5156,7 @@
5122
5156
  "../src/entity/permission.ts",
5123
5157
  "../src/entity/price.entity.ts",
5124
5158
  "../src/entity/product.entity.ts",
5159
+ "../src/entity/productattribute.ts",
5125
5160
  "../src/entity/request.ts",
5126
5161
  "../src/entity/return.ts",
5127
5162
  "../src/entity/returnaddress.ts",
@@ -5272,11 +5307,18 @@
5272
5307
  "../src/entity/modules/shipping/productshipping.ts",
5273
5308
  "../src/entity/option.ts",
5274
5309
  "../src/entity/price.entity.ts",
5310
+ "../src/entity/productattribute.ts",
5275
5311
  "../src/entity/subcategory.ts",
5276
5312
  "../src/entity/user.ts",
5277
5313
  "../src/entity/variant.ts",
5278
5314
  "../src/staticdata/currency.ts"
5279
5315
  ],
5316
+ "../src/entity/productattribute.ts": [
5317
+ "../node_modules/typeorm/index.d.ts",
5318
+ "../src/entity/attribute.ts",
5319
+ "../src/entity/auditedmodel.ts",
5320
+ "../src/entity/product.entity.ts"
5321
+ ],
5280
5322
  "../src/entity/request.ts": [
5281
5323
  "../node_modules/typeorm/index.d.ts",
5282
5324
  "../src/entity/auditedmodel.ts",
@@ -5538,6 +5580,9 @@
5538
5580
  "../src/migrations/1676656657956-task-1084v1.ts": [
5539
5581
  "../node_modules/typeorm/index.d.ts"
5540
5582
  ],
5583
+ "../src/migrations/1677706695399-promote_to_production_2023_01_03.ts": [
5584
+ "../node_modules/typeorm/index.d.ts"
5585
+ ],
5541
5586
  "../src/migrations/execute/index.ts": [
5542
5587
  "../src/config/connect.ts"
5543
5588
  ],
@@ -5556,10 +5601,12 @@
5556
5601
  "../src/repositories/index.ts": [
5557
5602
  "../node_modules/typeorm/index.d.ts",
5558
5603
  "../src/entity/apicredential.ts",
5604
+ "../src/entity/attribute.ts",
5559
5605
  "../src/entity/bankaccount.ts",
5560
5606
  "../src/entity/business.ts",
5561
5607
  "../src/entity/cardregistration.ts",
5562
5608
  "../src/entity/category.ts",
5609
+ "../src/entity/categoryimages.ts",
5563
5610
  "../src/entity/channel.ts",
5564
5611
  "../src/entity/channelgroup.ts",
5565
5612
  "../src/entity/channeluser.ts",
@@ -5592,6 +5639,7 @@
5592
5639
  "../src/entity/paymentshopify.ts",
5593
5640
  "../src/entity/permission.ts",
5594
5641
  "../src/entity/product.entity.ts",
5642
+ "../src/entity/productattribute.ts",
5595
5643
  "../src/entity/request.ts",
5596
5644
  "../src/entity/role.ts",
5597
5645
  "../src/entity/rolepermission.ts",
@@ -7446,6 +7494,10 @@
7446
7494
  "../src/entity/auditedmodel.ts",
7447
7495
  "../src/entity/user.ts"
7448
7496
  ],
7497
+ "../src/entity/attribute.ts": [
7498
+ "../src/entity/auditedmodel.ts",
7499
+ "../src/entity/productattribute.ts"
7500
+ ],
7449
7501
  "../src/entity/bankaccount.ts": [
7450
7502
  "../src/entity/auditedmodel.ts"
7451
7503
  ],
@@ -7460,8 +7512,14 @@
7460
7512
  "../src/entity/auditedmodel.ts"
7461
7513
  ],
7462
7514
  "../src/entity/category.ts": [
7515
+ "../src/entity/auditedmodel.ts",
7516
+ "../src/entity/categoryimages.ts",
7463
7517
  "../src/entity/subcategory.ts"
7464
7518
  ],
7519
+ "../src/entity/categoryimages.ts": [
7520
+ "../src/entity/auditedmodel.ts",
7521
+ "../src/entity/category.ts"
7522
+ ],
7465
7523
  "../src/entity/channel.ts": [
7466
7524
  "../src/entity/auditedmodel.ts",
7467
7525
  "../src/entity/channeluser.ts",
@@ -7547,12 +7605,14 @@
7547
7605
  "../src/entity/index.ts": [
7548
7606
  "../src/entity/address.ts",
7549
7607
  "../src/entity/apicredential.ts",
7608
+ "../src/entity/attribute.ts",
7550
7609
  "../src/entity/auditedmodel.ts",
7551
7610
  "../src/entity/bankaccount.ts",
7552
7611
  "../src/entity/business.ts",
7553
7612
  "../src/entity/businessproducts.ts",
7554
7613
  "../src/entity/cardregistration.ts",
7555
7614
  "../src/entity/category.ts",
7615
+ "../src/entity/categoryimages.ts",
7556
7616
  "../src/entity/channel.ts",
7557
7617
  "../src/entity/channelgroup.ts",
7558
7618
  "../src/entity/channeluser.ts",
@@ -7599,6 +7659,7 @@
7599
7659
  "../src/entity/permission.ts",
7600
7660
  "../src/entity/price.entity.ts",
7601
7661
  "../src/entity/product.entity.ts",
7662
+ "../src/entity/productattribute.ts",
7602
7663
  "../src/entity/request.ts",
7603
7664
  "../src/entity/return.ts",
7604
7665
  "../src/entity/returnaddress.ts",
@@ -7716,10 +7777,16 @@
7716
7777
  "../src/entity/modules/shipping/productshipping.ts",
7717
7778
  "../src/entity/option.ts",
7718
7779
  "../src/entity/price.entity.ts",
7780
+ "../src/entity/productattribute.ts",
7719
7781
  "../src/entity/subcategory.ts",
7720
7782
  "../src/entity/user.ts",
7721
7783
  "../src/entity/variant.ts"
7722
7784
  ],
7785
+ "../src/entity/productattribute.ts": [
7786
+ "../src/entity/attribute.ts",
7787
+ "../src/entity/auditedmodel.ts",
7788
+ "../src/entity/product.entity.ts"
7789
+ ],
7723
7790
  "../src/entity/request.ts": [
7724
7791
  "../src/entity/auditedmodel.ts",
7725
7792
  "../src/entity/user.ts"
@@ -7943,6 +8010,9 @@
7943
8010
  "../src/migrations/1676656657956-task-1084v1.ts": [
7944
8011
  "../node_modules/typeorm/index.d.ts"
7945
8012
  ],
8013
+ "../src/migrations/1677706695399-promote_to_production_2023_01_03.ts": [
8014
+ "../node_modules/typeorm/index.d.ts"
8015
+ ],
7946
8016
  "../src/migrations/index.ts": [
7947
8017
  "../src/migrations/1628474597284-initialschema.ts",
7948
8018
  "../src/migrations/1630077596132-removemangopay.ts",
@@ -7958,10 +8028,12 @@
7958
8028
  "../src/repositories/index.ts": [
7959
8029
  "../node_modules/typeorm/index.d.ts",
7960
8030
  "../src/entity/apicredential.ts",
8031
+ "../src/entity/attribute.ts",
7961
8032
  "../src/entity/bankaccount.ts",
7962
8033
  "../src/entity/business.ts",
7963
8034
  "../src/entity/cardregistration.ts",
7964
8035
  "../src/entity/category.ts",
8036
+ "../src/entity/categoryimages.ts",
7965
8037
  "../src/entity/channel.ts",
7966
8038
  "../src/entity/channelgroup.ts",
7967
8039
  "../src/entity/channeluser.ts",
@@ -7994,6 +8066,7 @@
7994
8066
  "../src/entity/paymentshopify.ts",
7995
8067
  "../src/entity/permission.ts",
7996
8068
  "../src/entity/product.entity.ts",
8069
+ "../src/entity/productattribute.ts",
7997
8070
  "../src/entity/request.ts",
7998
8071
  "../src/entity/role.ts",
7999
8072
  "../src/entity/rolepermission.ts",
@@ -8537,12 +8610,14 @@
8537
8610
  "../src/config/connect.ts",
8538
8611
  "../src/entity/address.ts",
8539
8612
  "../src/entity/apicredential.ts",
8613
+ "../src/entity/attribute.ts",
8540
8614
  "../src/entity/auditedmodel.ts",
8541
8615
  "../src/entity/bankaccount.ts",
8542
8616
  "../src/entity/business.ts",
8543
8617
  "../src/entity/businessproducts.ts",
8544
8618
  "../src/entity/cardregistration.ts",
8545
8619
  "../src/entity/category.ts",
8620
+ "../src/entity/categoryimages.ts",
8546
8621
  "../src/entity/channel.ts",
8547
8622
  "../src/entity/channelgroup.ts",
8548
8623
  "../src/entity/channeluser.ts",
@@ -8590,6 +8665,7 @@
8590
8665
  "../src/entity/permission.ts",
8591
8666
  "../src/entity/price.entity.ts",
8592
8667
  "../src/entity/product.entity.ts",
8668
+ "../src/entity/productattribute.ts",
8593
8669
  "../src/entity/request.ts",
8594
8670
  "../src/entity/return.ts",
8595
8671
  "../src/entity/returnaddress.ts",
@@ -8657,6 +8733,7 @@
8657
8733
  "../src/migrations/1676389900564-task-1062v4.ts",
8658
8734
  "../src/migrations/1676558804200-task-1074v1.ts",
8659
8735
  "../src/migrations/1676656657956-task-1084v1.ts",
8736
+ "../src/migrations/1677706695399-promote_to_production_2023_01_03.ts",
8660
8737
  "../src/migrations/execute/index.ts",
8661
8738
  "../src/migrations/index.ts",
8662
8739
  "../src/repositories/index.ts",
package/package.json CHANGED
@@ -1,76 +1,76 @@
1
1
  {
2
- "name": "@reachu/database",
3
- "version": "1.0.0",
4
- "description": "reachu-database",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "scripts": {
8
- "clean": "rm -rf dist && mkdir dist",
9
- "test": "jest",
10
- "build": "yarn clean && tsc",
11
- "start": "node dist/index.js",
12
- "debug": "nodemon --exec 'node --inspect=0.0.0.0:9229 --require ts-node/register src/index.js'",
13
- "debug-dev": "nodemon --inspect src/index.ts",
14
- "dev": "nodemon",
15
- "migration:generate": "ts-node ./node_modules/typeorm/cli.js migration:generate",
16
- "migration:run": "ts-node ./node_modules/typeorm/cli migration:run",
17
- "migration:execute": "ts-node src/migrations/execute/index.ts",
18
- "migration:revert": "ts-node ./node_modules/typeorm/cli migration:revert",
19
- "db:diagram": "ts-node ./node_modules/.bin/typeorm-uml ormconfig.js"
20
- },
21
- "author": "reachu",
22
- "license": "ISC",
23
- "dependencies": {
24
- "@reachu/logger": "1.0.0",
25
- "@reachu/utils": "1.0.0",
26
- "dotenv": "8.0.0",
27
- "express": "4.17.1",
28
- "mysql2": "1.5.2",
29
- "sqlite3": "4.0.9",
30
- "typeorm": "0.2.41",
31
- "typeorm-naming-strategies": "1.1.0",
32
- "shortid": "2.2.16"
33
- },
34
- "devDependencies": {
35
- "@babel/core": "7.12.13",
36
- "@babel/plugin-proposal-class-properties": "7.12.1",
37
- "@babel/plugin-proposal-decorators": "7.12.12",
38
- "@babel/preset-env": "7.12.11",
39
- "@babel/preset-typescript": "7.12.7",
40
- "@types/dotenv": "8.2.0",
41
- "@types/express": "4.17.13",
42
- "@types/express-winston": "4.0.0",
43
- "@types/jest": "27.4.0",
44
- "@types/node": "14.14.22",
45
- "@types/winston": "2.4.4",
46
- "@typescript-eslint/eslint-plugin": "4.14.0",
47
- "@typescript-eslint/parser": "4.14.0",
48
- "eslint": "7.18.0",
49
- "eslint-config-prettier": "7.2.0",
50
- "eslint-plugin-jest": "23.8.2",
51
- "eslint-plugin-prettier": "3.3.1",
52
- "jest": "27.4.5",
53
- "jest-junit": "12.1.0",
54
- "nodemon": "2.0.2",
55
- "prettier": "2.2.1",
56
- "ts-jest": "27.1.2",
57
- "ts-node": "9.1.1",
58
- "typescript": "4.1.3"
59
- },
60
- "jest": {
61
- "preset": "ts-jest",
62
- "testEnvironment": "node",
63
- "setupFilesAfterEnv": [
64
- "./test/setup.ts"
65
- ],
66
- "moduleNameMapper": {
67
- "src/(.*)": "<rootDir>/src/$1"
2
+ "name": "@reachu/database",
3
+ "version": "1.0.2",
4
+ "description": "reachu-database",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "clean": "rm -rf dist && mkdir dist",
9
+ "test": "jest",
10
+ "build": "yarn clean && tsc",
11
+ "start": "node dist/index.js",
12
+ "debug": "nodemon --exec 'node --inspect=0.0.0.0:9229 --require ts-node/register src/index.js'",
13
+ "debug-dev": "nodemon --inspect src/index.ts",
14
+ "dev": "nodemon",
15
+ "migration:generate": "ts-node ./node_modules/typeorm/cli.js migration:generate",
16
+ "migration:run": "ts-node ./node_modules/typeorm/cli migration:run",
17
+ "migration:execute": "ts-node src/migrations/execute/index.ts",
18
+ "migration:revert": "ts-node ./node_modules/typeorm/cli migration:revert",
19
+ "db:diagram": "ts-node ./node_modules/.bin/typeorm-uml ormconfig.js"
68
20
  },
69
- "modulePathIgnorePatterns": [
70
- "./dist"
71
- ]
72
- },
73
- "resolutions": {
74
- "logform": "2.4.2"
75
- }
76
- }
21
+ "author": "reachu",
22
+ "license": "ISC",
23
+ "dependencies": {
24
+ "@reachu/logger": "1.0.2",
25
+ "@reachu/utils": "1.0.2",
26
+ "dotenv": "8.0.0",
27
+ "express": "4.17.1",
28
+ "mysql2": "1.5.2",
29
+ "sqlite3": "4.0.9",
30
+ "typeorm": "0.2.41",
31
+ "typeorm-naming-strategies": "1.1.0",
32
+ "shortid": "2.2.16"
33
+ },
34
+ "devDependencies": {
35
+ "@babel/core": "7.12.13",
36
+ "@babel/plugin-proposal-class-properties": "7.12.1",
37
+ "@babel/plugin-proposal-decorators": "7.12.12",
38
+ "@babel/preset-env": "7.12.11",
39
+ "@babel/preset-typescript": "7.12.7",
40
+ "@types/dotenv": "8.2.0",
41
+ "@types/express": "4.17.13",
42
+ "@types/express-winston": "4.0.0",
43
+ "@types/jest": "27.4.0",
44
+ "@types/node": "14.14.22",
45
+ "@types/winston": "2.4.4",
46
+ "@typescript-eslint/eslint-plugin": "4.14.0",
47
+ "@typescript-eslint/parser": "4.14.0",
48
+ "eslint": "7.18.0",
49
+ "eslint-config-prettier": "7.2.0",
50
+ "eslint-plugin-jest": "23.8.2",
51
+ "eslint-plugin-prettier": "3.3.1",
52
+ "jest": "27.4.5",
53
+ "jest-junit": "12.1.0",
54
+ "nodemon": "2.0.2",
55
+ "prettier": "2.2.1",
56
+ "ts-jest": "27.1.2",
57
+ "ts-node": "9.1.1",
58
+ "typescript": "4.1.3"
59
+ },
60
+ "jest": {
61
+ "preset": "ts-jest",
62
+ "testEnvironment": "node",
63
+ "setupFilesAfterEnv": [
64
+ "./test/setup.ts"
65
+ ],
66
+ "moduleNameMapper": {
67
+ "src/(.*)": "<rootDir>/src/$1"
68
+ },
69
+ "modulePathIgnorePatterns": [
70
+ "./dist"
71
+ ]
72
+ },
73
+ "resolutions": {
74
+ "logform": "2.4.2"
75
+ }
76
+ }
@@ -0,0 +1,30 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ DeleteDateColumn,
6
+ OneToMany,
7
+ JoinColumn,
8
+ } from 'typeorm';
9
+ import AuditedModel from './AuditedModel';
10
+ import ProductAttribute from './ProductAttribute';
11
+
12
+ @Entity()
13
+ export default class Attribute extends AuditedModel {
14
+ @PrimaryGeneratedColumn()
15
+ id: number;
16
+
17
+ @DeleteDateColumn()
18
+ deletedAt: Date;
19
+
20
+ @Column('varchar', { nullable: false })
21
+ name: string;
22
+
23
+ @OneToMany(
24
+ () => ProductAttribute,
25
+ (productAttribute: ProductAttribute) => productAttribute.attribute,
26
+ { cascade: true },
27
+ )
28
+ @JoinColumn()
29
+ productAttribute: ProductAttribute[];
30
+ }
@@ -1,8 +1,18 @@
1
- import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from 'typeorm';
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ OneToMany,
6
+ DeleteDateColumn,
7
+ ManyToOne,
8
+ JoinColumn,
9
+ } from 'typeorm';
10
+ import AuditedModel from './AuditedModel';
11
+ import CategoryImages from './CategoryImages';
2
12
  import Subcategory from './Subcategory';
3
13
 
4
14
  @Entity()
5
- export default class Category {
15
+ export default class Category extends AuditedModel {
6
16
  @PrimaryGeneratedColumn()
7
17
  id: number;
8
18
 
@@ -12,5 +22,21 @@ export default class Category {
12
22
  @OneToMany(() => Subcategory, (subcategory) => subcategory.category)
13
23
  subcategories: Subcategory[];
14
24
 
25
+ @DeleteDateColumn()
26
+ deletedAt: Date;
27
+
28
+ @Column('varchar', { nullable: true })
29
+ slug: string;
30
+
31
+ @Column('integer', { nullable: true })
32
+ menuOrder: number;
33
+
34
+ @ManyToOne(() => CategoryImages, (categoryImages: CategoryImages) => categoryImages.category, {
35
+ eager: true,
36
+ onDelete: 'CASCADE',
37
+ })
38
+ @JoinColumn()
39
+ categoryImages: CategoryImages;
40
+
15
41
  static getCacheKey = () => 'CATEGORIES';
16
42
  }
@@ -0,0 +1,38 @@
1
+ import {
2
+ Entity,
3
+ PrimaryGeneratedColumn,
4
+ Column,
5
+ OneToMany,
6
+ DeleteDateColumn,
7
+ JoinColumn,
8
+ } from 'typeorm';
9
+ import AuditedModel from './AuditedModel';
10
+ import Category from './Category';
11
+
12
+ @Entity()
13
+ export default class CategoryImages extends AuditedModel {
14
+ @PrimaryGeneratedColumn()
15
+ id: number;
16
+
17
+ @DeleteDateColumn()
18
+ deletedAt: Date;
19
+
20
+ @Column('varchar', { nullable: true })
21
+ srcn: string;
22
+
23
+ @Column('varchar', { nullable: true })
24
+ slug: string;
25
+
26
+ @Column('varchar', { nullable: true })
27
+ name: string;
28
+
29
+ @Column('varchar', { nullable: true })
30
+ src: string;
31
+
32
+ @Column('varchar', { nullable: true })
33
+ alt: string;
34
+
35
+ @OneToMany(() => Category, (category: Category) => category.categoryImages, { cascade: true })
36
+ @JoinColumn()
37
+ category: Category[];
38
+ }
@@ -26,6 +26,7 @@ import { currencies } from '../staticData/Currency';
26
26
  import { Price } from './Price.entity';
27
27
  import ProductShipping from './modules/shipping/ProductShipping';
28
28
  import { CustomProduct } from './CustomProduct';
29
+ import ProductAttribute from './ProductAttribute';
29
30
 
30
31
  @Entity()
31
32
  export class Product extends AuditedModel {
@@ -169,6 +170,14 @@ export class Product extends AuditedModel {
169
170
  @JoinColumn()
170
171
  customProduct: CustomProduct;
171
172
 
173
+ @OneToMany(
174
+ () => ProductAttribute,
175
+ (productAttribute: ProductAttribute) => productAttribute.product,
176
+ { cascade: true },
177
+ )
178
+ @JoinColumn()
179
+ productAttribute: ProductAttribute[];
180
+
172
181
  @AfterLoad()
173
182
  convertNumerics() {
174
183
  const diff = (this.referralFee * this.publicPrice) / 100;
@@ -0,0 +1,27 @@
1
+ import { Entity, PrimaryGeneratedColumn, DeleteDateColumn, ManyToOne, JoinColumn } from 'typeorm';
2
+ import Attribute from './Attribute';
3
+ import AuditedModel from './AuditedModel';
4
+ import { Product } from './Product.entity';
5
+
6
+ @Entity()
7
+ export default class ProductAttribute extends AuditedModel {
8
+ @PrimaryGeneratedColumn()
9
+ id: number;
10
+
11
+ @DeleteDateColumn()
12
+ deletedAt: Date;
13
+
14
+ @ManyToOne(() => Attribute, (attribute: Attribute) => attribute.productAttribute, {
15
+ eager: true,
16
+ onDelete: 'CASCADE',
17
+ })
18
+ @JoinColumn()
19
+ attribute: Attribute;
20
+
21
+ @ManyToOne(() => Product, (product: Product) => product.productAttribute, {
22
+ eager: true,
23
+ onDelete: 'CASCADE',
24
+ })
25
+ @JoinColumn()
26
+ product: Product;
27
+ }
@@ -74,6 +74,10 @@ import CustomVariant from './CustomVariant';
74
74
  import { CustomProduct } from './CustomProduct';
75
75
  import CustomProductImage from './CustomProductImage';
76
76
 
77
+ import Attribute from './Attribute';
78
+ import ProductAttribute from './ProductAttribute';
79
+ import CategoryImages from './CategoryImages';
80
+
77
81
  export {
78
82
  CustomVariant,
79
83
  CustomProduct,
@@ -145,4 +149,7 @@ export {
145
149
  UserChannelApiKey,
146
150
  Currency,
147
151
  ExchangeRate,
152
+ Attribute,
153
+ ProductAttribute,
154
+ CategoryImages,
148
155
  };