@b2y/ecommerce-common 1.4.1 → 1.4.3

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 (99) hide show
  1. package/.idea/ecommerce-common.iml +11 -11
  2. package/.idea/modules.xml +7 -7
  3. package/.idea/vcs.xml +5 -5
  4. package/README.md +4 -4
  5. package/constants/AppConstants.js +16 -16
  6. package/constants/AuditConstants.js +16 -0
  7. package/constants/ReportConstants.js +14 -14
  8. package/constants/StatusMessageConstants.js +61 -61
  9. package/controller/LocationController.js +144 -144
  10. package/controller/SubscriptionAbstractController.js +91 -91
  11. package/controller/TenantAbstractController.js +152 -152
  12. package/controller/TenantSettingsAbstractController.js +259 -259
  13. package/dbconnection/Connect.js +498 -498
  14. package/enum/AccessModeEnum.js +8 -8
  15. package/enum/ActionByTypeEnum.js +4 -4
  16. package/enum/AddressTypeEnum.js +6 -6
  17. package/enum/BillingCycleEnum.js +5 -5
  18. package/enum/BooleanEnum.js +4 -4
  19. package/enum/BulkImportStatusEnum.js +6 -6
  20. package/enum/DimensionUnitEnum.js +5 -5
  21. package/enum/EntityTypeEnum.js +12 -12
  22. package/enum/FeatureTypeEnum.js +6 -6
  23. package/enum/GenderEnum.js +7 -7
  24. package/enum/NotificationStatusEnum.js +5 -5
  25. package/enum/NotificationTypeEnum.js +9 -9
  26. package/enum/OrderActionStatusEnum.js +7 -7
  27. package/enum/OrderStatusEnum.js +8 -8
  28. package/enum/PackageBoxTypeEnum.js +6 -6
  29. package/enum/PaymentMethodEnum.js +6 -6
  30. package/enum/PaymentStatusEnum.js +6 -6
  31. package/enum/PaymentTypeEnum.js +6 -6
  32. package/enum/PlatformEnum.js +4 -4
  33. package/enum/ReasonTypeEnum.js +6 -6
  34. package/enum/RegistrationStatusEnum.js +5 -5
  35. package/enum/SortByEnum.js +7 -7
  36. package/enum/SubscriptionStatusEnum.js +7 -7
  37. package/enum/WeightUnitEnum.js +6 -6
  38. package/index.js +29 -28
  39. package/model/Address.js +95 -95
  40. package/model/AttributeType.js +50 -50
  41. package/model/AttributeValue.js +64 -64
  42. package/model/Banner.js +78 -78
  43. package/model/Brand.js +76 -76
  44. package/model/Cart.js +76 -76
  45. package/model/Category.js +72 -72
  46. package/model/CategoryAttributeType.js +62 -62
  47. package/model/Colour.js +52 -52
  48. package/model/Customer.js +98 -94
  49. package/model/DeviceToken.js +51 -51
  50. package/model/Document.js +73 -73
  51. package/model/DynamicUIComponent.js +52 -52
  52. package/model/Feedback.js +79 -79
  53. package/model/Inventory.js +87 -87
  54. package/model/NotificationHistory.js +67 -67
  55. package/model/Order.js +84 -84
  56. package/model/OrderActionReason.js +99 -99
  57. package/model/OrderItem.js +98 -98
  58. package/model/OrderItemHistory.js +69 -69
  59. package/model/OrderStatus.js +48 -48
  60. package/model/PackagingBox.js +78 -78
  61. package/model/Payment.js +101 -101
  62. package/model/PaymentMethod.js +36 -36
  63. package/model/PaymentStatus.js +36 -36
  64. package/model/PaymentType.js +36 -36
  65. package/model/Permission.js +45 -55
  66. package/model/Product.js +97 -97
  67. package/model/ProductGroup.js +48 -48
  68. package/model/ProductImport.js +55 -55
  69. package/model/ProductImportFailureAudits.js +57 -57
  70. package/model/ProductSpecification.js +65 -65
  71. package/model/ProductVariant.js +111 -111
  72. package/model/ProductVariantAttribute.js +58 -58
  73. package/model/ReasonContextMapping.js +70 -70
  74. package/model/ReasonMaster.js +74 -74
  75. package/model/Role.js +61 -61
  76. package/model/RolePermissionMapping.js +63 -63
  77. package/model/SpecificationType.js +41 -41
  78. package/model/Store.js +99 -99
  79. package/model/StoreUserMapping.js +44 -44
  80. package/model/SubscriptionFeature.js +53 -53
  81. package/model/SubscriptionPlan.js +70 -70
  82. package/model/SubscriptionPlanFeature.js +48 -48
  83. package/model/Tenant.js +91 -91
  84. package/model/TenantSettings.js +47 -47
  85. package/model/TenantSubscription.js +73 -73
  86. package/model/User.js +132 -132
  87. package/model/WishList.js +62 -62
  88. package/package.json +30 -30
  89. package/scripts/QueryBuilder.js +162 -162
  90. package/utility/AppUtil.js +69 -69
  91. package/utility/DateUtil.js +55 -55
  92. package/utility/ExcelUtil.js +125 -125
  93. package/utility/LocationUtility.js +130 -130
  94. package/utility/OrderTimeFilterUtil.js +88 -88
  95. package/utility/PdfUtil.js +67 -67
  96. package/utility/QueryUtil.js +261 -261
  97. package/utility/Razorpay.js +65 -65
  98. package/utility/ResolveAccessMode.js +61 -61
  99. package/utility/VariantPriceUtil.js +54 -54
@@ -1,9 +1,9 @@
1
- const AccessModeEnum = Object.freeze({
2
- FULL: "Full",
3
- READ_ONLY: "Read Only",
4
- BLOCKED: "Blocked",
5
- PAYMENT_REQUIRED: "Payment Required",
6
- RENEW_SUBSCRIPTION: "Renew Subscription"
7
- });
8
-
1
+ const AccessModeEnum = Object.freeze({
2
+ FULL: "Full",
3
+ READ_ONLY: "Read Only",
4
+ BLOCKED: "Blocked",
5
+ PAYMENT_REQUIRED: "Payment Required",
6
+ RENEW_SUBSCRIPTION: "Renew Subscription"
7
+ });
8
+
9
9
  module.exports = AccessModeEnum;
@@ -1,5 +1,5 @@
1
- const ActionByTypeEnum = Object.freeze({
2
- CUSTOMER: "Customer",
3
- ADMIN: "Admin"
4
- });
1
+ const ActionByTypeEnum = Object.freeze({
2
+ CUSTOMER: "Customer",
3
+ ADMIN: "Admin"
4
+ });
5
5
  module.exports = ActionByTypeEnum;
@@ -1,7 +1,7 @@
1
- const AddressTypeEnum = Object.freeze({
2
- HOME: "Home",
3
- WORK: "Work",
4
- OTHER: "Other"
5
- });
6
-
1
+ const AddressTypeEnum = Object.freeze({
2
+ HOME: "Home",
3
+ WORK: "Work",
4
+ OTHER: "Other"
5
+ });
6
+
7
7
  module.exports = AddressTypeEnum;
@@ -1,6 +1,6 @@
1
- const BillingCycleEnum = Object.freeze({
2
- MONTHLY: "Monthly",
3
- YEARLY: "Yearly"
4
- });
5
-
1
+ const BillingCycleEnum = Object.freeze({
2
+ MONTHLY: "Monthly",
3
+ YEARLY: "Yearly"
4
+ });
5
+
6
6
  module.exports = BillingCycleEnum;
@@ -1,5 +1,5 @@
1
- const BooleanEnum = Object.freeze({
2
- TRUE: true,
3
- FALSE: false
4
- });
1
+ const BooleanEnum = Object.freeze({
2
+ TRUE: true,
3
+ FALSE: false
4
+ });
5
5
  module.exports = BooleanEnum;
@@ -1,7 +1,7 @@
1
- const BulkImportStatusEnum = Object.freeze({
2
- SUCCESS: "Success",
3
- FAILURE: "Failure",
4
- PARTIAL_SUCCESS: "Partial Success"
5
- });
6
-
1
+ const BulkImportStatusEnum = Object.freeze({
2
+ SUCCESS: "Success",
3
+ FAILURE: "Failure",
4
+ PARTIAL_SUCCESS: "Partial Success"
5
+ });
6
+
7
7
  module.exports = BulkImportStatusEnum;
@@ -1,6 +1,6 @@
1
- const DimensionUnitEnum = Object.freeze({
2
- CENTIMETER: "cm",
3
- INCH: "in",
4
- METER: "m"
5
- })
1
+ const DimensionUnitEnum = Object.freeze({
2
+ CENTIMETER: "cm",
3
+ INCH: "in",
4
+ METER: "m"
5
+ })
6
6
  module.exports = DimensionUnitEnum
@@ -1,13 +1,13 @@
1
- const EntityTypeEnum = Object.freeze({
2
- USER: "User",
3
- BRAND: "Brand",
4
- CATEGORY: "Category",
5
- PRODUCT_VARIANT: "ProductVariant",
6
- BANNER: "Banner",
7
- FEEDBACK:"Feedback",
8
- NOTIFICATION: 'Notification',
9
- TENANT_SETTINGS: 'TenantSettings',
10
- REASON: 'Reason'
11
- });
12
-
1
+ const EntityTypeEnum = Object.freeze({
2
+ USER: "User",
3
+ BRAND: "Brand",
4
+ CATEGORY: "Category",
5
+ PRODUCT_VARIANT: "ProductVariant",
6
+ BANNER: "Banner",
7
+ FEEDBACK:"Feedback",
8
+ NOTIFICATION: 'Notification',
9
+ TENANT_SETTINGS: 'TenantSettings',
10
+ REASON: 'Reason'
11
+ });
12
+
13
13
  module.exports = EntityTypeEnum;
@@ -1,7 +1,7 @@
1
- const FeatureTypeEnum = Object.freeze({
2
- BOOLEAN: "Boolean",
3
- LIMIT: "Limit",
4
- METERED: "Metered"
5
- });
6
-
1
+ const FeatureTypeEnum = Object.freeze({
2
+ BOOLEAN: "Boolean",
3
+ LIMIT: "Limit",
4
+ METERED: "Metered"
5
+ });
6
+
7
7
  module.exports = FeatureTypeEnum;
@@ -1,7 +1,7 @@
1
- const GenderEnum = Object.freeze({
2
- MALE: "Male",
3
- FEMALE: "Female",
4
- OTHER: "Other"
5
- });
6
- module.exports = GenderEnum;
7
-
1
+ const GenderEnum = Object.freeze({
2
+ MALE: "Male",
3
+ FEMALE: "Female",
4
+ OTHER: "Other"
5
+ });
6
+ module.exports = GenderEnum;
7
+
@@ -1,6 +1,6 @@
1
- const NotificationStatusEnum = Object.freeze({
2
- SENT: "Sent",
3
- FAILED: "Failed",
4
- PENDING: "Pending"
5
- });
1
+ const NotificationStatusEnum = Object.freeze({
2
+ SENT: "Sent",
3
+ FAILED: "Failed",
4
+ PENDING: "Pending"
5
+ });
6
6
  module.exports = NotificationStatusEnum;
@@ -1,10 +1,10 @@
1
- const NotificationTypeEnum = Object.freeze({
2
-
3
- DYNAMIC: "Dynamic",
4
- PUSH: "Push",
5
- EMAIL: "Email",
6
- SMS: "Sms"
7
-
8
- });
9
-
1
+ const NotificationTypeEnum = Object.freeze({
2
+
3
+ DYNAMIC: "Dynamic",
4
+ PUSH: "Push",
5
+ EMAIL: "Email",
6
+ SMS: "Sms"
7
+
8
+ });
9
+
10
10
  module.exports = NotificationTypeEnum;
@@ -1,7 +1,7 @@
1
- const OrderActionStatusEnum = Object.freeze({
2
- PENDING: "Pending",
3
- APPROVED: "Approved",
4
- REJECTED: "Rejected",
5
- COMPLETED: "Completed"
6
- });
7
- module.exports = OrderActionStatusEnum;
1
+ const OrderActionStatusEnum = Object.freeze({
2
+ PENDING: "Pending",
3
+ APPROVED: "Approved",
4
+ REJECTED: "Rejected",
5
+ COMPLETED: "Completed"
6
+ });
7
+ module.exports = OrderActionStatusEnum;
@@ -1,9 +1,9 @@
1
- const OrderStatusEnum = Object.freeze({
2
- PENDING: "Pending",
3
- PROCESSING: "Processing",
4
- SHIPPED: "Shipped",
5
- DELIVERED: "Delivered",
6
- CANCELLED: "Cancelled",
7
- RETURNED: "Returned"
8
- });
1
+ const OrderStatusEnum = Object.freeze({
2
+ PENDING: "Pending",
3
+ PROCESSING: "Processing",
4
+ SHIPPED: "Shipped",
5
+ DELIVERED: "Delivered",
6
+ CANCELLED: "Cancelled",
7
+ RETURNED: "Returned"
8
+ });
9
9
  module.exports = OrderStatusEnum;
@@ -1,7 +1,7 @@
1
- const PackageBoxTypeEnum = Object.freeze({
2
- BOX: "Box",
3
- ENVELOPE: "Envelope",
4
- SOFT_PACKAGE: "Soft Package"
5
- });
6
-
1
+ const PackageBoxTypeEnum = Object.freeze({
2
+ BOX: "Box",
3
+ ENVELOPE: "Envelope",
4
+ SOFT_PACKAGE: "Soft Package"
5
+ });
6
+
7
7
  module.exports = PackageBoxTypeEnum;
@@ -1,7 +1,7 @@
1
- const PaymentMethodEnum = Object.freeze({
2
- NET_BANKING: "NetBanking",
3
- UPI: "UPI",
4
- WALLET: "Wallet",
5
- CARD: "Card",
6
- });
1
+ const PaymentMethodEnum = Object.freeze({
2
+ NET_BANKING: "NetBanking",
3
+ UPI: "UPI",
4
+ WALLET: "Wallet",
5
+ CARD: "Card",
6
+ });
7
7
  module.exports = PaymentMethodEnum;
@@ -1,7 +1,7 @@
1
- const PaymentStatusEnum = Object.freeze({
2
- PENDING: "Pending",
3
- PAID: "Paid",
4
- FAILED: "Failed",
5
- REFUNDED: "Refunded"
6
- });
1
+ const PaymentStatusEnum = Object.freeze({
2
+ PENDING: "Pending",
3
+ PAID: "Paid",
4
+ FAILED: "Failed",
5
+ REFUNDED: "Refunded"
6
+ });
7
7
  module.exports = PaymentStatusEnum;
@@ -1,7 +1,7 @@
1
- const PaymentTypeEnum = Object.freeze({
2
- CASH_ON_DELIVERY: "Cash On Delivery",
3
- RAZORPAY: "Razorpay",
4
- JUSPAY: "Juspay",
5
- PAY_U: "PayU"
6
- });
1
+ const PaymentTypeEnum = Object.freeze({
2
+ CASH_ON_DELIVERY: "Cash On Delivery",
3
+ RAZORPAY: "Razorpay",
4
+ JUSPAY: "Juspay",
5
+ PAY_U: "PayU"
6
+ });
7
7
  module.exports = PaymentTypeEnum;
@@ -1,5 +1,5 @@
1
- const PlatformEnum = Object.freeze({
2
- ANDROID: "Android",
3
- IOS: "Ios"
4
- });
1
+ const PlatformEnum = Object.freeze({
2
+ ANDROID: "Android",
3
+ IOS: "Ios"
4
+ });
5
5
  module.exports = PlatformEnum;
@@ -1,7 +1,7 @@
1
- const ReasonTypeEnum = Object.freeze({
2
- RETURN: "Return",
3
- CANCEL: "Cancel",
4
- REPLACE: "Replace"
5
- });
6
-
1
+ const ReasonTypeEnum = Object.freeze({
2
+ RETURN: "Return",
3
+ CANCEL: "Cancel",
4
+ REPLACE: "Replace"
5
+ });
6
+
7
7
  module.exports = ReasonTypeEnum;
@@ -1,6 +1,6 @@
1
- const RegistrationStatusEnum = Object.freeze({
2
- INITIATED: "Initiated",
3
- VERIFIED: "Verified",
4
- COMPLETED: "Completed"
5
- });
1
+ const RegistrationStatusEnum = Object.freeze({
2
+ INITIATED: "Initiated",
3
+ VERIFIED: "Verified",
4
+ COMPLETED: "Completed"
5
+ });
6
6
  module.exports = RegistrationStatusEnum;
@@ -1,8 +1,8 @@
1
- const SortByEnum = Object.freeze({
2
- LOW_TO_HIGH: "lowToHigh",
3
- HIGH_TO_LOW: "highToLow",
4
- DISCOUNT: "discount",
5
- NEW_ARRIVAL: "newArrival",
6
- CUSTOMER_RATING: "customerRating"
7
- });
1
+ const SortByEnum = Object.freeze({
2
+ LOW_TO_HIGH: "lowToHigh",
3
+ HIGH_TO_LOW: "highToLow",
4
+ DISCOUNT: "discount",
5
+ NEW_ARRIVAL: "newArrival",
6
+ CUSTOMER_RATING: "customerRating"
7
+ });
8
8
  module.exports = SortByEnum;
@@ -1,8 +1,8 @@
1
- const SubscriptionStatusEnum = Object.freeze({
2
- ACTIVE: "Active",
3
- CANCELLED: "Cancelled",
4
- SUSPENDED: "Suspended",
5
- EXPIRED: "Expired"
6
- });
7
-
1
+ const SubscriptionStatusEnum = Object.freeze({
2
+ ACTIVE: "Active",
3
+ CANCELLED: "Cancelled",
4
+ SUSPENDED: "Suspended",
5
+ EXPIRED: "Expired"
6
+ });
7
+
8
8
  module.exports = SubscriptionStatusEnum;
@@ -1,7 +1,7 @@
1
- const WeightUnitEnum = Object.freeze({
2
- KILOGRAM: "kg",
3
- GRAM: "g",
4
- OUNCE: "oz",
5
- POUND: "lb"
6
- });
1
+ const WeightUnitEnum = Object.freeze({
2
+ KILOGRAM: "kg",
3
+ GRAM: "g",
4
+ OUNCE: "oz",
5
+ POUND: "lb"
6
+ });
7
7
  module.exports = WeightUnitEnum;
package/index.js CHANGED
@@ -1,28 +1,29 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const initializeModels = require('./dbconnection/Connect');
4
- const SubscriptionAbstractController = require('./controller/SubscriptionAbstractController');
5
- const TenantAbstractController = require('./controller/TenantAbstractController');
6
- const TenantSettingsAbstractController = require('./controller/TenantSettingsAbstractController');
7
- const LocationController = require('./controller/LocationController');
8
- const CommonAppConstants = require('./constants/AppConstants');
9
- const CommonStatusMessage = require('./constants/StatusMessageConstants');
10
- const QueryBuilder = require('./scripts/QueryBuilder');
11
- const enums = {};
12
- const enumDir = path.join(__dirname, 'enum');
13
- fs.readdirSync(enumDir).forEach((file) => {
14
- if (file.endsWith('.js')) {
15
- const enumName = path.basename(file, '.js');
16
- enums[enumName] = require(path.join(enumDir, file));
17
- }
18
- });
19
- const utils = {};
20
- const utilDir = path.join(__dirname, 'utility');
21
- fs.readdirSync(utilDir).forEach((file) => {
22
- if(file.endsWith('.js')){
23
- const utilName = path.basename(file, '.js');
24
- utils[utilName] = require(path.join(utilDir, file));
25
- }
26
- })
27
-
28
- module.exports = {initializeModels, enums, utils, CommonAppConstants, CommonStatusMessage, SubscriptionAbstractController, TenantAbstractController, TenantSettingsAbstractController, LocationController, QueryBuilder};
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const initializeModels = require('./dbconnection/Connect');
4
+ const SubscriptionAbstractController = require('./controller/SubscriptionAbstractController');
5
+ const TenantAbstractController = require('./controller/TenantAbstractController');
6
+ const TenantSettingsAbstractController = require('./controller/TenantSettingsAbstractController');
7
+ const LocationController = require('./controller/LocationController');
8
+ const CommonAppConstants = require('./constants/AppConstants');
9
+ const CommonStatusMessage = require('./constants/StatusMessageConstants');
10
+ const AuditConstants = require('./constants/AuditConstants');
11
+ const QueryBuilder = require('./scripts/QueryBuilder');
12
+ const enums = {};
13
+ const enumDir = path.join(__dirname, 'enum');
14
+ fs.readdirSync(enumDir).forEach((file) => {
15
+ if (file.endsWith('.js')) {
16
+ const enumName = path.basename(file, '.js');
17
+ enums[enumName] = require(path.join(enumDir, file));
18
+ }
19
+ });
20
+ const utils = {};
21
+ const utilDir = path.join(__dirname, 'utility');
22
+ fs.readdirSync(utilDir).forEach((file) => {
23
+ if(file.endsWith('.js')){
24
+ const utilName = path.basename(file, '.js');
25
+ utils[utilName] = require(path.join(utilDir, file));
26
+ }
27
+ })
28
+
29
+ module.exports = {initializeModels, enums, utils, CommonAppConstants, CommonStatusMessage, AuditConstants, SubscriptionAbstractController, TenantAbstractController, TenantSettingsAbstractController, LocationController, QueryBuilder};
package/model/Address.js CHANGED
@@ -1,96 +1,96 @@
1
- const { DataTypes } = require('sequelize');
2
- const AddressTypeEnum = require('../enum/AddressTypeEnum');
3
- module.exports = (sequelize) => {
4
- return sequelize.define('Address', {
5
- AddressID: {
6
- type: DataTypes.UUID,
7
- primaryKey: true,
8
- allowNull: false,
9
- defaultValue: DataTypes.UUIDV4
10
- },
11
- TenantID: {
12
- type: DataTypes.UUID,
13
- allowNull: false,
14
- references: {
15
- model: 'Tenant',
16
- key: 'TenantID'
17
- },
18
- onDelete: 'CASCADE',
19
- onUpdate: 'CASCADE'
20
- },
21
- CustomerID: {
22
- type: DataTypes.UUID,
23
- allowNull: false,
24
- references: {
25
- model: 'Customer',
26
- key: 'CustomerID'
27
- },
28
- onDelete: 'CASCADE',
29
- onUpdate: 'CASCADE'
30
- },
31
- AddressLine1: {
32
- type: DataTypes.STRING(255),
33
- allowNull: false
34
- },
35
- AddressLine2: {
36
- type: DataTypes.STRING(255)
37
- },
38
- CityName: {
39
- type: DataTypes.STRING(100),
40
- allowNull: false,
41
- },
42
- StateCode: {
43
- type:DataTypes.STRING(3),
44
- allowNull:false
45
- },
46
- CountryCode:{
47
- type:DataTypes.CHAR(2),
48
- allowNull:false
49
- },
50
- Zipcode: {
51
- type: DataTypes.STRING(20),
52
- allowNull: false
53
- },
54
- AddressType: {
55
- type: DataTypes.ENUM(Object.values(AddressTypeEnum)),
56
- allowNull: false
57
- },
58
- RecipientName: {
59
- type: DataTypes.STRING(255),
60
- allowNull: false
61
- },
62
- CountryCallingCode: {
63
- type: DataTypes.STRING(5),
64
- allowNull: false
65
- },
66
- PhoneNumber: {
67
- type: DataTypes.STRING(20),
68
- allowNull: false
69
- },
70
- IsDefault: {
71
- type: DataTypes.BOOLEAN,
72
- defaultValue: false
73
- },
74
- CreatedBy: {
75
- type: DataTypes.UUID,
76
- allowNull: false
77
- },
78
- CreatedAt: {
79
- type: DataTypes.DATE,
80
- allowNull: false,
81
- defaultValue: DataTypes.NOW
82
- },
83
- UpdatedBy: {
84
- type: DataTypes.UUID,
85
- allowNull: false
86
- },
87
- UpdatedAt: {
88
- type: DataTypes.DATE,
89
- allowNull: false,
90
- defaultValue: DataTypes.NOW
91
- }
92
- }, {
93
- tableName: 'Address',
94
- timestamps: false
95
- });
1
+ const { DataTypes } = require('sequelize');
2
+ const AddressTypeEnum = require('../enum/AddressTypeEnum');
3
+ module.exports = (sequelize) => {
4
+ return sequelize.define('Address', {
5
+ AddressID: {
6
+ type: DataTypes.UUID,
7
+ primaryKey: true,
8
+ allowNull: false,
9
+ defaultValue: DataTypes.UUIDV4
10
+ },
11
+ TenantID: {
12
+ type: DataTypes.UUID,
13
+ allowNull: false,
14
+ references: {
15
+ model: 'Tenant',
16
+ key: 'TenantID'
17
+ },
18
+ onDelete: 'CASCADE',
19
+ onUpdate: 'CASCADE'
20
+ },
21
+ CustomerID: {
22
+ type: DataTypes.UUID,
23
+ allowNull: false,
24
+ references: {
25
+ model: 'Customer',
26
+ key: 'CustomerID'
27
+ },
28
+ onDelete: 'CASCADE',
29
+ onUpdate: 'CASCADE'
30
+ },
31
+ AddressLine1: {
32
+ type: DataTypes.STRING(255),
33
+ allowNull: false
34
+ },
35
+ AddressLine2: {
36
+ type: DataTypes.STRING(255)
37
+ },
38
+ CityName: {
39
+ type: DataTypes.STRING(100),
40
+ allowNull: false,
41
+ },
42
+ StateCode: {
43
+ type:DataTypes.STRING(3),
44
+ allowNull:false
45
+ },
46
+ CountryCode:{
47
+ type:DataTypes.CHAR(2),
48
+ allowNull:false
49
+ },
50
+ Zipcode: {
51
+ type: DataTypes.STRING(20),
52
+ allowNull: false
53
+ },
54
+ AddressType: {
55
+ type: DataTypes.ENUM(Object.values(AddressTypeEnum)),
56
+ allowNull: false
57
+ },
58
+ RecipientName: {
59
+ type: DataTypes.STRING(255),
60
+ allowNull: false
61
+ },
62
+ CountryCallingCode: {
63
+ type: DataTypes.STRING(5),
64
+ allowNull: false
65
+ },
66
+ PhoneNumber: {
67
+ type: DataTypes.STRING(20),
68
+ allowNull: false
69
+ },
70
+ IsDefault: {
71
+ type: DataTypes.BOOLEAN,
72
+ defaultValue: false
73
+ },
74
+ CreatedBy: {
75
+ type: DataTypes.UUID,
76
+ allowNull: false
77
+ },
78
+ CreatedAt: {
79
+ type: DataTypes.DATE,
80
+ allowNull: false,
81
+ defaultValue: DataTypes.NOW
82
+ },
83
+ UpdatedBy: {
84
+ type: DataTypes.UUID,
85
+ allowNull: false
86
+ },
87
+ UpdatedAt: {
88
+ type: DataTypes.DATE,
89
+ allowNull: false,
90
+ defaultValue: DataTypes.NOW
91
+ }
92
+ }, {
93
+ tableName: 'Address',
94
+ timestamps: false
95
+ });
96
96
  };