@churchsoln/dbms 1.0.14 → 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.
@@ -75,7 +75,12 @@ module.exports = (sequelize, DataTypes) => {
75
75
  showImage: { type: DataTypes.BOOLEAN, defaultValue: false },
76
76
  address: { type: DataTypes.STRING },
77
77
  showAddress: { type: DataTypes.BOOLEAN, defaultValue: false },
78
- cityId: { type: DataTypes.STRING },
78
+ cityId: {
79
+ type: DataTypes.STRING,
80
+ set(cityId) {
81
+ this.setDataValue("cityId", cityId?.id || cityId);
82
+ },
83
+ },
79
84
  showCity: { type: DataTypes.BOOLEAN, defaultValue: false },
80
85
  provinceId: {
81
86
  type: DataTypes.INTEGER,
@@ -83,7 +88,14 @@ module.exports = (sequelize, DataTypes) => {
83
88
  this.setDataValue("provinceId", provinceId?.id || provinceId);
84
89
  },
85
90
  },
86
- postalCode: { type: DataTypes.STRING },
91
+ postalCode: {
92
+ type: DataTypes.STRING,
93
+ get() {
94
+ return this.getDataValue("showPostal")
95
+ ? this.getDataValue("postalCode")
96
+ : undefined;
97
+ },
98
+ },
87
99
  showPostal: { type: DataTypes.BOOLEAN, defaultValue: false },
88
100
  otp: { type: DataTypes.INTEGER },
89
101
  membershipTypeId: {
@@ -227,25 +239,6 @@ module.exports = (sequelize, DataTypes) => {
227
239
  "membershipTypeId",
228
240
  "status",
229
241
  ];
230
- user.showFields = [
231
- ["showEmail", "email"],
232
- ["showPhone", "phone"],
233
- ["showFirstName", "firstName"],
234
- ["showLastName", "lastName"],
235
- ["showGender", "gender"],
236
- ["showDob", "dob"],
237
- ["showEducation", "education"],
238
- ["showRelationship", "relationshipId"],
239
- ["showMaritalStatus", "maritalStatusId"],
240
- ["showDateJoined", "dateJoined"],
241
- ["showEmergencyContact", "emergencyContact"],
242
- ["showEmergencyContactName", "emergencyContactName"],
243
- ["showEmergencyContactRelationship", "emergencyContactRelationshipId"],
244
- ["showImage", "imageUrl"],
245
- ["showAddress", "address"],
246
- ["showCity", "cityId"],
247
- ["showPostal", "postalCode"],
248
- ]
249
242
  user.listFields = [
250
243
  "id",
251
244
  "username",
@@ -269,5 +262,27 @@ module.exports = (sequelize, DataTypes) => {
269
262
  "email",
270
263
  "phone",
271
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
+ ]
272
287
  return user;
273
288
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@churchsoln/dbms",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "prestart": "node db-setup.js",