@churchsoln/dbms 1.0.15 → 1.0.16

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.
Files changed (2) hide show
  1. package/models/church/user.js +36 -105
  2. package/package.json +1 -1
@@ -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 },
@@ -353,5 +262,27 @@ module.exports = (sequelize, DataTypes) => {
353
262
  "email",
354
263
  "phone",
355
264
  ];
265
+ user.showFields = [
266
+ ["showEmail", ["email"]],
267
+ ["showPhone", ["phone"]],
268
+ ["showFirstName", ["firstName"]],
269
+ ["showLastName", ["lastName"]],
270
+ ["showGender", ["gender"]],
271
+ ["showDob", ["dob"]],
272
+ ["showEducation", ["education"]],
273
+ ["showRelationship", ["relationshipId", "relationship"]],
274
+ ["showMaritalStatus", ["maritalStatusId", "maritalStatus"]],
275
+ ["showDateJoined", ["dateJoined"]],
276
+ ["showEmergencyContact", ["emergencyContact"]],
277
+ ["showEmergencyContactName", ["emergencyContactName"]],
278
+ [
279
+ "showEmergencyContactRelationship",
280
+ ["emergencyContactRelationshipId", "emergencyContactRelationship"]
281
+ ],
282
+ ["showImage", ["imageUrl"]],
283
+ ["showAddress", ["address"]],
284
+ ["showCity", ["cityId", "city"]],
285
+ ["showPostal", ["postalCode"]],
286
+ ]
356
287
  return user;
357
288
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@churchsoln/dbms",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "prestart": "node db-setup.js",