@churchsoln/dbms 1.0.27 → 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/constants/index.js
CHANGED
|
@@ -42,4 +42,40 @@ const SUBSCRIPTION_PLAN_ID = {
|
|
|
42
42
|
PREMIUM: 3,
|
|
43
43
|
CUSTOM: 4
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
|
|
46
|
+
const MEMBER_STATUS = {
|
|
47
|
+
ACTIVE: "Active",
|
|
48
|
+
INACTIVE: "Inactive",
|
|
49
|
+
DECEASED: "Deceased",
|
|
50
|
+
PROSPECT: "Prospect",
|
|
51
|
+
REGULAR_ATTENDEE: "Regular Attendee",
|
|
52
|
+
SINGLE_MEMBER: "Single Member",
|
|
53
|
+
VISITOR: "Visitor",
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const GENDER = {
|
|
57
|
+
MALE: "Male",
|
|
58
|
+
FEMALE: "Female",
|
|
59
|
+
OTHER: "Other",
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const RELATIONSHIP = {
|
|
63
|
+
HEAD: "Head",
|
|
64
|
+
SPOUSE: "Spouse",
|
|
65
|
+
CHILD: "Child",
|
|
66
|
+
SIBLING: "Sibling",
|
|
67
|
+
OTHER: "Other",
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
module.exports = {
|
|
71
|
+
ROLES,
|
|
72
|
+
TRANSFER_STATUS,
|
|
73
|
+
QUEUES,
|
|
74
|
+
WORKERS,
|
|
75
|
+
AUTH_DATA,
|
|
76
|
+
ONBOARD_STATUS,
|
|
77
|
+
SUBSCRIPTION_PLAN_ID,
|
|
78
|
+
MEMBER_STATUS,
|
|
79
|
+
GENDER,
|
|
80
|
+
RELATIONSHIP,
|
|
81
|
+
};
|
package/controllers/master.js
CHANGED
|
@@ -90,95 +90,6 @@ class MasterController {
|
|
|
90
90
|
response.error(req, res, errorCodes.HTTP_INTERNAL_SERVER_ERROR, err);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
async addProvince(req, res) {
|
|
94
|
-
try {
|
|
95
|
-
const result = await masterService.addProvinceService(req.body);
|
|
96
|
-
response.success(req, res, result.code, result.data, result.message);
|
|
97
|
-
} catch (err) {
|
|
98
|
-
response.error(req, res, errorCodes.HTTP_INTERNAL_SERVER_ERROR, err);
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
async allProvinces(req, res) {
|
|
102
|
-
try {
|
|
103
|
-
const result = await masterService.allProvincesService(req.query);
|
|
104
|
-
response.success(req, res, result.code, result.data, result.message);
|
|
105
|
-
} catch (err) {
|
|
106
|
-
response.error(req, res, errorCodes.HTTP_INTERNAL_SERVER_ERROR, err);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
async provinceById(req, res) {
|
|
110
|
-
try {
|
|
111
|
-
const result = await masterService.provinceByIdService(req.params);
|
|
112
|
-
response.success(req, res, result.code, result.data, result.message);
|
|
113
|
-
} catch (err) {
|
|
114
|
-
response.error(req, res, errorCodes.HTTP_INTERNAL_SERVER_ERROR, err);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
async updateProvinceById(req, res) {
|
|
118
|
-
try {
|
|
119
|
-
const result = await masterService.updateProvinceByIdService({
|
|
120
|
-
...req.params,
|
|
121
|
-
...req.body,
|
|
122
|
-
});
|
|
123
|
-
response.success(req, res, result.code, result.data, result.message);
|
|
124
|
-
} catch (err) {
|
|
125
|
-
response.error(req, res, errorCodes.HTTP_INTERNAL_SERVER_ERROR, err);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
async deleteProvinceById(req, res) {
|
|
129
|
-
try {
|
|
130
|
-
const result = await masterService.deleteProvinceByIdService(req.params);
|
|
131
|
-
response.success(req, res, result.code, result.data, result.message);
|
|
132
|
-
} catch (err) {
|
|
133
|
-
response.error(req, res, errorCodes.HTTP_INTERNAL_SERVER_ERROR, err);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
async allCities(req, res) {
|
|
137
|
-
try {
|
|
138
|
-
const result = await masterService.allCitiesService(req.query);
|
|
139
|
-
response.success(req, res, result.code, result.data, result.message);
|
|
140
|
-
} catch (err) {
|
|
141
|
-
response.error(req, res, errorCodes.HTTP_INTERNAL_SERVER_ERROR, err);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
async addCity(req, res) {
|
|
145
|
-
try {
|
|
146
|
-
const result = await masterService.addCityService({
|
|
147
|
-
...req.query,
|
|
148
|
-
...req.body,
|
|
149
|
-
});
|
|
150
|
-
response.success(req, res, result.code, result.data, result.message);
|
|
151
|
-
} catch (err) {
|
|
152
|
-
response.error(req, res, errorCodes.HTTP_INTERNAL_SERVER_ERROR, err);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
async cityById(req, res) {
|
|
156
|
-
try {
|
|
157
|
-
const result = await masterService.cityByIdService(req.params);
|
|
158
|
-
response.success(req, res, result.code, result.data, result.message);
|
|
159
|
-
} catch (err) {
|
|
160
|
-
response.error(req, res, errorCodes.HTTP_INTERNAL_SERVER_ERROR, err);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
async updateCityById(req, res) {
|
|
164
|
-
try {
|
|
165
|
-
const result = await masterService.updateCityByIdService({
|
|
166
|
-
...req.params,
|
|
167
|
-
...req.body,
|
|
168
|
-
});
|
|
169
|
-
response.success(req, res, result.code, result.data, result.message);
|
|
170
|
-
} catch (err) {
|
|
171
|
-
response.error(req, res, errorCodes.HTTP_INTERNAL_SERVER_ERROR, err);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
async deleteCityById(req, res) {
|
|
175
|
-
try {
|
|
176
|
-
const result = await masterService.deleteCityByIdService(req.params);
|
|
177
|
-
response.success(req, res, result.code, result.data, result.message);
|
|
178
|
-
} catch (err) {
|
|
179
|
-
response.error(req, res, errorCodes.HTTP_INTERNAL_SERVER_ERROR, err);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
93
|
async addPermission(req, res) {
|
|
183
94
|
try {
|
|
184
95
|
const result = await masterService.addPermission({ ...req.user, ...req.body });
|
|
@@ -5,6 +5,8 @@ module.exports = {
|
|
|
5
5
|
"Province",
|
|
6
6
|
{
|
|
7
7
|
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
|
|
8
|
+
country: { type: DataTypes.STRING },
|
|
9
|
+
code: { type: DataTypes.STRING },
|
|
8
10
|
name: { type: DataTypes.STRING },
|
|
9
11
|
status: { type: DataTypes.BOOLEAN, defaultValue: true },
|
|
10
12
|
createdAt: {
|
package/migrations/{common/20221226150238-create-city.js → church/20221226151616-create-city.js}
RENAMED
|
@@ -7,6 +7,7 @@ module.exports = {
|
|
|
7
7
|
{
|
|
8
8
|
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
|
|
9
9
|
provinceId: { type: DataTypes.INTEGER },
|
|
10
|
+
provinceCode: { type: DataTypes.STRING },
|
|
10
11
|
name: { type: DataTypes.STRING },
|
|
11
12
|
status: { type: DataTypes.BOOLEAN, defaultValue: true },
|
|
12
13
|
createdAt: {
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { MEMBER_STATUS } = require("../../constants");
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
up: async (queryInterface, DataTypes) => {
|
|
7
|
+
await queryInterface.createTable("Membership", {
|
|
8
|
+
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
|
|
9
|
+
|
|
10
|
+
// Family Profile Fields
|
|
11
|
+
directoryName: { type: DataTypes.STRING },
|
|
12
|
+
salutation: { type: DataTypes.STRING },
|
|
13
|
+
mailingName: { type: DataTypes.STRING },
|
|
14
|
+
address: { type: DataTypes.TEXT },
|
|
15
|
+
cityId: {
|
|
16
|
+
type: DataTypes.INTEGER,
|
|
17
|
+
references: {
|
|
18
|
+
model: "City",
|
|
19
|
+
key: "id",
|
|
20
|
+
},
|
|
21
|
+
onDelete: "SET NULL",
|
|
22
|
+
},
|
|
23
|
+
provinceId: {
|
|
24
|
+
type: DataTypes.INTEGER,
|
|
25
|
+
references: {
|
|
26
|
+
model: "Province",
|
|
27
|
+
key: "id",
|
|
28
|
+
},
|
|
29
|
+
onDelete: "SET NULL",
|
|
30
|
+
},
|
|
31
|
+
zipCode: { type: DataTypes.STRING },
|
|
32
|
+
memberStatus: {
|
|
33
|
+
type: DataTypes.STRING,
|
|
34
|
+
defaultValue: MEMBER_STATUS.ACTIVE,
|
|
35
|
+
validate: {
|
|
36
|
+
isIn: [[MEMBER_STATUS.ACTIVE, MEMBER_STATUS.INACTIVE, MEMBER_STATUS.VISITOR]],
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
phone: { type: DataTypes.STRING },
|
|
40
|
+
email: {
|
|
41
|
+
type: DataTypes.STRING,
|
|
42
|
+
validate: { isEmail: true },
|
|
43
|
+
},
|
|
44
|
+
geographicArea: { type: DataTypes.STRING },
|
|
45
|
+
notes: { type: DataTypes.TEXT },
|
|
46
|
+
|
|
47
|
+
// Mailing List & Settings Flags
|
|
48
|
+
enabledProfile: { type: DataTypes.BOOLEAN, defaultValue: true },
|
|
49
|
+
includeInDirectory: { type: DataTypes.BOOLEAN, defaultValue: true },
|
|
50
|
+
isOrganization: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
51
|
+
emailStatement: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
52
|
+
|
|
53
|
+
// Metadata
|
|
54
|
+
createdAt: {
|
|
55
|
+
type: DataTypes.DATE,
|
|
56
|
+
defaultValue: DataTypes.literal("CURRENT_TIMESTAMP"),
|
|
57
|
+
},
|
|
58
|
+
updatedAt: {
|
|
59
|
+
type: DataTypes.DATE,
|
|
60
|
+
defaultValue: DataTypes.literal("CURRENT_TIMESTAMP"),
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
down: async (queryInterface) => {
|
|
66
|
+
await queryInterface.dropTable("Membership");
|
|
67
|
+
},
|
|
68
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { MEMBER_STATUS, GENDER, RELATIONSHIP } = require("../../constants");
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
up: async (queryInterface, DataTypes) => {
|
|
7
|
+
await queryInterface.createTable("Member", {
|
|
8
|
+
id: {
|
|
9
|
+
type: DataTypes.INTEGER,
|
|
10
|
+
primaryKey: true,
|
|
11
|
+
autoIncrement: true,
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
// Foreign Key to memberships
|
|
15
|
+
membershipId: {
|
|
16
|
+
type: DataTypes.INTEGER,
|
|
17
|
+
references: {
|
|
18
|
+
model: "Membership",
|
|
19
|
+
key: "id",
|
|
20
|
+
},
|
|
21
|
+
onDelete: "CASCADE",
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
// Basic Identity
|
|
25
|
+
title: { type: DataTypes.STRING },
|
|
26
|
+
firstName: { type: DataTypes.STRING, allowNull: false },
|
|
27
|
+
middleName: { type: DataTypes.STRING },
|
|
28
|
+
lastName: { type: DataTypes.STRING, allowNull: false },
|
|
29
|
+
maidenName: { type: DataTypes.STRING },
|
|
30
|
+
suffix: { type: DataTypes.STRING },
|
|
31
|
+
salutation: { type: DataTypes.STRING },
|
|
32
|
+
preferredName: { type: DataTypes.STRING },
|
|
33
|
+
profileImage: { type: DataTypes.STRING },
|
|
34
|
+
|
|
35
|
+
// Contact Info
|
|
36
|
+
address: { type: DataTypes.TEXT },
|
|
37
|
+
cityId: {
|
|
38
|
+
type: DataTypes.INTEGER,
|
|
39
|
+
references: {
|
|
40
|
+
model: "City",
|
|
41
|
+
key: "id",
|
|
42
|
+
},
|
|
43
|
+
onDelete: "SET NULL",
|
|
44
|
+
},
|
|
45
|
+
provinceId: {
|
|
46
|
+
type: DataTypes.INTEGER,
|
|
47
|
+
references: {
|
|
48
|
+
model: "Province",
|
|
49
|
+
key: "id",
|
|
50
|
+
},
|
|
51
|
+
onDelete: "SET NULL",
|
|
52
|
+
},
|
|
53
|
+
provinceId: { type: DataTypes.INTEGER },
|
|
54
|
+
zipCode: { type: DataTypes.STRING },
|
|
55
|
+
homePhone: { type: DataTypes.STRING },
|
|
56
|
+
cellPhone: { type: DataTypes.STRING },
|
|
57
|
+
workPhone: { type: DataTypes.STRING },
|
|
58
|
+
email: { type: DataTypes.STRING, validate: { isEmail: true } },
|
|
59
|
+
|
|
60
|
+
// Other Personal Info
|
|
61
|
+
occupation: { type: DataTypes.STRING },
|
|
62
|
+
employer: { type: DataTypes.STRING },
|
|
63
|
+
schoolGrade: { type: DataTypes.STRING },
|
|
64
|
+
emergencyContact: { type: DataTypes.STRING },
|
|
65
|
+
emergencyPhone: { type: DataTypes.STRING },
|
|
66
|
+
geographicArea: { type: DataTypes.STRING },
|
|
67
|
+
|
|
68
|
+
// Membership Status
|
|
69
|
+
memberStatus: {
|
|
70
|
+
type: DataTypes.STRING,
|
|
71
|
+
defaultValue: MEMBER_STATUS.ACTIVE,
|
|
72
|
+
validate: {
|
|
73
|
+
isIn: [
|
|
74
|
+
[
|
|
75
|
+
MEMBER_STATUS.ACTIVE,
|
|
76
|
+
MEMBER_STATUS.INACTIVE,
|
|
77
|
+
MEMBER_STATUS.DECEASED,
|
|
78
|
+
MEMBER_STATUS.PROSPECT,
|
|
79
|
+
MEMBER_STATUS.REGULAR_ATTENDEE,
|
|
80
|
+
MEMBER_STATUS.SINGLE_MEMBER,
|
|
81
|
+
MEMBER_STATUS.VISITOR,
|
|
82
|
+
],
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
envNumber: { type: DataTypes.STRING },
|
|
88
|
+
gender: {
|
|
89
|
+
type: DataTypes.STRING,
|
|
90
|
+
validate: {
|
|
91
|
+
isIn: [Object.values(GENDER)],
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
relationship: {
|
|
95
|
+
type: DataTypes.STRING,
|
|
96
|
+
validate: {
|
|
97
|
+
isIn: [Object.values(RELATIONSHIP)],
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
// Dates
|
|
102
|
+
birthDate: { type: DataTypes.DATE },
|
|
103
|
+
weddingDate: { type: DataTypes.DATE },
|
|
104
|
+
baptizedDate: { type: DataTypes.DATE },
|
|
105
|
+
confessionDate: { type: DataTypes.DATE },
|
|
106
|
+
|
|
107
|
+
// Additional
|
|
108
|
+
notes: { type: DataTypes.TEXT },
|
|
109
|
+
otp: { type: DataTypes.INTEGER },
|
|
110
|
+
|
|
111
|
+
// Flags
|
|
112
|
+
enabledProfile: {
|
|
113
|
+
type: DataTypes.BOOLEAN,
|
|
114
|
+
defaultValue: true,
|
|
115
|
+
},
|
|
116
|
+
includeInDirectory: {
|
|
117
|
+
type: DataTypes.BOOLEAN,
|
|
118
|
+
defaultValue: true,
|
|
119
|
+
},
|
|
120
|
+
emailStatement: {
|
|
121
|
+
type: DataTypes.BOOLEAN,
|
|
122
|
+
defaultValue: false,
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
// Metadata
|
|
126
|
+
createdAt: {
|
|
127
|
+
type: DataTypes.DATE,
|
|
128
|
+
defaultValue: DataTypes.literal("CURRENT_TIMESTAMP"),
|
|
129
|
+
},
|
|
130
|
+
updatedAt: {
|
|
131
|
+
type: DataTypes.DATE,
|
|
132
|
+
defaultValue: DataTypes.literal("CURRENT_TIMESTAMP"),
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
|
|
137
|
+
down: async (queryInterface) => {
|
|
138
|
+
await queryInterface.dropTable("Member");
|
|
139
|
+
},
|
|
140
|
+
};
|
|
@@ -1,146 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
module.exports = {
|
|
3
3
|
up: async (queryInterface, DataTypes) => {
|
|
4
|
-
await queryInterface
|
|
5
|
-
.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
familyCode: { type: DataTypes.STRING },
|
|
14
|
-
familyName: { type: DataTypes.STRING },
|
|
15
|
-
memberCode: { type: DataTypes.STRING },
|
|
16
|
-
email: { type: DataTypes.STRING },
|
|
17
|
-
showEmail: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
18
|
-
password: { type: DataTypes.STRING },
|
|
19
|
-
phone: { type: DataTypes.STRING },
|
|
20
|
-
showPhone: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
21
|
-
firstName: { type: DataTypes.STRING },
|
|
22
|
-
showFirstName: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
23
|
-
lastName: { type: DataTypes.STRING },
|
|
24
|
-
showLastName: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
25
|
-
gender: { type: DataTypes.STRING },
|
|
26
|
-
showGender: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
27
|
-
dob: { type: DataTypes.DATEONLY },
|
|
28
|
-
showDob: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
29
|
-
education: { type: DataTypes.STRING },
|
|
30
|
-
showEducation: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
31
|
-
relationshipId: { type: DataTypes.INTEGER },
|
|
32
|
-
partnerId: { type: DataTypes.INTEGER },
|
|
33
|
-
showRelationship: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
34
|
-
maritalStatusId: { type: DataTypes.INTEGER },
|
|
35
|
-
showMaritalStatus: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
36
|
-
dateJoined: { type: DataTypes.DATEONLY },
|
|
37
|
-
showDateJoined: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
38
|
-
emergencyContact: { type: DataTypes.STRING },
|
|
39
|
-
showEmergencyContact: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
40
|
-
emergencyContactName: { type: DataTypes.STRING },
|
|
41
|
-
showEmergencyContactName: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
42
|
-
emergencyContactRelationshipId: { type: DataTypes.INTEGER },
|
|
43
|
-
showEmergencyContactRelationship: {
|
|
44
|
-
type: DataTypes.BOOLEAN,
|
|
45
|
-
defaultValue: false,
|
|
46
|
-
},
|
|
47
|
-
imageUrl: { type: DataTypes.TEXT },
|
|
48
|
-
showImage: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
49
|
-
address: { type: DataTypes.STRING },
|
|
50
|
-
showAddress: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
51
|
-
cityId: { type: DataTypes.INTEGER },
|
|
52
|
-
showCity: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
53
|
-
provinceId: { type: DataTypes.INTEGER },
|
|
54
|
-
postalCode: { type: DataTypes.STRING },
|
|
55
|
-
showPostal: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
56
|
-
otp: { type: DataTypes.INTEGER },
|
|
57
|
-
isUserAuthenticated: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
58
|
-
delUpdateAccess: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
59
|
-
directoryVisibility: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
60
|
-
userLoginAccess: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
61
|
-
isEmailSubscribed: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
62
|
-
status: { type: DataTypes.BOOLEAN, defaultValue: true },
|
|
63
|
-
createdAt: {
|
|
64
|
-
type: DataTypes.DATE,
|
|
65
|
-
defaultValue: DataTypes.literal("CURRENT_TIMESTAMP"),
|
|
66
|
-
},
|
|
67
|
-
updatedAt: {
|
|
68
|
-
type: DataTypes.DATE,
|
|
69
|
-
defaultValue: DataTypes.literal("CURRENT_TIMESTAMP"),
|
|
70
|
-
},
|
|
4
|
+
await queryInterface.createTable("User", {
|
|
5
|
+
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
|
|
6
|
+
|
|
7
|
+
// Link to the individual profile
|
|
8
|
+
memberId: {
|
|
9
|
+
type: DataTypes.INTEGER,
|
|
10
|
+
references: {
|
|
11
|
+
model: "Member",
|
|
12
|
+
key: "id",
|
|
71
13
|
},
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
)
|
|
113
|
-
.then(() =>
|
|
114
|
-
queryInterface.addConstraint("User", {
|
|
115
|
-
fields: ["maritalStatusId"],
|
|
116
|
-
type: "foreign key",
|
|
117
|
-
name: "MaritalStatus_User_Fkey",
|
|
118
|
-
references: {
|
|
119
|
-
table: "MaritalStatus",
|
|
120
|
-
field: "id",
|
|
121
|
-
},
|
|
122
|
-
onDelete: "cascade",
|
|
123
|
-
onUpdate: "cascade",
|
|
124
|
-
})
|
|
125
|
-
)
|
|
126
|
-
.then(() =>
|
|
127
|
-
queryInterface.addConstraint("User", {
|
|
128
|
-
fields: ["emergencyContactRelationshipId"],
|
|
129
|
-
type: "foreign key",
|
|
130
|
-
name: "Emergency_Relationship_User_Fkey",
|
|
131
|
-
references: {
|
|
132
|
-
table: "Relationship",
|
|
133
|
-
field: "id",
|
|
134
|
-
},
|
|
135
|
-
onDelete: "no action",
|
|
136
|
-
onUpdate: "no action",
|
|
137
|
-
})
|
|
138
|
-
)
|
|
139
|
-
.then(() =>
|
|
140
|
-
queryInterface.addIndex("User", ["email"], {
|
|
141
|
-
name: "email_Key",
|
|
142
|
-
})
|
|
143
|
-
);
|
|
14
|
+
onDelete: "CASCADE",
|
|
15
|
+
},
|
|
16
|
+
|
|
17
|
+
// Authentication Fields
|
|
18
|
+
username: {
|
|
19
|
+
type: DataTypes.STRING,
|
|
20
|
+
allowNull: false,
|
|
21
|
+
unique: true,
|
|
22
|
+
},
|
|
23
|
+
password: { type: DataTypes.STRING, allowNull: false },
|
|
24
|
+
email: {
|
|
25
|
+
type: DataTypes.STRING,
|
|
26
|
+
allowNull: false,
|
|
27
|
+
unique: true,
|
|
28
|
+
validate: { isEmail: true },
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
// Roles & Permissions
|
|
32
|
+
roleId: { type: DataTypes.INTEGER },
|
|
33
|
+
subRoleId: {
|
|
34
|
+
type: DataTypes.INTEGER,
|
|
35
|
+
references: {
|
|
36
|
+
model: "SubRole",
|
|
37
|
+
key: "id",
|
|
38
|
+
},
|
|
39
|
+
onDelete: "SET NULL",
|
|
40
|
+
},
|
|
41
|
+
status: { type: DataTypes.BOOLEAN, defaultValue: true },
|
|
42
|
+
|
|
43
|
+
// Metadata
|
|
44
|
+
lastLogin: { type: DataTypes.DATE },
|
|
45
|
+
createdAt: {
|
|
46
|
+
type: DataTypes.DATE,
|
|
47
|
+
defaultValue: DataTypes.literal("CURRENT_TIMESTAMP"),
|
|
48
|
+
},
|
|
49
|
+
updatedAt: {
|
|
50
|
+
type: DataTypes.DATE,
|
|
51
|
+
defaultValue: DataTypes.literal("CURRENT_TIMESTAMP"),
|
|
52
|
+
},
|
|
53
|
+
});
|
|
144
54
|
},
|
|
145
55
|
down: async (queryInterface) => {
|
|
146
56
|
await queryInterface.dropTable("User");
|
|
@@ -9,6 +9,7 @@ module.exports = {
|
|
|
9
9
|
content: { type: DataTypes.TEXT },
|
|
10
10
|
tabType: { type: DataTypes.STRING },
|
|
11
11
|
date: { type: DataTypes.DATE },
|
|
12
|
+
url: { type: DataTypes.STRING },
|
|
12
13
|
status: { type: DataTypes.BOOLEAN, defaultValue: true },
|
|
13
14
|
createdAt: {
|
|
14
15
|
type: DataTypes.DATE,
|
|
@@ -12,6 +12,8 @@ module.exports = {
|
|
|
12
12
|
transferedAt: { type: DataTypes.DATE },
|
|
13
13
|
amount: { type: DataTypes.INTEGER },
|
|
14
14
|
isTaxable: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
15
|
+
isLoosePlate: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
16
|
+
fullName: { type: DataTypes.STRING },
|
|
15
17
|
note: { type: DataTypes.TEXT },
|
|
16
18
|
status: { type: DataTypes.BOOLEAN, defaultValue: true },
|
|
17
19
|
createdAt: {
|
|
@@ -9,8 +9,22 @@ module.exports = {
|
|
|
9
9
|
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
|
|
10
10
|
name: { type: DataTypes.STRING },
|
|
11
11
|
address: { type: DataTypes.STRING },
|
|
12
|
-
cityId: {
|
|
13
|
-
|
|
12
|
+
cityId: {
|
|
13
|
+
type: DataTypes.INTEGER,
|
|
14
|
+
references: {
|
|
15
|
+
model: "City",
|
|
16
|
+
key: "id",
|
|
17
|
+
},
|
|
18
|
+
onDelete: "SET NULL",
|
|
19
|
+
},
|
|
20
|
+
provinceId: {
|
|
21
|
+
type: DataTypes.INTEGER,
|
|
22
|
+
references: {
|
|
23
|
+
model: "Province",
|
|
24
|
+
key: "id",
|
|
25
|
+
},
|
|
26
|
+
onDelete: "SET NULL",
|
|
27
|
+
},
|
|
14
28
|
country: { type: DataTypes.STRING },
|
|
15
29
|
postalCode: { type: DataTypes.STRING },
|
|
16
30
|
email: { type: DataTypes.STRING },
|
|
@@ -20,6 +34,7 @@ module.exports = {
|
|
|
20
34
|
charitable_reg_no: { type: DataTypes.STRING },
|
|
21
35
|
registration_agency: { type: DataTypes.STRING },
|
|
22
36
|
profile_image: { type: DataTypes.STRING },
|
|
37
|
+
emailAppPassword: { type: DataTypes.STRING },
|
|
23
38
|
status: { type: DataTypes.BOOLEAN, defaultValue: true },
|
|
24
39
|
createdAt: {
|
|
25
40
|
type: DataTypes.DATE,
|
|
@@ -12,8 +12,6 @@ module.exports = {
|
|
|
12
12
|
frequency: { type: DataTypes.STRING },
|
|
13
13
|
duration: { type: DataTypes.INTEGER },
|
|
14
14
|
pledged: { type: DataTypes.INTEGER },
|
|
15
|
-
received: { type: DataTypes.INTEGER },
|
|
16
|
-
remaining: { type: DataTypes.INTEGER },
|
|
17
15
|
status: { type: DataTypes.BOOLEAN, defaultValue: true },
|
|
18
16
|
createdAt: {
|
|
19
17
|
type: DataTypes.DATE,
|
|
@@ -10,8 +10,8 @@ module.exports = {
|
|
|
10
10
|
autoIncrement: true,
|
|
11
11
|
},
|
|
12
12
|
name: { type: DataTypes.STRING },
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
isFree: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
14
|
+
isCustom: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
15
15
|
status: { type: DataTypes.BOOLEAN, defaultValue: true },
|
|
16
16
|
createdAt: {
|
|
17
17
|
type: DataTypes.DATE,
|
|
@@ -6,6 +6,8 @@ module.exports = {
|
|
|
6
6
|
{
|
|
7
7
|
id: { type: DataTypes.INTEGER, primaryKey: true, autoIncrement: true },
|
|
8
8
|
name: { type: DataTypes.STRING },
|
|
9
|
+
isSubscription: { type: DataTypes.BOOLEAN, defaultValue: false },
|
|
10
|
+
cost: { type: DataTypes.FLOAT, defaultValue: 0 },
|
|
9
11
|
status: { type: DataTypes.BOOLEAN, defaultValue: true },
|
|
10
12
|
createdAt: {
|
|
11
13
|
type: DataTypes.DATE,
|