@churchsoln/dbms 1.0.49 → 1.0.50
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.
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, DataTypes) => {
|
|
5
|
+
await queryInterface.removeColumn(
|
|
6
|
+
"ContributionTransactionLine",
|
|
7
|
+
"pledgeAccountId",
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
await queryInterface.addColumn(
|
|
11
|
+
"ContributionTransactionLine",
|
|
12
|
+
"accountId",
|
|
13
|
+
{
|
|
14
|
+
type: DataTypes.INTEGER,
|
|
15
|
+
allowNull: true
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
await queryInterface.addConstraint("ContributionTransactionLine", {
|
|
20
|
+
fields: ["accountId"],
|
|
21
|
+
type: "foreign key",
|
|
22
|
+
name: "ContributionTxnLine_AccountId_Fkey",
|
|
23
|
+
references: {
|
|
24
|
+
table: "Accounts",
|
|
25
|
+
field: "id",
|
|
26
|
+
},
|
|
27
|
+
onDelete: "cascade",
|
|
28
|
+
onUpdate: "cascade",
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
down: async (queryInterface, DataTypes) => {}
|
|
33
|
+
};
|
|
@@ -17,6 +17,10 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
17
17
|
foreignKey: "accountId",
|
|
18
18
|
as: "pledgeAccount",
|
|
19
19
|
});
|
|
20
|
+
accounts.hasMany(models.contributionTransactionLine, {
|
|
21
|
+
foreignKey: "accountId",
|
|
22
|
+
as: "contributionTransactionLine",
|
|
23
|
+
});
|
|
20
24
|
}
|
|
21
25
|
accounts.selectedFields = ["id", "accountHead", "accountDescription", "isLinkedWithQB"];
|
|
22
26
|
return accounts;
|
|
@@ -16,12 +16,12 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
16
16
|
isInt: { msg: "Transaction ID must be an integer" },
|
|
17
17
|
},
|
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
accountId: {
|
|
20
20
|
type: DataTypes.INTEGER,
|
|
21
21
|
allowNull: false,
|
|
22
22
|
validate: {
|
|
23
|
-
notNull: { msg: "
|
|
24
|
-
isInt: { msg: "
|
|
23
|
+
notNull: { msg: "Account ID is required" },
|
|
24
|
+
isInt: { msg: "Account ID must be an integer" },
|
|
25
25
|
},
|
|
26
26
|
},
|
|
27
27
|
isLoosePlate: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
@@ -57,9 +57,9 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
57
57
|
{ freezeTableName: true, timestamps: false }
|
|
58
58
|
);
|
|
59
59
|
contributionTransactionLine.associate = function (models) {
|
|
60
|
-
contributionTransactionLine.belongsTo(models.
|
|
61
|
-
foreignKey: "
|
|
62
|
-
as: "
|
|
60
|
+
contributionTransactionLine.belongsTo(models.accounts, {
|
|
61
|
+
foreignKey: "accountId",
|
|
62
|
+
as: "accounts",
|
|
63
63
|
});
|
|
64
64
|
contributionTransactionLine.belongsTo(models.contributionTransaction, {
|
|
65
65
|
foreignKey: "contributionTransactionId",
|
|
@@ -69,7 +69,7 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
69
69
|
contributionTransactionLine.selectedFields = [
|
|
70
70
|
"id",
|
|
71
71
|
"contributionTransactionId",
|
|
72
|
-
"
|
|
72
|
+
"accountId",
|
|
73
73
|
"isLoosePlate",
|
|
74
74
|
"amount",
|
|
75
75
|
"isTaxable",
|
|
@@ -25,10 +25,6 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
25
25
|
foreignKey: "pledgeAccountId",
|
|
26
26
|
as: "pledge",
|
|
27
27
|
});
|
|
28
|
-
pledgeAccount.hasMany(models.contributionTransactionLine, {
|
|
29
|
-
foreignKey: "pledgeAccountId",
|
|
30
|
-
as: "contributionTransactionLine",
|
|
31
|
-
});
|
|
32
28
|
};
|
|
33
29
|
pledgeAccount.selectedFields = [
|
|
34
30
|
"id",
|