@churchsoln/dbms 1.0.54 → 1.0.55
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/constants/index.js
CHANGED
|
@@ -59,6 +59,29 @@ const MEMBER_STATUS = {
|
|
|
59
59
|
VISITOR: "Visitor",
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
+
const ACCOUNTS = {
|
|
63
|
+
MEMBERS_SUBSCRIPTION: "Members Subscription",
|
|
64
|
+
CAPITAL_FUND_DONATION: "Capital Fund Donation",
|
|
65
|
+
MONTHLY_MORTGAGE_CONTRIBUTION: "Monthly Mortgage Contribution",
|
|
66
|
+
OFFERTORY_PLATE: "Offertory - Plate (Loose Plate)",
|
|
67
|
+
OFFERTORY_COVER: "Offertory - Cover",
|
|
68
|
+
BIRTHDAY_COVER: "Birthday Cover",
|
|
69
|
+
WEDDING_ANNIVERSARY_COVER: "Wedding Anniversary Cover",
|
|
70
|
+
REMEMBERANCE_PRAYER_DONATION: "Rememberance Prayer Donation",
|
|
71
|
+
SELF_DENIAL_COVER: "Self Denial Cover",
|
|
72
|
+
SPECIAL_DONATION: "Special Donation",
|
|
73
|
+
PASSION_WEEK: "Passion Week",
|
|
74
|
+
WEDDING_FEES: "Wedding Fees",
|
|
75
|
+
BAPTISM_FEES: "Baptism Fees",
|
|
76
|
+
CATHOLICATE_DAY_FUND: "Catholicate Day Fund",
|
|
77
|
+
ARTICLE_DONATIONS: "Article Donations",
|
|
78
|
+
HARVEST_FESTIVAL: "Harvest Festival",
|
|
79
|
+
SUNDAY_SCHOOL_COLLECTION: "Sunday School - Collection",
|
|
80
|
+
MMVS_COLLECTION: "MMVS Collection",
|
|
81
|
+
CHRISTMAS_DONATIONS: "Christmas Donations",
|
|
82
|
+
CHARITY_FUNDS: "Charity Funds",
|
|
83
|
+
}
|
|
84
|
+
|
|
62
85
|
const GENDER = {
|
|
63
86
|
MALE: "Male",
|
|
64
87
|
FEMALE: "Female",
|
|
@@ -90,5 +113,6 @@ module.exports = {
|
|
|
90
113
|
MEMBER_STATUS,
|
|
91
114
|
GENDER,
|
|
92
115
|
RELATIONSHIP,
|
|
93
|
-
CODE_LENGTH
|
|
116
|
+
CODE_LENGTH,
|
|
117
|
+
ACCOUNTS
|
|
94
118
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
up: async (queryInterface, DataTypes) => {
|
|
5
|
+
await queryInterface.addColumn("Member", "spouseId", {
|
|
6
|
+
type: DataTypes.INTEGER,
|
|
7
|
+
allowNull: true,
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
await queryInterface.addConstraint("Member", {
|
|
11
|
+
fields: ["spouseId"],
|
|
12
|
+
type: "foreign key",
|
|
13
|
+
name: "Member_SpouseId_Fkey",
|
|
14
|
+
references: {
|
|
15
|
+
table: "Member",
|
|
16
|
+
field: "id",
|
|
17
|
+
},
|
|
18
|
+
onDelete: "SET NULL",
|
|
19
|
+
onUpdate: "CASCADE",
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
down: async (queryInterface) => {
|
|
24
|
+
await queryInterface.removeConstraint("Member", "Member_SpouseId_Fkey");
|
|
25
|
+
await queryInterface.removeColumn("Member", "spouseId");
|
|
26
|
+
},
|
|
27
|
+
};
|
package/models/church/member.js
CHANGED
|
@@ -84,6 +84,12 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
84
84
|
isIn: [Object.values(RELATIONSHIP)],
|
|
85
85
|
},
|
|
86
86
|
},
|
|
87
|
+
spouseId: {
|
|
88
|
+
type: DataTypes.INTEGER,
|
|
89
|
+
set(spouseId) {
|
|
90
|
+
this.setDataValue("spouseId", spouseId?.id || spouseId);
|
|
91
|
+
},
|
|
92
|
+
},
|
|
87
93
|
|
|
88
94
|
// Dates
|
|
89
95
|
birthDate: { type: DataTypes.DATE },
|
|
@@ -121,6 +127,7 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
121
127
|
member.belongsTo(models.memberStatus, { foreignKey: "memberStatusId", as: "memberStatus" });
|
|
122
128
|
member.belongsTo(models.province, { foreignKey: "provinceId", as: "province" });
|
|
123
129
|
member.belongsTo(models.city, { foreignKey: "cityId", as: "city" });
|
|
130
|
+
member.belongsTo(models.member, { foreignKey: "spouseId", as: "spouse" });
|
|
124
131
|
}
|
|
125
132
|
member.selectedFields = [
|
|
126
133
|
"id",
|
|
@@ -158,6 +165,7 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
158
165
|
"envNumber",
|
|
159
166
|
"gender",
|
|
160
167
|
"relationship",
|
|
168
|
+
"spouseId",
|
|
161
169
|
"birthDate",
|
|
162
170
|
"weddingDate",
|
|
163
171
|
"baptizedDate",
|
package/package.json
CHANGED
|
@@ -7,6 +7,11 @@ module.exports = {
|
|
|
7
7
|
const memberStatuses = [
|
|
8
8
|
{ name: MEMBER_STATUS.ACTIVE, isEditable: false, status: true },
|
|
9
9
|
{ name: MEMBER_STATUS.INACTIVE, isEditable: false, status: true },
|
|
10
|
+
{ name: MEMBER_STATUS.DECEASED, isEditable: true, status: true },
|
|
11
|
+
{ name: MEMBER_STATUS.PROSPECT, isEditable: true, status: true },
|
|
12
|
+
{ name: MEMBER_STATUS.REGULAR_ATTENDEE, isEditable: true, status: true },
|
|
13
|
+
{ name: MEMBER_STATUS.SINGLE_MEMBER, isEditable: true, status: true },
|
|
14
|
+
{ name: MEMBER_STATUS.VISITOR, isEditable: true, status: true },
|
|
10
15
|
];
|
|
11
16
|
|
|
12
17
|
for (const memberStatus of memberStatuses) {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { ACCOUNTS } = require("../../constants");
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
up: async (queryInterface, Sequelize) => {
|
|
7
|
+
const accounts = Object.values(ACCOUNTS).map((account) => ({
|
|
8
|
+
accountHead: account,
|
|
9
|
+
accountDescription: account,
|
|
10
|
+
isLinkedWithQB: false,
|
|
11
|
+
status: true,
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
for (const account of accounts) {
|
|
15
|
+
const existingAccount = await queryInterface.rawSelect(
|
|
16
|
+
"Accounts",
|
|
17
|
+
{
|
|
18
|
+
where: { accountHead: account.accountHead },
|
|
19
|
+
},
|
|
20
|
+
["id"]
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
if (existingAccount) {
|
|
24
|
+
await queryInterface.bulkUpdate(
|
|
25
|
+
"Accounts",
|
|
26
|
+
{
|
|
27
|
+
status: account.status,
|
|
28
|
+
isLinkedWithQB: account.isLinkedWithQB,
|
|
29
|
+
accountDescription: account.accountDescription
|
|
30
|
+
},
|
|
31
|
+
{ accountHead: account.accountHead }
|
|
32
|
+
);
|
|
33
|
+
} else {
|
|
34
|
+
await queryInterface.bulkInsert("Accounts", [account], {});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
down: async (queryInterface, Sequelize) => {},
|
|
40
|
+
};
|