@churchsoln/dbms 1.0.26 → 1.0.29
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 +37 -1
- package/controllers/master.js +0 -89
- package/migrations/{common/20221226143349-create-province.js → church/20221226151615-create-province.js} +2 -0
- package/migrations/{common/20221226150238-create-city.js → church/20221226151616-create-city.js} +1 -0
- package/migrations/church/20221226151618-create-membership.js +68 -0
- package/migrations/church/20221226151619-create-member.js +140 -0
- package/migrations/church/20221227151615-create-user.js +49 -139
- package/migrations/church/20230826140644-create-eventsUpdates.js +1 -0
- package/migrations/church/20240918170620-create-donation.js +2 -0
- package/migrations/church/20240918170621-create-church.js +17 -2
- package/migrations/church/20240918170627-create-pledge.js +0 -2
- package/migrations/common/20221226140655-create-subscriptionPlan.js +2 -2
- package/migrations/common/20240815170619-create-permission.js +2 -0
- package/migrations/common/20240815170620-create-church.js +1 -29
- package/models/church/church.js +16 -2
- package/models/{common → church}/city.js +2 -1
- package/models/church/member.js +171 -0
- package/models/church/membership.js +81 -0
- package/models/{common → church}/province.js +3 -1
- package/models/church/user.js +41 -254
- package/package.json +1 -1
- package/public/swagger/church.json +11 -23
- package/public/swagger/master.json +0 -313
- package/routes/v1/master.js +0 -24
- package/seeders/church/20241005124245-province.js +101 -0
- package/seeders/church/20241005124547-city.js +87 -0
- package/services/church.js +0 -2
- package/services/master.js +0 -152
- package/validators/church.js +1 -3
- package/workers/seed.js +1 -1
- package/migrations/church/20221226150553-create-maritalStatus.js +0 -25
- package/migrations/church/20221226151615-create-relationship.js +0 -25
- package/migrations/church/20240918170624-create-membershipType.js +0 -24
- package/migrations/church/20240918170625-update-user.js +0 -24
- package/migrations/church/20240918170626-update-eventsUpdate.js +0 -12
- package/migrations/church/20240918170628-update-pledge.js +0 -12
- package/migrations/church/20240918170629-update-donation.js +0 -12
- package/migrations/church/20240918170630-update-donation.js +0 -12
- package/migrations/church/20240918170631-update-church.js +0 -12
- package/migrations/common/20240918170624-update-church.js +0 -23
- package/migrations/common/20240918170625-update-permission.js +0 -17
- package/migrations/common/20240918170626-update-subscriptionPlan.js +0 -20
- package/migrations/common/20240918170628-update-church.js +0 -12
- package/models/church/maritalStatus.js +0 -15
- package/models/church/membershipType.js +0 -16
- package/models/church/relationship.js +0 -15
- package/seeders/church/20241005131256-maritalStatus.js +0 -43
- package/seeders/church/20241005131416-relationship.js +0 -43
- package/seeders/church/20241005131417-membershipType.js +0 -39
- package/seeders/common/20241005124245-province.js +0 -42
- package/seeders/common/20241005124547-city.js +0 -55
package/models/church/user.js
CHANGED
|
@@ -5,17 +5,24 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
5
5
|
"User",
|
|
6
6
|
{
|
|
7
7
|
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
8
|
+
|
|
9
|
+
// Link to the individual profile
|
|
10
|
+
memberId: {
|
|
11
|
+
type: DataTypes.INTEGER,
|
|
12
|
+
set(memberId) {
|
|
13
|
+
this.setDataValue("memberId", memberId?.id || memberId);
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
// Authentication Fields
|
|
18
|
+
username: {
|
|
19
|
+
type: DataTypes.STRING,
|
|
20
|
+
allowNull: false,
|
|
21
|
+
unique: true,
|
|
22
|
+
},
|
|
17
23
|
password: {
|
|
18
24
|
type: DataTypes.STRING,
|
|
25
|
+
allowNull: false,
|
|
19
26
|
set(password) {
|
|
20
27
|
if (password) {
|
|
21
28
|
const encrypted = utils.genHash(password);
|
|
@@ -23,268 +30,48 @@ module.exports = (sequelize, DataTypes) => {
|
|
|
23
30
|
}
|
|
24
31
|
},
|
|
25
32
|
},
|
|
26
|
-
|
|
27
|
-
showPhone: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
28
|
-
firstName: { type: DataTypes.STRING },
|
|
29
|
-
showFirstName: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
30
|
-
lastName: { type: DataTypes.STRING },
|
|
31
|
-
showLastName: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
32
|
-
gender: { type: DataTypes.STRING },
|
|
33
|
-
showGender: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
34
|
-
dob: { type: DataTypes.DATEONLY },
|
|
35
|
-
showDob: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
36
|
-
education: { type: DataTypes.STRING },
|
|
37
|
-
showEducation: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
38
|
-
relationshipId: {
|
|
39
|
-
type: DataTypes.INTEGER,
|
|
40
|
-
set(relationshipId) {
|
|
41
|
-
this.setDataValue("relationshipId", relationshipId?.id || relationshipId);
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
partnerId: {
|
|
45
|
-
type: DataTypes.INTEGER,
|
|
46
|
-
set(partnerId) {
|
|
47
|
-
this.setDataValue("partnerId", partnerId?.id || partnerId);
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
showRelationship: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
51
|
-
maritalStatusId: {
|
|
52
|
-
type: DataTypes.INTEGER,
|
|
53
|
-
set(maritalStatusId) {
|
|
54
|
-
this.setDataValue("maritalStatusId", maritalStatusId?.id || maritalStatusId);
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
showMaritalStatus: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
58
|
-
dateJoined: { type: DataTypes.DATEONLY },
|
|
59
|
-
showDateJoined: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
60
|
-
emergencyContact: { type: DataTypes.STRING },
|
|
61
|
-
showEmergencyContact: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
62
|
-
emergencyContactName: { type: DataTypes.STRING },
|
|
63
|
-
showEmergencyContactName: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
64
|
-
emergencyContactRelationshipId: {
|
|
65
|
-
type: DataTypes.INTEGER,
|
|
66
|
-
set(emergencyContactRelationshipId) {
|
|
67
|
-
this.setDataValue(
|
|
68
|
-
"emergencyContactRelationshipId",
|
|
69
|
-
emergencyContactRelationshipId?.id || emergencyContactRelationshipId
|
|
70
|
-
);
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
showEmergencyContactRelationship: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
74
|
-
imageUrl: { type: DataTypes.TEXT },
|
|
75
|
-
showImage: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
76
|
-
address: { type: DataTypes.STRING },
|
|
77
|
-
showAddress: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
78
|
-
cityId: {
|
|
79
|
-
type: DataTypes.STRING,
|
|
80
|
-
set(cityId) {
|
|
81
|
-
this.setDataValue("cityId", cityId?.id || cityId);
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
showCity: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
85
|
-
provinceId: {
|
|
86
|
-
type: DataTypes.INTEGER,
|
|
87
|
-
set(provinceId) {
|
|
88
|
-
this.setDataValue("provinceId", provinceId?.id || provinceId);
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
postalCode: {
|
|
33
|
+
email: {
|
|
92
34
|
type: DataTypes.STRING,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
: undefined;
|
|
97
|
-
},
|
|
35
|
+
allowNull: false,
|
|
36
|
+
unique: true,
|
|
37
|
+
validate: { isEmail: true },
|
|
98
38
|
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
set(membershipTypeId) {
|
|
104
|
-
this.setDataValue("membershipTypeId", membershipTypeId?.id || membershipTypeId);
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
isUserAuthenticated: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
108
|
-
delUpdateAccess: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
109
|
-
directoryVisibility: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
110
|
-
userLoginAccess: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
111
|
-
isEmailSubscribed: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
39
|
+
|
|
40
|
+
// Roles & Permissions
|
|
41
|
+
roleId: { type: DataTypes.INTEGER },
|
|
42
|
+
subRoleId: { type: DataTypes.INTEGER },
|
|
112
43
|
status: { type: DataTypes.BOOLEAN, defaultValue: true },
|
|
44
|
+
|
|
45
|
+
// Metadata
|
|
46
|
+
lastLogin: { type: DataTypes.DATE },
|
|
113
47
|
createdAt: { type: DataTypes.DATE },
|
|
114
48
|
updatedAt: { type: DataTypes.DATE },
|
|
115
49
|
},
|
|
116
50
|
{ freezeTableName: true, timestamps: false }
|
|
117
51
|
);
|
|
118
52
|
user.associate = function (models) {
|
|
119
|
-
user.belongsTo(models.
|
|
120
|
-
user.belongsTo(models.user, { foreignKey: "partnerId", as: "partner" });
|
|
121
|
-
user.belongsTo(models.maritalStatus, {
|
|
122
|
-
foreignKey: "maritalStatusId",
|
|
123
|
-
as: "maritalStatus",
|
|
124
|
-
});
|
|
125
|
-
user.belongsTo(models.relationship, {
|
|
126
|
-
foreignKey: "emergencyContactRelationshipId",
|
|
127
|
-
as: "emergencyContactRelationship",
|
|
128
|
-
});
|
|
53
|
+
user.belongsTo(models.member, { foreignKey: "memberId", as: "member" });
|
|
129
54
|
user.belongsTo(models.subRole, { foreignKey: "subRoleId", as: "subRole" });
|
|
130
|
-
user.belongsTo(models.membershipType, {
|
|
131
|
-
foreignKey: "membershipTypeId",
|
|
132
|
-
as: "membershipType",
|
|
133
|
-
});
|
|
134
55
|
};
|
|
135
|
-
|
|
56
|
+
const selectedFields = [
|
|
136
57
|
"id",
|
|
58
|
+
"memberId",
|
|
137
59
|
"username",
|
|
138
|
-
"roleId",
|
|
139
|
-
"isHeadOfFamily",
|
|
140
|
-
"familyCode",
|
|
141
|
-
"familyName",
|
|
142
|
-
"memberCode",
|
|
143
|
-
"email",
|
|
144
|
-
"showEmail",
|
|
145
60
|
"password",
|
|
146
|
-
"phone",
|
|
147
|
-
"showPhone",
|
|
148
|
-
"firstName",
|
|
149
|
-
"showFirstName",
|
|
150
|
-
"lastName",
|
|
151
|
-
"showLastName",
|
|
152
|
-
"gender",
|
|
153
|
-
"showGender",
|
|
154
|
-
"dob",
|
|
155
|
-
"showDob",
|
|
156
|
-
"education",
|
|
157
|
-
"showEducation",
|
|
158
|
-
"relationshipId",
|
|
159
|
-
"partnerId",
|
|
160
|
-
"showRelationship",
|
|
161
|
-
"maritalStatusId",
|
|
162
|
-
"showMaritalStatus",
|
|
163
|
-
"dateJoined",
|
|
164
|
-
"showDateJoined",
|
|
165
|
-
"emergencyContact",
|
|
166
|
-
"showEmergencyContact",
|
|
167
|
-
"emergencyContactName",
|
|
168
|
-
"showEmergencyContactName",
|
|
169
|
-
"emergencyContactRelationshipId",
|
|
170
|
-
"showEmergencyContactRelationship",
|
|
171
|
-
"imageUrl",
|
|
172
|
-
"showImage",
|
|
173
|
-
"address",
|
|
174
|
-
"showAddress",
|
|
175
|
-
"cityId",
|
|
176
|
-
"showCity",
|
|
177
|
-
"provinceId",
|
|
178
|
-
"postalCode",
|
|
179
|
-
"showPostal",
|
|
180
|
-
"otp",
|
|
181
|
-
"membershipTypeId",
|
|
182
|
-
"isUserAuthenticated",
|
|
183
|
-
"delUpdateAccess",
|
|
184
|
-
"directoryVisibility",
|
|
185
|
-
"userLoginAccess",
|
|
186
|
-
"isEmailSubscribed",
|
|
187
|
-
"status",
|
|
188
|
-
"createdAt",
|
|
189
|
-
"updatedAt",
|
|
190
|
-
];
|
|
191
|
-
user.responseFields = [
|
|
192
|
-
"id",
|
|
193
|
-
"username",
|
|
194
|
-
"roleId",
|
|
195
|
-
"isHeadOfFamily",
|
|
196
|
-
"familyCode",
|
|
197
|
-
"familyName",
|
|
198
|
-
"memberCode",
|
|
199
|
-
"email",
|
|
200
|
-
"showEmail",
|
|
201
|
-
"phone",
|
|
202
|
-
"showPhone",
|
|
203
|
-
"firstName",
|
|
204
|
-
"showFirstName",
|
|
205
|
-
"lastName",
|
|
206
|
-
"showLastName",
|
|
207
|
-
"gender",
|
|
208
|
-
"showGender",
|
|
209
|
-
"dob",
|
|
210
|
-
"showDob",
|
|
211
|
-
"education",
|
|
212
|
-
"showEducation",
|
|
213
|
-
"relationshipId",
|
|
214
|
-
"partnerId",
|
|
215
|
-
"showRelationship",
|
|
216
|
-
"maritalStatusId",
|
|
217
|
-
"showMaritalStatus",
|
|
218
|
-
"dateJoined",
|
|
219
|
-
"showDateJoined",
|
|
220
|
-
"emergencyContact",
|
|
221
|
-
"showEmergencyContact",
|
|
222
|
-
"emergencyContactName",
|
|
223
|
-
"showEmergencyContactName",
|
|
224
|
-
"emergencyContactRelationshipId",
|
|
225
|
-
"showEmergencyContactRelationship",
|
|
226
|
-
"imageUrl",
|
|
227
|
-
"showImage",
|
|
228
|
-
"address",
|
|
229
|
-
"showAddress",
|
|
230
|
-
"cityId",
|
|
231
|
-
"showCity",
|
|
232
|
-
"provinceId",
|
|
233
|
-
"postalCode",
|
|
234
|
-
"showPostal",
|
|
235
|
-
"delUpdateAccess",
|
|
236
|
-
"directoryVisibility",
|
|
237
|
-
"userLoginAccess",
|
|
238
|
-
"isEmailSubscribed",
|
|
239
|
-
"membershipTypeId",
|
|
240
|
-
"status",
|
|
241
|
-
];
|
|
242
|
-
user.listFields = [
|
|
243
|
-
"id",
|
|
244
|
-
"username",
|
|
245
61
|
"email",
|
|
246
62
|
"roleId",
|
|
247
|
-
"
|
|
248
|
-
"gender",
|
|
249
|
-
"firstName",
|
|
250
|
-
"lastName",
|
|
251
|
-
"address",
|
|
252
|
-
"isUserAuthenticated",
|
|
253
|
-
"membershipTypeId",
|
|
254
|
-
"familyCode",
|
|
255
|
-
"memberCode",
|
|
63
|
+
"subRoleId",
|
|
256
64
|
"status",
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
"
|
|
260
|
-
"username",
|
|
261
|
-
"familyCode",
|
|
262
|
-
"firstName",
|
|
263
|
-
"lastName",
|
|
264
|
-
"email",
|
|
265
|
-
"phone",
|
|
266
|
-
];
|
|
267
|
-
user.showFields = [
|
|
268
|
-
["showEmail", ["email"]],
|
|
269
|
-
["showPhone", ["phone"]],
|
|
270
|
-
["showFirstName", ["firstName"]],
|
|
271
|
-
["showLastName", ["lastName"]],
|
|
272
|
-
["showGender", ["gender"]],
|
|
273
|
-
["showDob", ["dob"]],
|
|
274
|
-
["showEducation", ["education"]],
|
|
275
|
-
["showRelationship", ["relationshipId", "relationship"]],
|
|
276
|
-
["showMaritalStatus", ["maritalStatusId", "maritalStatus"]],
|
|
277
|
-
["showDateJoined", ["dateJoined"]],
|
|
278
|
-
["showEmergencyContact", ["emergencyContact"]],
|
|
279
|
-
["showEmergencyContactName", ["emergencyContactName"]],
|
|
280
|
-
[
|
|
281
|
-
"showEmergencyContactRelationship",
|
|
282
|
-
["emergencyContactRelationshipId", "emergencyContactRelationship"]
|
|
283
|
-
],
|
|
284
|
-
["showImage", ["imageUrl"]],
|
|
285
|
-
["showAddress", ["address"]],
|
|
286
|
-
["showCity", ["cityId", "city"]],
|
|
287
|
-
["showPostal", ["postalCode"]],
|
|
65
|
+
"lastLogin",
|
|
66
|
+
"createdAt",
|
|
67
|
+
"updatedAt",
|
|
288
68
|
]
|
|
69
|
+
user.selectedFields = [
|
|
70
|
+
...selectedFields,
|
|
71
|
+
"password"
|
|
72
|
+
];
|
|
73
|
+
user.responseFields = selectedFields;
|
|
74
|
+
user.listFields = selectedFields;
|
|
75
|
+
user.transferFields = selectedFields;
|
|
289
76
|
return user;
|
|
290
77
|
};
|
package/package.json
CHANGED
|
@@ -54,11 +54,9 @@
|
|
|
54
54
|
"validity": 30,
|
|
55
55
|
"permissionId": [1],
|
|
56
56
|
"churchAdminDetails": {
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"phone": "123456789",
|
|
61
|
-
"password": "password"
|
|
57
|
+
"username": "churchadmin",
|
|
58
|
+
"email": "churchadmin@xavier.com",
|
|
59
|
+
"password": "Church@123"
|
|
62
60
|
}
|
|
63
61
|
}
|
|
64
62
|
}
|
|
@@ -385,11 +383,9 @@
|
|
|
385
383
|
"validity": 30,
|
|
386
384
|
"permissionId": [1],
|
|
387
385
|
"churchAdminDetails": {
|
|
388
|
-
"
|
|
389
|
-
"
|
|
390
|
-
"
|
|
391
|
-
"phone": "123456789",
|
|
392
|
-
"password": "password"
|
|
386
|
+
"username": "churchadmin",
|
|
387
|
+
"email": "churchadmin@xavier.com",
|
|
388
|
+
"password": "Church@123"
|
|
393
389
|
}
|
|
394
390
|
}
|
|
395
391
|
},
|
|
@@ -441,31 +437,23 @@
|
|
|
441
437
|
},
|
|
442
438
|
"ChurchAdminDataRequest": {
|
|
443
439
|
"title": "ChurchAdminDataRequest",
|
|
444
|
-
"required": ["
|
|
440
|
+
"required": ["username", "email", "password"],
|
|
445
441
|
"type": "object",
|
|
446
442
|
"properties": {
|
|
447
|
-
"
|
|
448
|
-
"type": "string"
|
|
449
|
-
},
|
|
450
|
-
"lastName": {
|
|
443
|
+
"username": {
|
|
451
444
|
"type": "string"
|
|
452
445
|
},
|
|
453
446
|
"email": {
|
|
454
447
|
"type": "string"
|
|
455
448
|
},
|
|
456
|
-
"phone": {
|
|
457
|
-
"type": "string"
|
|
458
|
-
},
|
|
459
449
|
"password": {
|
|
460
450
|
"type": "string"
|
|
461
451
|
}
|
|
462
452
|
},
|
|
463
453
|
"example": {
|
|
464
|
-
"
|
|
465
|
-
"
|
|
466
|
-
"
|
|
467
|
-
"phone": "123456789",
|
|
468
|
-
"password": "password"
|
|
454
|
+
"username": "churchadmin",
|
|
455
|
+
"email": "churchadmin@xavier.com",
|
|
456
|
+
"password": "Church@123"
|
|
469
457
|
}
|
|
470
458
|
},
|
|
471
459
|
"SuperAdminLoginDataRequest": {
|