@kipicore/dbcore 1.1.574 → 1.1.576

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 (135) hide show
  1. package/dist/constants/app.d.ts +122 -0
  2. package/dist/constants/app.js +141 -1
  3. package/dist/constants/errorMessages.d.ts +10 -0
  4. package/dist/constants/errorMessages.js +12 -1
  5. package/dist/constants/successMessages.d.ts +12 -0
  6. package/dist/constants/successMessages.js +14 -1
  7. package/dist/db/psql/migrations/20260615045636-add_rms_models.d.ts +2 -0
  8. package/dist/db/psql/migrations/20260615045636-add_rms_models.js +276 -0
  9. package/dist/db/psql/migrations/20260615083628-add_storage_and_asset_transactions.d.ts +2 -0
  10. package/dist/db/psql/migrations/20260615083628-add_storage_and_asset_transactions.js +60 -0
  11. package/dist/interfaces/index.d.ts +19 -0
  12. package/dist/interfaces/index.js +19 -0
  13. package/dist/interfaces/rmsAssetInterface.d.ts +15 -0
  14. package/dist/interfaces/rmsAssetInterface.js +2 -0
  15. package/dist/interfaces/rmsAssetTransactionInterface.d.ts +16 -0
  16. package/dist/interfaces/rmsAssetTransactionInterface.js +2 -0
  17. package/dist/interfaces/rmsAuditLogInterface.d.ts +17 -0
  18. package/dist/interfaces/rmsAuditLogInterface.js +2 -0
  19. package/dist/interfaces/rmsDepartmentInterface.d.ts +10 -0
  20. package/dist/interfaces/rmsDepartmentInterface.js +2 -0
  21. package/dist/interfaces/rmsGrnInterface.d.ts +14 -0
  22. package/dist/interfaces/rmsGrnInterface.js +2 -0
  23. package/dist/interfaces/rmsGrnItemInterface.d.ts +13 -0
  24. package/dist/interfaces/rmsGrnItemInterface.js +2 -0
  25. package/dist/interfaces/rmsLocationInterface.d.ts +12 -0
  26. package/dist/interfaces/rmsLocationInterface.js +2 -0
  27. package/dist/interfaces/rmsPurchaseOrderInterface.d.ts +17 -0
  28. package/dist/interfaces/rmsPurchaseOrderInterface.js +2 -0
  29. package/dist/interfaces/rmsPurchaseOrderItemInterface.d.ts +13 -0
  30. package/dist/interfaces/rmsPurchaseOrderItemInterface.js +2 -0
  31. package/dist/interfaces/rmsPurchaseRequestInterface.d.ts +14 -0
  32. package/dist/interfaces/rmsPurchaseRequestInterface.js +2 -0
  33. package/dist/interfaces/rmsPurchaseRequestItemInterface.d.ts +13 -0
  34. package/dist/interfaces/rmsPurchaseRequestItemInterface.js +2 -0
  35. package/dist/interfaces/rmsRequestApprovalInterface.d.ts +13 -0
  36. package/dist/interfaces/rmsRequestApprovalInterface.js +2 -0
  37. package/dist/interfaces/rmsResourceDetailsInterface.d.ts +19 -0
  38. package/dist/interfaces/rmsResourceDetailsInterface.js +2 -0
  39. package/dist/interfaces/rmsResourceInterface.d.ts +23 -0
  40. package/dist/interfaces/rmsResourceInterface.js +2 -0
  41. package/dist/interfaces/rmsStockInterface.d.ts +17 -0
  42. package/dist/interfaces/rmsStockInterface.js +2 -0
  43. package/dist/interfaces/rmsStockTransactionInterface.d.ts +18 -0
  44. package/dist/interfaces/rmsStockTransactionInterface.js +2 -0
  45. package/dist/interfaces/rmsStorageInterface.d.ts +17 -0
  46. package/dist/interfaces/rmsStorageInterface.js +2 -0
  47. package/dist/interfaces/rmsVendorDocumentInterface.d.ts +11 -0
  48. package/dist/interfaces/rmsVendorDocumentInterface.js +2 -0
  49. package/dist/interfaces/rmsVendorInterface.d.ts +16 -0
  50. package/dist/interfaces/rmsVendorInterface.js +2 -0
  51. package/dist/models/mongodb/index.d.ts +2 -0
  52. package/dist/models/mongodb/index.js +5 -1
  53. package/dist/models/mongodb/rmsAuditLogModel.d.ts +4 -0
  54. package/dist/models/mongodb/rmsAuditLogModel.js +99 -0
  55. package/dist/models/mongodb/rmsResourceDetailsModel.d.ts +8 -0
  56. package/dist/models/mongodb/rmsResourceDetailsModel.js +57 -0
  57. package/dist/models/psql/index.d.ts +18 -0
  58. package/dist/models/psql/index.js +39 -1
  59. package/dist/models/psql/rmsAssetModel.d.ts +25 -0
  60. package/dist/models/psql/rmsAssetModel.js +80 -0
  61. package/dist/models/psql/rmsAssetTransactionModel.d.ts +26 -0
  62. package/dist/models/psql/rmsAssetTransactionModel.js +89 -0
  63. package/dist/models/psql/rmsDepartmentModel.d.ts +20 -0
  64. package/dist/models/psql/rmsDepartmentModel.js +67 -0
  65. package/dist/models/psql/rmsGrnItemModel.d.ts +23 -0
  66. package/dist/models/psql/rmsGrnItemModel.js +75 -0
  67. package/dist/models/psql/rmsGrnModel.d.ts +24 -0
  68. package/dist/models/psql/rmsGrnModel.js +74 -0
  69. package/dist/models/psql/rmsLocationModel.d.ts +22 -0
  70. package/dist/models/psql/rmsLocationModel.js +79 -0
  71. package/dist/models/psql/rmsPurchaseOrderItemModel.d.ts +23 -0
  72. package/dist/models/psql/rmsPurchaseOrderItemModel.js +89 -0
  73. package/dist/models/psql/rmsPurchaseOrderModel.d.ts +27 -0
  74. package/dist/models/psql/rmsPurchaseOrderModel.js +108 -0
  75. package/dist/models/psql/rmsPurchaseRequestItemModel.d.ts +23 -0
  76. package/dist/models/psql/rmsPurchaseRequestItemModel.js +86 -0
  77. package/dist/models/psql/rmsPurchaseRequestModel.d.ts +24 -0
  78. package/dist/models/psql/rmsPurchaseRequestModel.js +96 -0
  79. package/dist/models/psql/rmsRequestApprovalModel.d.ts +23 -0
  80. package/dist/models/psql/rmsRequestApprovalModel.js +79 -0
  81. package/dist/models/psql/rmsResourceModel.d.ts +33 -0
  82. package/dist/models/psql/rmsResourceModel.js +147 -0
  83. package/dist/models/psql/rmsStockModel.d.ts +27 -0
  84. package/dist/models/psql/rmsStockModel.js +113 -0
  85. package/dist/models/psql/rmsStockTransactionModel.d.ts +28 -0
  86. package/dist/models/psql/rmsStockTransactionModel.js +113 -0
  87. package/dist/models/psql/rmsStorageRackModel.d.ts +20 -0
  88. package/dist/models/psql/rmsStorageRackModel.js +57 -0
  89. package/dist/models/psql/rmsStorageSlotModel.d.ts +19 -0
  90. package/dist/models/psql/rmsStorageSlotModel.js +53 -0
  91. package/dist/models/psql/rmsVendorDocumentModel.d.ts +21 -0
  92. package/dist/models/psql/rmsVendorDocumentModel.js +80 -0
  93. package/dist/models/psql/rmsVendorModel.d.ts +27 -0
  94. package/dist/models/psql/rmsVendorModel.js +95 -0
  95. package/dist/types/index.d.ts +19 -0
  96. package/dist/types/index.js +19 -0
  97. package/dist/types/rmsAssetTransactionType.d.ts +3 -0
  98. package/dist/types/rmsAssetTransactionType.js +2 -0
  99. package/dist/types/rmsAssetType.d.ts +3 -0
  100. package/dist/types/rmsAssetType.js +2 -0
  101. package/dist/types/rmsAuditLogType.d.ts +3 -0
  102. package/dist/types/rmsAuditLogType.js +2 -0
  103. package/dist/types/rmsDepartmentType.d.ts +3 -0
  104. package/dist/types/rmsDepartmentType.js +2 -0
  105. package/dist/types/rmsGrnItemType.d.ts +3 -0
  106. package/dist/types/rmsGrnItemType.js +2 -0
  107. package/dist/types/rmsGrnType.d.ts +3 -0
  108. package/dist/types/rmsGrnType.js +2 -0
  109. package/dist/types/rmsLocationType.d.ts +3 -0
  110. package/dist/types/rmsLocationType.js +2 -0
  111. package/dist/types/rmsPurchaseOrderItemType.d.ts +3 -0
  112. package/dist/types/rmsPurchaseOrderItemType.js +2 -0
  113. package/dist/types/rmsPurchaseOrderType.d.ts +3 -0
  114. package/dist/types/rmsPurchaseOrderType.js +2 -0
  115. package/dist/types/rmsPurchaseRequestItemType.d.ts +3 -0
  116. package/dist/types/rmsPurchaseRequestItemType.js +2 -0
  117. package/dist/types/rmsPurchaseRequestType.d.ts +3 -0
  118. package/dist/types/rmsPurchaseRequestType.js +2 -0
  119. package/dist/types/rmsRequestApprovalType.d.ts +3 -0
  120. package/dist/types/rmsRequestApprovalType.js +2 -0
  121. package/dist/types/rmsResourceDetailsType.d.ts +2 -0
  122. package/dist/types/rmsResourceDetailsType.js +2 -0
  123. package/dist/types/rmsResourceType.d.ts +3 -0
  124. package/dist/types/rmsResourceType.js +2 -0
  125. package/dist/types/rmsStockTransactionType.d.ts +3 -0
  126. package/dist/types/rmsStockTransactionType.js +2 -0
  127. package/dist/types/rmsStockType.d.ts +3 -0
  128. package/dist/types/rmsStockType.js +2 -0
  129. package/dist/types/rmsStorageType.d.ts +4 -0
  130. package/dist/types/rmsStorageType.js +2 -0
  131. package/dist/types/rmsVendorDocumentType.d.ts +3 -0
  132. package/dist/types/rmsVendorDocumentType.js +2 -0
  133. package/dist/types/rmsVendorType.d.ts +3 -0
  134. package/dist/types/rmsVendorType.js +2 -0
  135. package/package.json +1 -1
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sequelize_1 = require("sequelize");
4
+ const index_1 = require("./index");
5
+ class RmsAssetTransactionModel extends sequelize_1.Model {
6
+ static associate(models) {
7
+ const { InstituteModel, UserModel, RmsAssetModel } = models;
8
+ RmsAssetTransactionModel.belongsTo(InstituteModel, { foreignKey: 'instituteId', as: 'institute' });
9
+ InstituteModel.hasMany(RmsAssetTransactionModel, { foreignKey: 'instituteId', as: 'assetTransactions' });
10
+ RmsAssetTransactionModel.belongsTo(RmsAssetModel, { foreignKey: 'assetId', as: 'asset' });
11
+ RmsAssetModel.hasMany(RmsAssetTransactionModel, { foreignKey: 'assetId', as: 'assetTransactions' });
12
+ RmsAssetTransactionModel.belongsTo(UserModel, { foreignKey: 'userId', as: 'user' });
13
+ UserModel.hasMany(RmsAssetTransactionModel, { foreignKey: 'userId', as: 'assetTransactions' });
14
+ RmsAssetTransactionModel.belongsTo(UserModel, { foreignKey: 'createdBy', as: 'createdByUser' });
15
+ RmsAssetTransactionModel.belongsTo(UserModel, { foreignKey: 'updatedBy', as: 'updatedByUser' });
16
+ RmsAssetTransactionModel.belongsTo(UserModel, { foreignKey: 'deletedBy', as: 'deletedByUser' });
17
+ }
18
+ }
19
+ RmsAssetTransactionModel.init({
20
+ id: {
21
+ type: sequelize_1.DataTypes.UUID,
22
+ defaultValue: sequelize_1.DataTypes.UUIDV4,
23
+ allowNull: false,
24
+ primaryKey: true,
25
+ },
26
+ instituteId: {
27
+ type: sequelize_1.DataTypes.UUID,
28
+ allowNull: true,
29
+ field: 'institute_id',
30
+ },
31
+ assetId: {
32
+ type: sequelize_1.DataTypes.UUID,
33
+ allowNull: true,
34
+ field: 'asset_id',
35
+ },
36
+ userId: {
37
+ type: sequelize_1.DataTypes.UUID,
38
+ allowNull: true,
39
+ field: 'user_id',
40
+ },
41
+ transactionType: {
42
+ type: sequelize_1.DataTypes.STRING,
43
+ allowNull: true,
44
+ field: 'transaction_type',
45
+ },
46
+ issueDate: {
47
+ type: sequelize_1.DataTypes.DATE,
48
+ allowNull: true,
49
+ field: 'issue_date',
50
+ },
51
+ dueDate: {
52
+ type: sequelize_1.DataTypes.DATE,
53
+ allowNull: true,
54
+ field: 'due_date',
55
+ },
56
+ returnDate: {
57
+ type: sequelize_1.DataTypes.DATE,
58
+ allowNull: true,
59
+ field: 'return_date',
60
+ },
61
+ conditionOut: {
62
+ type: sequelize_1.DataTypes.STRING,
63
+ allowNull: true,
64
+ field: 'condition_out',
65
+ },
66
+ conditionIn: {
67
+ type: sequelize_1.DataTypes.STRING,
68
+ allowNull: true,
69
+ field: 'condition_in',
70
+ },
71
+ penaltyAmount: {
72
+ type: sequelize_1.DataTypes.DECIMAL(10, 2),
73
+ allowNull: true,
74
+ field: 'penalty_amount',
75
+ },
76
+ remarks: {
77
+ type: sequelize_1.DataTypes.TEXT,
78
+ allowNull: true,
79
+ field: 'remarks',
80
+ },
81
+ }, {
82
+ sequelize: index_1.sequelize,
83
+ modelName: 'RmsAssetTransactionModel',
84
+ tableName: 'rms_asset_transactions',
85
+ timestamps: true,
86
+ paranoid: true,
87
+ underscored: true,
88
+ });
89
+ exports.default = RmsAssetTransactionModel;
@@ -0,0 +1,20 @@
1
+ import { Model } from 'sequelize';
2
+ import { IRmsDepartmentAttributes } from '../../interfaces/rmsDepartmentInterface';
3
+ import { TRmsDepartmentCreationAttributes } from '../../types/rmsDepartmentType';
4
+ import { COMMAN_STATUS } from '../../constants';
5
+ declare class RmsDepartmentModel extends Model<IRmsDepartmentAttributes, TRmsDepartmentCreationAttributes> implements IRmsDepartmentAttributes {
6
+ id: string;
7
+ instituteId: string;
8
+ departmentCode: string;
9
+ departmentName: string;
10
+ description?: string | null;
11
+ status: COMMAN_STATUS;
12
+ createdBy: string;
13
+ updatedBy: string;
14
+ deletedBy: string;
15
+ readonly createdAt: Date;
16
+ readonly updatedAt: Date;
17
+ readonly deletedAt?: string;
18
+ static associate(models: any): void;
19
+ }
20
+ export default RmsDepartmentModel;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sequelize_1 = require("sequelize");
4
+ const index_1 = require("./index");
5
+ class RmsDepartmentModel extends sequelize_1.Model {
6
+ static associate(models) {
7
+ const { UserModel, InstituteModel } = models;
8
+ RmsDepartmentModel.belongsTo(InstituteModel, { foreignKey: 'instituteId', as: 'institute' });
9
+ InstituteModel.hasMany(RmsDepartmentModel, { foreignKey: 'instituteId', as: 'departments' });
10
+ RmsDepartmentModel.belongsTo(UserModel, { foreignKey: { name: 'createdBy', field: 'created_by', allowNull: true }, as: 'createdByUser' });
11
+ RmsDepartmentModel.belongsTo(UserModel, { foreignKey: { name: 'updatedBy', field: 'updated_by', allowNull: true }, as: 'updatedByUser' });
12
+ RmsDepartmentModel.belongsTo(UserModel, { foreignKey: { name: 'deletedBy', field: 'deleted_by', allowNull: true }, as: 'deletedByUser' });
13
+ }
14
+ }
15
+ RmsDepartmentModel.init({
16
+ id: {
17
+ type: sequelize_1.DataTypes.UUID,
18
+ defaultValue: sequelize_1.DataTypes.UUIDV4,
19
+ primaryKey: true,
20
+ },
21
+ instituteId: {
22
+ type: sequelize_1.DataTypes.UUID,
23
+ allowNull: false,
24
+ field: 'institute_id',
25
+ },
26
+ departmentCode: {
27
+ type: sequelize_1.DataTypes.STRING,
28
+ allowNull: false,
29
+ field: 'department_code',
30
+ },
31
+ departmentName: {
32
+ type: sequelize_1.DataTypes.STRING,
33
+ allowNull: false,
34
+ field: 'department_name',
35
+ },
36
+ description: {
37
+ type: sequelize_1.DataTypes.TEXT,
38
+ allowNull: true,
39
+ },
40
+ status: {
41
+ type: sequelize_1.DataTypes.STRING,
42
+ allowNull: false,
43
+ defaultValue: 'ACTIVE',
44
+ },
45
+ createdBy: {
46
+ type: sequelize_1.DataTypes.UUID,
47
+ allowNull: true,
48
+ field: 'created_by',
49
+ },
50
+ updatedBy: {
51
+ type: sequelize_1.DataTypes.UUID,
52
+ allowNull: true,
53
+ field: 'updated_by',
54
+ },
55
+ deletedBy: {
56
+ type: sequelize_1.DataTypes.UUID,
57
+ allowNull: true,
58
+ field: 'deleted_by',
59
+ },
60
+ }, {
61
+ sequelize: index_1.sequelize,
62
+ modelName: 'RmsDepartmentModel',
63
+ tableName: 'rms_departments',
64
+ timestamps: true,
65
+ paranoid: true,
66
+ });
67
+ exports.default = RmsDepartmentModel;
@@ -0,0 +1,23 @@
1
+ import { Model } from 'sequelize';
2
+ import { IRmsGrnItemAttributes } from '../../interfaces/rmsGrnItemInterface';
3
+ import { TRmsGrnItemCreationAttributes } from '../../types/rmsGrnItemType';
4
+ declare class RmsGrnItemModel extends Model<IRmsGrnItemAttributes, TRmsGrnItemCreationAttributes> {
5
+ id: string;
6
+ instituteId: string;
7
+ grnId: string;
8
+ purchaseOrderItemId: string;
9
+ resourceId: string;
10
+ orderedQuantity: number;
11
+ receivedQuantity: number;
12
+ acceptedQuantity: number;
13
+ rejectedQuantity: number;
14
+ remarks?: string | null;
15
+ createdBy?: string | null;
16
+ updatedBy?: string | null;
17
+ deletedBy?: string | null;
18
+ readonly createdAt?: Date;
19
+ readonly updatedAt?: Date;
20
+ readonly deletedAt?: Date | null;
21
+ static associate(models: any): void;
22
+ }
23
+ export default RmsGrnItemModel;
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sequelize_1 = require("sequelize");
4
+ const index_1 = require("./index");
5
+ class RmsGrnItemModel extends sequelize_1.Model {
6
+ static associate(models) {
7
+ const { InstituteModel, UserModel, RmsGrnModel, RmsPurchaseOrderItemModel, RmsResourceModel } = models;
8
+ RmsGrnItemModel.belongsTo(InstituteModel, { foreignKey: 'instituteId', as: 'institute' });
9
+ InstituteModel.hasMany(RmsGrnItemModel, { foreignKey: 'instituteId', as: 'grnItems' });
10
+ RmsGrnItemModel.belongsTo(RmsGrnModel, { foreignKey: 'grnId', as: 'grn' });
11
+ RmsGrnModel.hasMany(RmsGrnItemModel, { foreignKey: 'grnId', as: 'grnItems' });
12
+ RmsGrnItemModel.belongsTo(RmsPurchaseOrderItemModel, { foreignKey: 'purchaseOrderItemId', as: 'purchaseOrderItem' });
13
+ RmsPurchaseOrderItemModel.hasMany(RmsGrnItemModel, { foreignKey: 'purchaseOrderItemId', as: 'grnItems' });
14
+ RmsGrnItemModel.belongsTo(RmsResourceModel, { foreignKey: 'resourceId', as: 'resource' });
15
+ RmsResourceModel.hasMany(RmsGrnItemModel, { foreignKey: 'resourceId', as: 'grnItems' });
16
+ // RmsGrnItemModel.hasMany(RmsAssetModel, { foreignKey: 'grnItemId', as: 'assets' });
17
+ // RmsAssetModel.belongsTo(RmsGrnItemModel, { foreignKey: 'grnItemId', as: 'grnItem' });
18
+ RmsGrnItemModel.belongsTo(UserModel, { foreignKey: 'createdBy', as: 'createdByUser' });
19
+ RmsGrnItemModel.belongsTo(UserModel, { foreignKey: 'updatedBy', as: 'updatedByUser' });
20
+ RmsGrnItemModel.belongsTo(UserModel, { foreignKey: 'deletedBy', as: 'deletedByUser' });
21
+ }
22
+ }
23
+ RmsGrnItemModel.init({
24
+ id: {
25
+ type: sequelize_1.DataTypes.UUID,
26
+ defaultValue: sequelize_1.DataTypes.UUIDV4,
27
+ allowNull: false,
28
+ primaryKey: true,
29
+ },
30
+ instituteId: {
31
+ type: sequelize_1.DataTypes.UUID,
32
+ allowNull: false,
33
+ },
34
+ grnId: {
35
+ type: sequelize_1.DataTypes.UUID,
36
+ allowNull: false,
37
+ },
38
+ purchaseOrderItemId: {
39
+ type: sequelize_1.DataTypes.UUID,
40
+ allowNull: false,
41
+ },
42
+ resourceId: {
43
+ type: sequelize_1.DataTypes.UUID,
44
+ allowNull: false,
45
+ },
46
+ orderedQuantity: {
47
+ type: sequelize_1.DataTypes.DECIMAL(10, 2),
48
+ allowNull: false,
49
+ },
50
+ receivedQuantity: {
51
+ type: sequelize_1.DataTypes.DECIMAL(10, 2),
52
+ allowNull: false,
53
+ },
54
+ acceptedQuantity: {
55
+ type: sequelize_1.DataTypes.DECIMAL(10, 2),
56
+ allowNull: false,
57
+ defaultValue: 0,
58
+ },
59
+ rejectedQuantity: {
60
+ type: sequelize_1.DataTypes.DECIMAL(10, 2),
61
+ allowNull: false,
62
+ defaultValue: 0,
63
+ },
64
+ remarks: {
65
+ type: sequelize_1.DataTypes.TEXT,
66
+ allowNull: true,
67
+ },
68
+ }, {
69
+ sequelize: index_1.sequelize,
70
+ modelName: 'RmsGrnItemModel',
71
+ tableName: 'rms_grn_items',
72
+ timestamps: true,
73
+ paranoid: true,
74
+ });
75
+ exports.default = RmsGrnItemModel;
@@ -0,0 +1,24 @@
1
+ import { Model } from 'sequelize';
2
+ import { IRmsGrnAttributes } from '../../interfaces/rmsGrnInterface';
3
+ import { TRmsGrnCreationAttributes } from '../../types/rmsGrnType';
4
+ import { COMMAN_STATUS, RMS_APPROVAL_STATUS } from '../../constants/app';
5
+ declare class RmsGrnModel extends Model<IRmsGrnAttributes, TRmsGrnCreationAttributes> {
6
+ id: string;
7
+ instituteId: string;
8
+ grnNo: string;
9
+ purchaseOrderId: string;
10
+ vendorId: string;
11
+ receivedDate: Date;
12
+ receivedBy: string;
13
+ status: COMMAN_STATUS;
14
+ approvalStatus: RMS_APPROVAL_STATUS;
15
+ remarks?: string | null;
16
+ createdBy?: string | null;
17
+ updatedBy?: string | null;
18
+ deletedBy?: string | null;
19
+ readonly createdAt?: Date;
20
+ readonly updatedAt?: Date;
21
+ readonly deletedAt?: Date | null;
22
+ static associate(models: any): void;
23
+ }
24
+ export default RmsGrnModel;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sequelize_1 = require("sequelize");
4
+ const index_1 = require("./index");
5
+ const app_1 = require("../../constants/app");
6
+ class RmsGrnModel extends sequelize_1.Model {
7
+ static associate(models) {
8
+ const { InstituteModel, UserModel, RmsPurchaseOrderModel, RmsVendorModel } = models;
9
+ RmsGrnModel.belongsTo(InstituteModel, { foreignKey: 'instituteId', as: 'institute' });
10
+ InstituteModel.hasMany(RmsGrnModel, { foreignKey: 'instituteId', as: 'grns' });
11
+ RmsGrnModel.belongsTo(RmsPurchaseOrderModel, { foreignKey: 'purchaseOrderId', as: 'purchaseOrder' });
12
+ RmsPurchaseOrderModel.hasMany(RmsGrnModel, { foreignKey: 'purchaseOrderId', as: 'grns' });
13
+ RmsGrnModel.belongsTo(RmsVendorModel, { foreignKey: 'vendorId', as: 'vendor' });
14
+ RmsVendorModel.hasMany(RmsGrnModel, { foreignKey: 'vendorId', as: 'grns' });
15
+ RmsGrnModel.belongsTo(UserModel, { foreignKey: 'receivedBy', as: 'receiver' });
16
+ UserModel.hasMany(RmsGrnModel, { foreignKey: 'receivedBy', as: 'grns' });
17
+ RmsGrnModel.belongsTo(UserModel, { foreignKey: 'createdBy', as: 'createdByUser' });
18
+ RmsGrnModel.belongsTo(UserModel, { foreignKey: 'updatedBy', as: 'updatedByUser' });
19
+ RmsGrnModel.belongsTo(UserModel, { foreignKey: 'deletedBy', as: 'deletedByUser' });
20
+ }
21
+ }
22
+ RmsGrnModel.init({
23
+ id: {
24
+ type: sequelize_1.DataTypes.UUID,
25
+ defaultValue: sequelize_1.DataTypes.UUIDV4,
26
+ allowNull: false,
27
+ primaryKey: true,
28
+ },
29
+ instituteId: {
30
+ type: sequelize_1.DataTypes.UUID,
31
+ allowNull: false,
32
+ },
33
+ grnNo: {
34
+ type: sequelize_1.DataTypes.STRING,
35
+ allowNull: false,
36
+ },
37
+ purchaseOrderId: {
38
+ type: sequelize_1.DataTypes.UUID,
39
+ allowNull: false,
40
+ },
41
+ vendorId: {
42
+ type: sequelize_1.DataTypes.UUID,
43
+ allowNull: false,
44
+ },
45
+ receivedDate: {
46
+ type: sequelize_1.DataTypes.DATE,
47
+ allowNull: false,
48
+ },
49
+ receivedBy: {
50
+ type: sequelize_1.DataTypes.UUID,
51
+ allowNull: false,
52
+ },
53
+ status: {
54
+ type: sequelize_1.DataTypes.STRING,
55
+ allowNull: false,
56
+ defaultValue: app_1.COMMAN_STATUS.ACTIVE,
57
+ },
58
+ approvalStatus: {
59
+ type: sequelize_1.DataTypes.STRING,
60
+ allowNull: false,
61
+ defaultValue: app_1.RMS_APPROVAL_STATUS.DRAFT,
62
+ },
63
+ remarks: {
64
+ type: sequelize_1.DataTypes.TEXT,
65
+ allowNull: true,
66
+ },
67
+ }, {
68
+ sequelize: index_1.sequelize,
69
+ modelName: 'RmsGrnModel',
70
+ tableName: 'rms_grn',
71
+ timestamps: true,
72
+ paranoid: true,
73
+ });
74
+ exports.default = RmsGrnModel;
@@ -0,0 +1,22 @@
1
+ import { Model } from 'sequelize';
2
+ import { IRmsLocationAttributes } from '../../interfaces/rmsLocationInterface';
3
+ import { TRmsLocationCreationAttributes } from '../../types/rmsLocationType';
4
+ import { COMMAN_STATUS } from '../../constants';
5
+ declare class RmsLocationModel extends Model<IRmsLocationAttributes, TRmsLocationCreationAttributes> implements IRmsLocationAttributes {
6
+ id: string;
7
+ instituteId: string;
8
+ parentLocationId?: string | null;
9
+ locationCode: string;
10
+ locationName: string;
11
+ locationType: string;
12
+ capacity?: number | null;
13
+ status: COMMAN_STATUS;
14
+ createdBy: string;
15
+ updatedBy: string;
16
+ deletedBy: string;
17
+ readonly createdAt: Date;
18
+ readonly updatedAt: Date;
19
+ readonly deletedAt?: string;
20
+ static associate(models: any): void;
21
+ }
22
+ export default RmsLocationModel;
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sequelize_1 = require("sequelize");
4
+ const index_1 = require("./index");
5
+ class RmsLocationModel extends sequelize_1.Model {
6
+ static associate(models) {
7
+ const { UserModel, InstituteModel } = models;
8
+ RmsLocationModel.belongsTo(InstituteModel, { foreignKey: 'instituteId', as: 'institute' });
9
+ InstituteModel.hasMany(RmsLocationModel, { foreignKey: 'instituteId', as: 'locations' });
10
+ RmsLocationModel.belongsTo(RmsLocationModel, { foreignKey: 'parentLocationId', as: 'parentLocation' });
11
+ RmsLocationModel.hasMany(RmsLocationModel, { foreignKey: 'parentLocationId', as: 'childLocations' });
12
+ RmsLocationModel.belongsTo(UserModel, { foreignKey: { name: 'createdBy', field: 'created_by', allowNull: true }, as: 'createdByUser' });
13
+ RmsLocationModel.belongsTo(UserModel, { foreignKey: { name: 'updatedBy', field: 'updated_by', allowNull: true }, as: 'updatedByUser' });
14
+ RmsLocationModel.belongsTo(UserModel, { foreignKey: { name: 'deletedBy', field: 'deleted_by', allowNull: true }, as: 'deletedByUser' });
15
+ }
16
+ }
17
+ RmsLocationModel.init({
18
+ id: {
19
+ type: sequelize_1.DataTypes.UUID,
20
+ defaultValue: sequelize_1.DataTypes.UUIDV4,
21
+ primaryKey: true,
22
+ },
23
+ instituteId: {
24
+ type: sequelize_1.DataTypes.UUID,
25
+ allowNull: false,
26
+ field: 'institute_id',
27
+ },
28
+ parentLocationId: {
29
+ type: sequelize_1.DataTypes.UUID,
30
+ allowNull: true,
31
+ field: 'parent_location_id',
32
+ },
33
+ locationCode: {
34
+ type: sequelize_1.DataTypes.STRING,
35
+ allowNull: false,
36
+ field: 'location_code',
37
+ },
38
+ locationName: {
39
+ type: sequelize_1.DataTypes.STRING,
40
+ allowNull: false,
41
+ field: 'location_name',
42
+ },
43
+ locationType: {
44
+ type: sequelize_1.DataTypes.STRING,
45
+ allowNull: false,
46
+ field: 'location_type',
47
+ },
48
+ capacity: {
49
+ type: sequelize_1.DataTypes.INTEGER,
50
+ allowNull: true,
51
+ },
52
+ status: {
53
+ type: sequelize_1.DataTypes.STRING,
54
+ allowNull: false,
55
+ defaultValue: 'ACTIVE',
56
+ },
57
+ createdBy: {
58
+ type: sequelize_1.DataTypes.UUID,
59
+ allowNull: true,
60
+ field: 'created_by',
61
+ },
62
+ updatedBy: {
63
+ type: sequelize_1.DataTypes.UUID,
64
+ allowNull: true,
65
+ field: 'updated_by',
66
+ },
67
+ deletedBy: {
68
+ type: sequelize_1.DataTypes.UUID,
69
+ allowNull: true,
70
+ field: 'deleted_by',
71
+ },
72
+ }, {
73
+ sequelize: index_1.sequelize,
74
+ modelName: 'RmsLocationModel',
75
+ tableName: 'rms_locations',
76
+ timestamps: true,
77
+ paranoid: true,
78
+ });
79
+ exports.default = RmsLocationModel;
@@ -0,0 +1,23 @@
1
+ import { Model } from 'sequelize';
2
+ import { IRmsPurchaseOrderItemAttributes } from '../../interfaces/rmsPurchaseOrderItemInterface';
3
+ import { TRmsPurchaseOrderItemCreationAttributes } from '../../types/rmsPurchaseOrderItemType';
4
+ declare class RmsPurchaseOrderItemModel extends Model<IRmsPurchaseOrderItemAttributes, TRmsPurchaseOrderItemCreationAttributes> {
5
+ id: string;
6
+ instituteId: string;
7
+ purchaseOrderId: string;
8
+ resourceId: string;
9
+ quantity: number;
10
+ receivedQuantity: number;
11
+ rate: number;
12
+ taxAmount: number;
13
+ amount: number;
14
+ status: string;
15
+ createdBy?: string | null;
16
+ updatedBy?: string | null;
17
+ deletedBy?: string | null;
18
+ readonly createdAt?: Date;
19
+ readonly updatedAt?: Date;
20
+ readonly deletedAt?: Date | null;
21
+ static associate(models: any): void;
22
+ }
23
+ export default RmsPurchaseOrderItemModel;
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const sequelize_1 = require("sequelize");
4
+ const index_1 = require("./index");
5
+ const app_1 = require("../../constants/app");
6
+ class RmsPurchaseOrderItemModel extends sequelize_1.Model {
7
+ static associate(models) {
8
+ const { InstituteModel, RmsPurchaseOrderModel, RmsResourceModel, UserModel } = models;
9
+ RmsPurchaseOrderItemModel.belongsTo(InstituteModel, {
10
+ foreignKey: { name: 'instituteId', field: 'institute_id' },
11
+ as: 'institute',
12
+ });
13
+ RmsPurchaseOrderItemModel.belongsTo(RmsPurchaseOrderModel, {
14
+ foreignKey: { name: 'purchaseOrderId', field: 'purchase_order_id' },
15
+ as: 'purchaseOrder',
16
+ });
17
+ RmsPurchaseOrderItemModel.belongsTo(RmsResourceModel, {
18
+ foreignKey: { name: 'resourceId', field: 'resource_id' },
19
+ as: 'resource',
20
+ });
21
+ RmsPurchaseOrderItemModel.belongsTo(UserModel, {
22
+ foreignKey: { name: 'createdBy', field: 'created_by', allowNull: true },
23
+ as: 'createdByUser',
24
+ });
25
+ RmsPurchaseOrderItemModel.belongsTo(UserModel, {
26
+ foreignKey: { name: 'updatedBy', field: 'updated_by', allowNull: true },
27
+ as: 'updatedByUser',
28
+ });
29
+ RmsPurchaseOrderItemModel.belongsTo(UserModel, {
30
+ foreignKey: { name: 'deletedBy', field: 'deleted_by', allowNull: true },
31
+ as: 'deletedByUser',
32
+ });
33
+ }
34
+ }
35
+ RmsPurchaseOrderItemModel.init({
36
+ id: {
37
+ type: sequelize_1.DataTypes.UUID,
38
+ defaultValue: sequelize_1.DataTypes.UUIDV4,
39
+ allowNull: false,
40
+ primaryKey: true,
41
+ },
42
+ instituteId: {
43
+ type: sequelize_1.DataTypes.UUID,
44
+ allowNull: false,
45
+ },
46
+ purchaseOrderId: {
47
+ type: sequelize_1.DataTypes.UUID,
48
+ allowNull: false,
49
+ },
50
+ resourceId: {
51
+ type: sequelize_1.DataTypes.UUID,
52
+ allowNull: false,
53
+ },
54
+ quantity: {
55
+ type: sequelize_1.DataTypes.DECIMAL(10, 2),
56
+ allowNull: false,
57
+ },
58
+ receivedQuantity: {
59
+ type: sequelize_1.DataTypes.DECIMAL(10, 2),
60
+ allowNull: false,
61
+ defaultValue: 0,
62
+ },
63
+ rate: {
64
+ type: sequelize_1.DataTypes.DECIMAL(10, 2),
65
+ allowNull: false,
66
+ defaultValue: 0,
67
+ },
68
+ taxAmount: {
69
+ type: sequelize_1.DataTypes.DECIMAL(10, 2),
70
+ allowNull: false,
71
+ defaultValue: 0,
72
+ },
73
+ amount: {
74
+ type: sequelize_1.DataTypes.DECIMAL(15, 2),
75
+ allowNull: false,
76
+ },
77
+ status: {
78
+ type: sequelize_1.DataTypes.STRING,
79
+ allowNull: false,
80
+ defaultValue: app_1.COMMAN_STATUS.ACTIVE,
81
+ },
82
+ }, {
83
+ sequelize: index_1.sequelize,
84
+ modelName: 'RmsPurchaseOrderItemModel',
85
+ tableName: 'rms_purchase_order_items',
86
+ timestamps: true,
87
+ paranoid: true,
88
+ });
89
+ exports.default = RmsPurchaseOrderItemModel;
@@ -0,0 +1,27 @@
1
+ import { Model } from 'sequelize';
2
+ import { IRmsPurchaseOrderAttributes } from '../../interfaces/rmsPurchaseOrderInterface';
3
+ import { TRmsPurchaseOrderCreationAttributes } from '../../types/rmsPurchaseOrderType';
4
+ import { RMS_APPROVAL_STATUS, RMS_PO_FULFILLMENT_STATUS } from '../../constants/app';
5
+ declare class RmsPurchaseOrderModel extends Model<IRmsPurchaseOrderAttributes, TRmsPurchaseOrderCreationAttributes> {
6
+ id: string;
7
+ instituteId: string;
8
+ poNumber: string;
9
+ purchaseRequestId?: string | null;
10
+ vendorId: string;
11
+ orderDate: Date;
12
+ expectedDeliveryDate?: Date | null;
13
+ totalAmount: number;
14
+ taxAmount: number;
15
+ discountAmount: number;
16
+ approvalStatus: RMS_APPROVAL_STATUS;
17
+ fulfillmentStatus: RMS_PO_FULFILLMENT_STATUS;
18
+ status: string;
19
+ createdBy?: string | null;
20
+ updatedBy?: string | null;
21
+ deletedBy?: string | null;
22
+ readonly createdAt?: Date;
23
+ readonly updatedAt?: Date;
24
+ readonly deletedAt?: Date | null;
25
+ static associate(models: any): void;
26
+ }
27
+ export default RmsPurchaseOrderModel;