@churchsoln/dbms 1.0.37 → 1.0.39

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.
@@ -6,7 +6,7 @@ module.exports = {
6
6
  "ContributionBatch",
7
7
  {
8
8
  id: {
9
- type: DataTypes.BIGINT,
9
+ type: DataTypes.INTEGER,
10
10
  autoIncrement: true,
11
11
  primaryKey: true,
12
12
  },
@@ -6,7 +6,7 @@ module.exports = {
6
6
  "ContributionTransaction",
7
7
  {
8
8
  id: {
9
- type: DataTypes.BIGINT,
9
+ type: DataTypes.INTEGER,
10
10
  autoIncrement: true,
11
11
  primaryKey: true,
12
12
  },
@@ -6,12 +6,12 @@ module.exports = {
6
6
  "ContributionTransactionLine",
7
7
  {
8
8
  id: {
9
- type: DataTypes.BIGINT,
9
+ type: DataTypes.INTEGER,
10
10
  autoIncrement: true,
11
11
  primaryKey: true,
12
12
  },
13
13
  contributionTransactionId: {
14
- type: DataTypes.BIGINT,
14
+ type: DataTypes.INTEGER,
15
15
  allowNull: false,
16
16
  validate: {
17
17
  notNull: { msg: "Transaction ID is required" },
@@ -24,7 +24,7 @@ module.exports = {
24
24
  onDelete: "CASCADE",
25
25
  },
26
26
  accountId: {
27
- type: DataTypes.BIGINT,
27
+ type: DataTypes.INTEGER,
28
28
  allowNull: false,
29
29
  validate: {
30
30
  notNull: { msg: "Account ID is required" },
@@ -3,7 +3,7 @@ module.exports = (sequelize, DataTypes) => {
3
3
  "ContributionBatch",
4
4
  {
5
5
  id: {
6
- type: DataTypes.BIGINT,
6
+ type: DataTypes.INTEGER,
7
7
  autoIncrement: true,
8
8
  primaryKey: true,
9
9
  },
@@ -27,6 +27,12 @@ module.exports = (sequelize, DataTypes) => {
27
27
  },
28
28
  { freezeTableName: true, timestamps: false }
29
29
  );
30
+ contributionBatch.associate = function (models) {
31
+ contributionBatch.hasMany(models.contributionTransaction, {
32
+ foreignKey: "contributionBatchId",
33
+ as: "contributionTransaction",
34
+ });
35
+ }
30
36
  contributionBatch.selectedFields = [
31
37
  "id",
32
38
  "batchDate",
@@ -5,7 +5,7 @@ module.exports = (sequelize, DataTypes) => {
5
5
  "ContributionTransaction",
6
6
  {
7
7
  id: {
8
- type: DataTypes.BIGINT,
8
+ type: DataTypes.INTEGER,
9
9
  autoIncrement: true,
10
10
  primaryKey: true,
11
11
  },
@@ -71,6 +71,10 @@ module.exports = (sequelize, DataTypes) => {
71
71
  foreignKey: "transferTypeId",
72
72
  as: "transferType",
73
73
  });
74
+ contributionTransaction.hasMany(models.contributionTransactionLine, {
75
+ foreignKey: "contributionTransactionId",
76
+ as: "contributionTransactionLine",
77
+ });
74
78
  }
75
79
  contributionTransaction.selectedFields = [
76
80
  "id",
@@ -3,12 +3,12 @@ module.exports = (sequelize, DataTypes) => {
3
3
  "ContributionTransactionLine",
4
4
  {
5
5
  id: {
6
- type: DataTypes.BIGINT,
6
+ type: DataTypes.INTEGER,
7
7
  autoIncrement: true,
8
8
  primaryKey: true,
9
9
  },
10
10
  contributionTransactionId: {
11
- type: DataTypes.BIGINT,
11
+ type: DataTypes.INTEGER,
12
12
  allowNull: false,
13
13
  validate: {
14
14
  notNull: { msg: "Transaction ID is required" },
@@ -16,7 +16,7 @@ module.exports = (sequelize, DataTypes) => {
16
16
  },
17
17
  },
18
18
  accountId: {
19
- type: DataTypes.BIGINT,
19
+ type: DataTypes.INTEGER,
20
20
  allowNull: false,
21
21
  validate: {
22
22
  notNull: { msg: "Account ID is required" },
@@ -47,6 +47,12 @@ module.exports = (sequelize, DataTypes) => {
47
47
  },
48
48
  { freezeTableName: true, timestamps: false }
49
49
  );
50
+ contributionTransactionLine.associate = function (models) {
51
+ contributionTransactionLine.belongsTo(models.accounts, {
52
+ foreignKey: "accountId",
53
+ as: "accounts",
54
+ });
55
+ }
50
56
  contributionTransactionLine.selectedFields = [
51
57
  "id",
52
58
  "contributionTransactionId",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@churchsoln/dbms",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "prestart": "node db-setup.js",