@churchsoln/dbms 1.0.15 → 1.0.17

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,13 @@
1
+ "use strict";
2
+
3
+ module.exports = {
4
+ up: async (queryInterface, DataTypes) => {
5
+ return Promise.all([
6
+ queryInterface.addColumn("User", "isPublic", {
7
+ type: DataTypes.BOOLEAN,
8
+ defaultValue: true
9
+ })
10
+ ]);
11
+ },
12
+ down: async (queryInterface) => {},
13
+ };
@@ -12,12 +12,7 @@ module.exports = (sequelize, DataTypes) => {
12
12
  familyCode: { type: DataTypes.STRING },
13
13
  familyName: { type: DataTypes.STRING },
14
14
  memberCode: { type: DataTypes.STRING },
15
- email: {
16
- type: DataTypes.STRING,
17
- get() {
18
- return this.getDataValue("showEmail") ? this.getDataValue("email") : undefined;
19
- },
20
- },
15
+ email: { type: DataTypes.STRING },
21
16
  showEmail: { type: DataTypes.BOOLEAN, defaultValue: false },
22
17
  password: {
23
18
  type: DataTypes.STRING,
@@ -28,64 +23,23 @@ module.exports = (sequelize, DataTypes) => {
28
23
  }
29
24
  },
30
25
  },
31
- phone: {
32
- type: DataTypes.STRING,
33
- get() {
34
- return this.getDataValue("showPhone") ? this.getDataValue("phone") : undefined;
35
- },
36
- },
26
+ phone: { type: DataTypes.STRING },
37
27
  showPhone: { type: DataTypes.BOOLEAN, defaultValue: false },
38
- firstName: {
39
- type: DataTypes.STRING,
40
- get() {
41
- return this.getDataValue("showFirstName")
42
- ? this.getDataValue("firstName")
43
- : undefined;
44
- },
45
- },
28
+ firstName: { type: DataTypes.STRING },
46
29
  showFirstName: { type: DataTypes.BOOLEAN, defaultValue: false },
47
- lastName: {
48
- type: DataTypes.STRING,
49
- get() {
50
- return this.getDataValue("showLastName")
51
- ? this.getDataValue("lastName")
52
- : undefined;
53
- },
54
- },
30
+ lastName: { type: DataTypes.STRING },
55
31
  showLastName: { type: DataTypes.BOOLEAN, defaultValue: false },
56
- gender: {
57
- type: DataTypes.STRING,
58
- get() {
59
- return this.getDataValue("showGender")
60
- ? this.getDataValue("gender")
61
- : undefined;
62
- },
63
- },
32
+ gender: { type: DataTypes.STRING },
64
33
  showGender: { type: DataTypes.BOOLEAN, defaultValue: false },
65
- dob: {
66
- type: DataTypes.DATEONLY,
67
- get() {
68
- return this.getDataValue("showDob") ? this.getDataValue("dob") : undefined;
69
- },
70
- },
34
+ dob: { type: DataTypes.DATEONLY },
71
35
  showDob: { type: DataTypes.BOOLEAN, defaultValue: false },
72
- education: {
73
- type: DataTypes.STRING,
74
- get() {
75
- return this.getDataValue("showEducation") ? this.getDataValue("education") : undefined;
76
- },
77
- },
36
+ education: { type: DataTypes.STRING },
78
37
  showEducation: { type: DataTypes.BOOLEAN, defaultValue: false },
79
38
  relationshipId: {
80
39
  type: DataTypes.INTEGER,
81
40
  set(relationshipId) {
82
41
  this.setDataValue("relationshipId", relationshipId?.id || relationshipId);
83
42
  },
84
- get() {
85
- return this.getDataValue("showRelationship")
86
- ? this.getDataValue("relationshipId")
87
- : undefined;
88
- },
89
43
  },
90
44
  partnerId: {
91
45
  type: DataTypes.INTEGER,
@@ -99,39 +53,13 @@ module.exports = (sequelize, DataTypes) => {
99
53
  set(maritalStatusId) {
100
54
  this.setDataValue("maritalStatusId", maritalStatusId?.id || maritalStatusId);
101
55
  },
102
- get() {
103
- return this.getDataValue("showMaritalStatus")
104
- ? this.getDataValue("maritalStatusId")
105
- : undefined;
106
- },
107
56
  },
108
57
  showMaritalStatus: { type: DataTypes.BOOLEAN, defaultValue: false },
109
- dateJoined: {
110
- type: DataTypes.DATEONLY,
111
- get() {
112
- return this.getDataValue("showDateJoined")
113
- ? this.getDataValue("dateJoined")
114
- : undefined;
115
- },
116
- },
58
+ dateJoined: { type: DataTypes.DATEONLY },
117
59
  showDateJoined: { type: DataTypes.BOOLEAN, defaultValue: false },
118
- emergencyContact: {
119
- type: DataTypes.STRING,
120
- get() {
121
- return this.getDataValue("showEmergencyContact")
122
- ? this.getDataValue("emergencyContact")
123
- : undefined;
124
- },
125
- },
60
+ emergencyContact: { type: DataTypes.STRING },
126
61
  showEmergencyContact: { type: DataTypes.BOOLEAN, defaultValue: false },
127
- emergencyContactName: {
128
- type: DataTypes.STRING,
129
- get() {
130
- return this.getDataValue("showEmergencyContactName")
131
- ? this.getDataValue("emergencyContactName")
132
- : undefined;
133
- },
134
- },
62
+ emergencyContactName: { type: DataTypes.STRING },
135
63
  showEmergencyContactName: { type: DataTypes.BOOLEAN, defaultValue: false },
136
64
  emergencyContactRelationshipId: {
137
65
  type: DataTypes.INTEGER,
@@ -141,35 +69,16 @@ module.exports = (sequelize, DataTypes) => {
141
69
  emergencyContactRelationshipId?.id || emergencyContactRelationshipId
142
70
  );
143
71
  },
144
- get() {
145
- return this.getDataValue("showEmergencyContactRelationship")
146
- ? this.getDataValue("emergencyContactRelationshipId")
147
- : undefined;
148
- },
149
72
  },
150
73
  showEmergencyContactRelationship: { type: DataTypes.BOOLEAN, defaultValue: false },
151
- imageUrl: {
152
- type: DataTypes.TEXT,
153
- get() {
154
- return this.getDataValue("showImage")
155
- ? this.getDataValue("imageUrl")
156
- : undefined;
157
- },
158
- },
74
+ imageUrl: { type: DataTypes.TEXT },
159
75
  showImage: { type: DataTypes.BOOLEAN, defaultValue: false },
160
- address: {
161
- type: DataTypes.STRING,
162
- get() {
163
- return this.getDataValue("showAddress")
164
- ? this.getDataValue("address")
165
- : undefined;
166
- },
167
- },
76
+ address: { type: DataTypes.STRING },
168
77
  showAddress: { type: DataTypes.BOOLEAN, defaultValue: false },
169
78
  cityId: {
170
79
  type: DataTypes.STRING,
171
- get() {
172
- return this.getDataValue("showCity") ? this.getDataValue("cityId") : undefined;
80
+ set(cityId) {
81
+ this.setDataValue("cityId", cityId?.id || cityId);
173
82
  },
174
83
  },
175
84
  showCity: { type: DataTypes.BOOLEAN, defaultValue: false },
@@ -200,6 +109,7 @@ module.exports = (sequelize, DataTypes) => {
200
109
  directoryVisibility: { type: DataTypes.BOOLEAN, defaultValue: false },
201
110
  userLoginAccess: { type: DataTypes.BOOLEAN, defaultValue: false },
202
111
  isEmailSubscribed: { type: DataTypes.BOOLEAN, defaultValue: false },
112
+ isPublic: { type: DataTypes.BOOLEAN, defaultValue: true },
203
113
  status: { type: DataTypes.BOOLEAN, defaultValue: true },
204
114
  createdAt: { type: DataTypes.DATE },
205
115
  updatedAt: { type: DataTypes.DATE },
@@ -275,6 +185,7 @@ module.exports = (sequelize, DataTypes) => {
275
185
  "directoryVisibility",
276
186
  "userLoginAccess",
277
187
  "isEmailSubscribed",
188
+ "isPublic",
278
189
  "status",
279
190
  "createdAt",
280
191
  "updatedAt",
@@ -328,6 +239,7 @@ module.exports = (sequelize, DataTypes) => {
328
239
  "userLoginAccess",
329
240
  "isEmailSubscribed",
330
241
  "membershipTypeId",
242
+ "isPublic",
331
243
  "status",
332
244
  ];
333
245
  user.listFields = [
@@ -342,6 +254,7 @@ module.exports = (sequelize, DataTypes) => {
342
254
  "address",
343
255
  "isUserAuthenticated",
344
256
  "membershipTypeId",
257
+ "isPublic",
345
258
  "status",
346
259
  ];
347
260
  user.transferFields = [
@@ -353,5 +266,27 @@ module.exports = (sequelize, DataTypes) => {
353
266
  "email",
354
267
  "phone",
355
268
  ];
269
+ user.showFields = [
270
+ ["showEmail", ["email"]],
271
+ ["showPhone", ["phone"]],
272
+ ["showFirstName", ["firstName"]],
273
+ ["showLastName", ["lastName"]],
274
+ ["showGender", ["gender"]],
275
+ ["showDob", ["dob"]],
276
+ ["showEducation", ["education"]],
277
+ ["showRelationship", ["relationshipId", "relationship"]],
278
+ ["showMaritalStatus", ["maritalStatusId", "maritalStatus"]],
279
+ ["showDateJoined", ["dateJoined"]],
280
+ ["showEmergencyContact", ["emergencyContact"]],
281
+ ["showEmergencyContactName", ["emergencyContactName"]],
282
+ [
283
+ "showEmergencyContactRelationship",
284
+ ["emergencyContactRelationshipId", "emergencyContactRelationship"]
285
+ ],
286
+ ["showImage", ["imageUrl"]],
287
+ ["showAddress", ["address"]],
288
+ ["showCity", ["cityId", "city"]],
289
+ ["showPostal", ["postalCode"]],
290
+ ]
356
291
  return user;
357
292
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@churchsoln/dbms",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "prestart": "node db-setup.js",