@churchsoln/dbms 1.0.29 → 1.0.31

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.
@@ -67,6 +67,11 @@ const RELATIONSHIP = {
67
67
  OTHER: "Other",
68
68
  };
69
69
 
70
+ const CODE_LENGTH = {
71
+ OTP: 4,
72
+ ENV_NUMBER: 5,
73
+ };
74
+
70
75
  module.exports = {
71
76
  ROLES,
72
77
  TRANSFER_STATUS,
@@ -78,4 +83,5 @@ module.exports = {
78
83
  MEMBER_STATUS,
79
84
  GENDER,
80
85
  RELATIONSHIP,
86
+ CODE_LENGTH
81
87
  };
@@ -38,6 +38,7 @@ module.exports = {
38
38
  },
39
39
  onDelete: "SET NULL",
40
40
  },
41
+ enableLoginAccess: { type: DataTypes.BOOLEAN, defaultValue: true },
41
42
  status: { type: DataTypes.BOOLEAN, defaultValue: true },
42
43
 
43
44
  // Metadata
@@ -40,6 +40,7 @@ module.exports = (sequelize, DataTypes) => {
40
40
  // Roles & Permissions
41
41
  roleId: { type: DataTypes.INTEGER },
42
42
  subRoleId: { type: DataTypes.INTEGER },
43
+ enableLoginAccess: { type: DataTypes.BOOLEAN, defaultValue: true },
43
44
  status: { type: DataTypes.BOOLEAN, defaultValue: true },
44
45
 
45
46
  // Metadata
@@ -57,10 +58,10 @@ module.exports = (sequelize, DataTypes) => {
57
58
  "id",
58
59
  "memberId",
59
60
  "username",
60
- "password",
61
61
  "email",
62
62
  "roleId",
63
63
  "subRoleId",
64
+ "enableLoginAccess",
64
65
  "status",
65
66
  "lastLogin",
66
67
  "createdAt",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@churchsoln/dbms",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "prestart": "node db-setup.js",
@@ -56,7 +56,9 @@
56
56
  "churchAdminDetails": {
57
57
  "username": "churchadmin",
58
58
  "email": "churchadmin@xavier.com",
59
- "password": "Church@123"
59
+ "password": "Church@123",
60
+ "firstName": "Jose",
61
+ "lastName": "Mathew"
60
62
  }
61
63
  }
62
64
  }
@@ -385,7 +387,9 @@
385
387
  "churchAdminDetails": {
386
388
  "username": "churchadmin",
387
389
  "email": "churchadmin@xavier.com",
388
- "password": "Church@123"
390
+ "password": "Church@123",
391
+ "firstName": "Jose",
392
+ "lastName": "Mathew"
389
393
  }
390
394
  }
391
395
  },
@@ -437,7 +441,7 @@
437
441
  },
438
442
  "ChurchAdminDataRequest": {
439
443
  "title": "ChurchAdminDataRequest",
440
- "required": ["username", "email", "password"],
444
+ "required": ["username", "email", "password", "firstName", "lastName"],
441
445
  "type": "object",
442
446
  "properties": {
443
447
  "username": {
@@ -448,12 +452,20 @@
448
452
  },
449
453
  "password": {
450
454
  "type": "string"
455
+ },
456
+ "firstName": {
457
+ "type": "string"
458
+ },
459
+ "lastName": {
460
+ "type": "string"
451
461
  }
452
462
  },
453
463
  "example": {
454
464
  "username": "churchadmin",
455
465
  "email": "churchadmin@xavier.com",
456
- "password": "Church@123"
466
+ "password": "Church@123",
467
+ "firstName": "Jose",
468
+ "lastName": "Mathew"
457
469
  }
458
470
  },
459
471
  "SuperAdminLoginDataRequest": {
@@ -4,10 +4,11 @@ const errorCodes = require("../config/errorCodes");
4
4
  const errorMsgs = require("../config/errorMsgs");
5
5
  const { masterQueue, masterQueueEvents } = require("../queues");
6
6
  const churchManager = require("../utils/churchManager");
7
- const { QUEUES, ROLES, AUTH_DATA, SUBSCRIPTION_PLAN_ID } = require("../constants");
7
+ const { QUEUES, ROLES, AUTH_DATA, SUBSCRIPTION_PLAN_ID, CODE_LENGTH } = require("../constants");
8
8
  const bcrypt = require("bcrypt");
9
9
  const cryptr = require("../utils/crypto");
10
10
  const jwt = require("jsonwebtoken");
11
+ const utils = require("../utils");
11
12
 
12
13
  class ChurchService {
13
14
  async onboardChurch(params) {
@@ -89,11 +90,16 @@ class ChurchService {
89
90
  masterQueueEvents.on("completed", async (event) => {
90
91
  if (event.jobId === jobData.id) {
91
92
  const churchDb = await churchManager.getChurchDbConnectionById(churchData.id);
93
+ const member = await churchDb.member.create({
94
+ ...churchAdminDetails,
95
+ envNumber: utils.generateCode(CODE_LENGTH.ENV_NUMBER)
96
+ })
92
97
  await churchDb.user.create({
93
98
  ...churchAdminDetails,
94
99
  status: true,
95
100
  roleId: ROLES.CHURCH_ADMIN,
96
101
  churchId: churchData.id,
102
+ memberId: member.id
97
103
  });
98
104
  await churchDb.church.create(params)
99
105
  console.log(`Church onboarding completed for church: ${name}`);
@@ -22,6 +22,8 @@ const schemas = {
22
22
  username: BaseJoi.string().required(),
23
23
  email: BaseJoi.string().required(),
24
24
  password: BaseJoi.string().required(),
25
+ firstName: BaseJoi.string().required(),
26
+ lastName: BaseJoi.string().required()
25
27
  }).required(),
26
28
  }),
27
29
  updateChurch: BaseJoi.object({