@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.
- package/migrations/church/20240919170627-create-contributionBatch.js +1 -1
- package/migrations/church/20240919170628-create-contributionTransaction.js +1 -1
- package/migrations/church/20240919170629-create-contributionTransactionLine.js +3 -3
- package/models/church/contributionBatch.js +7 -1
- package/models/church/contributionTransaction.js +5 -1
- package/models/church/contributionTransactionLine.js +9 -3
- package/package.json +1 -1
|
@@ -6,12 +6,12 @@ module.exports = {
|
|
|
6
6
|
"ContributionTransactionLine",
|
|
7
7
|
{
|
|
8
8
|
id: {
|
|
9
|
-
type: DataTypes.
|
|
9
|
+
type: DataTypes.INTEGER,
|
|
10
10
|
autoIncrement: true,
|
|
11
11
|
primaryKey: true,
|
|
12
12
|
},
|
|
13
13
|
contributionTransactionId: {
|
|
14
|
-
type: DataTypes.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
6
|
+
type: DataTypes.INTEGER,
|
|
7
7
|
autoIncrement: true,
|
|
8
8
|
primaryKey: true,
|
|
9
9
|
},
|
|
10
10
|
contributionTransactionId: {
|
|
11
|
-
type: DataTypes.
|
|
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.
|
|
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",
|