@b2y/ecommerce-common 1.2.9 → 1.3.1

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.
@@ -51,7 +51,8 @@ const initializeModels = (sequelize) => {
51
51
  SubscriptionPlanFeature,
52
52
  TenantSubscription,
53
53
  ProductImport,
54
- ProductImportFailureAudits
54
+ ProductImportFailureAudits,
55
+ PackagingBox
55
56
  } = models;
56
57
  Category.hasMany(Category, {
57
58
  foreignKey: "ParentCategoryID",
@@ -0,0 +1,7 @@
1
+ const PackageBoxTypeEnum = Object.freeze({
2
+ BOX: "Box",
3
+ ENVELOPE: "Envelope",
4
+ SOFT_PACKAGE: "Soft Package"
5
+ });
6
+
7
+ module.exports = PackageBoxTypeEnum;
package/index.js CHANGED
@@ -7,7 +7,7 @@ const TenantSettingsAbstractController = require('./controller/TenantSettingsAbs
7
7
  const LocationController = require('./controller/LocationController');
8
8
  const CommonAppConstants = require('./constants/AppConstants');
9
9
  const CommonStatusMessage = require('./constants/StatusMessageConstants');
10
- const RawQueryBuilder = require('./scripts/RawQueryBuilder');
10
+ const QueryBuilder = require('./scripts/QueryBuilder');
11
11
  const enums = {};
12
12
  const enumDir = path.join(__dirname, 'enum');
13
13
  fs.readdirSync(enumDir).forEach((file) => {
@@ -25,4 +25,4 @@ fs.readdirSync(utilDir).forEach((file) => {
25
25
  }
26
26
  })
27
27
 
28
- module.exports = {initializeModels, enums, utils, CommonAppConstants, CommonStatusMessage, SubscriptionAbstractController, TenantAbstractController, TenantSettingsAbstractController, LocationController, RawQueryBuilder};
28
+ module.exports = {initializeModels, enums, utils, CommonAppConstants, CommonStatusMessage, SubscriptionAbstractController, TenantAbstractController, TenantSettingsAbstractController, LocationController, QueryBuilder};
@@ -0,0 +1,78 @@
1
+ const { DataTypes } = require('sequelize');
2
+ module.exports = (sequelize) => {
3
+ return sequelize.define('PackagingBox', {
4
+ PackagingBoxID: {
5
+ type: DataTypes.UUID,
6
+ primaryKey: true,
7
+ allowNull: false,
8
+ defaultValue: DataTypes.UUIDV4
9
+ },
10
+ TenantID: {
11
+ type: DataTypes.UUID,
12
+ allowNull: false,
13
+ references: {
14
+ model: 'Tenant',
15
+ key: 'TenantID'
16
+ },
17
+ onDelete: 'CASCADE',
18
+ onUpdate: 'CASCADE'
19
+ },
20
+ PackageType: {
21
+ type: DataTypes.STRING(255),
22
+ allowNull: false,
23
+ },
24
+ PackageName: {
25
+ type: DataTypes.STRING(100),
26
+ allowNull: false
27
+ },
28
+ Length: {
29
+ type: DataTypes.DECIMAL(10, 2),
30
+ allowNull: false
31
+ },
32
+ Width: {
33
+ type: DataTypes.DECIMAL(10, 2),
34
+ allowNull: false
35
+ },
36
+ Height: {
37
+ type: DataTypes.DECIMAL(10, 2),
38
+ allowNull: true
39
+ },
40
+ Unit: {
41
+ type: DataTypes.STRING(5),
42
+ allowNull: false
43
+ },
44
+ EmptyWeight: {
45
+ type: DataTypes.DECIMAL(10, 2),
46
+ allowNull: false
47
+ },
48
+ WeightUnit: {
49
+ type: DataTypes.STRING(5),
50
+ allowNull: false,
51
+ },
52
+ IsDefaultPackage: {
53
+ type: DataTypes.BOOLEAN,
54
+ defaultValue: false
55
+ },
56
+ CreatedBy: {
57
+ type: DataTypes.UUID,
58
+ allowNull: false
59
+ },
60
+ CreatedAt: {
61
+ type: DataTypes.DATE,
62
+ allowNull: false,
63
+ defaultValue: DataTypes.NOW
64
+ },
65
+ UpdatedBy: {
66
+ type: DataTypes.UUID,
67
+ allowNull: false
68
+ },
69
+ UpdatedAt: {
70
+ type: DataTypes.DATE,
71
+ allowNull: false,
72
+ defaultValue: DataTypes.NOW
73
+ }
74
+ }, {
75
+ tableName: 'PackagingBox',
76
+ timestamps: false
77
+ });
78
+ };
@@ -51,6 +51,32 @@ module.exports = (sequelize) => {
51
51
  type: DataTypes.BOOLEAN,
52
52
  defaultValue: true
53
53
  },
54
+ Weight: {
55
+ type: DataTypes.DECIMAL(10, 2),
56
+ allowNull: false
57
+ },
58
+ Unit: {
59
+ type: DataTypes.STRING(5),
60
+ allowNull: false
61
+ },
62
+ CountryCode: {
63
+ type: DataTypes.STRING(2),
64
+ allowNull: true
65
+ },
66
+ HSCode: {
67
+ type: DataTypes.STRING(10),
68
+ allowNull: true
69
+ },
70
+ PackagingBoxID: {
71
+ type: DataTypes.UUID,
72
+ allowNull: false,
73
+ references: {
74
+ model: 'PackagingBox',
75
+ key: 'PackagingBoxID'
76
+ },
77
+ onDelete: 'RESTRICT',
78
+ onUpdate: 'CASCADE'
79
+ },
54
80
  GroupByAttributeValue: {
55
81
  type: DataTypes.UUID,
56
82
  allowNull: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@b2y/ecommerce-common",
3
- "version": "1.2.9",
3
+ "version": "1.3.1",
4
4
  "description": "E-commerce common library",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -160,4 +160,4 @@ static productQueryBuilder(filters) {
160
160
  )`;
161
161
  }
162
162
  }
163
- module.exports = RawQueryBuilder;
163
+ module.exports = QueryBuilder;