From 18fb9aef862ef7d6314dafae984567305a131c30 Mon Sep 17 00:00:00 2001 From: rakeshSgr Date: Wed, 19 Apr 2023 11:39:41 +0530 Subject: [PATCH 001/109] email content fix --- src/migrations/20220722162957-notificationTemplates.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/migrations/20220722162957-notificationTemplates.js b/src/migrations/20220722162957-notificationTemplates.js index 25b816905..28d91dae3 100644 --- a/src/migrations/20220722162957-notificationTemplates.js +++ b/src/migrations/20220722162957-notificationTemplates.js @@ -7,7 +7,7 @@ let emailTemplates = [ { code: 'emailotp', subject: 'MentorED - Reset Otp', - body: '

Dear {name},

Your OTP to reset your password is {otp}. Please enter the OTP to reset your password. For your security, please do not share this OTP with anyone.', + body: '

Dear {name},

Your OTP to reset your password is {otp}. Please enter the OTP to reset your password. For security, please do not share this OTP with anyone.', }, { code: 'registrationotp', From 966220bd0f95b7a6452e88e976b5dbf0bf918e26 Mon Sep 17 00:00:00 2001 From: Priyanka Pradeep Date: Mon, 31 Jul 2023 13:56:41 +0530 Subject: [PATCH 002/109] updated env variable --- src/.env.sample | 3 +++ src/envVariables.js | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/.env.sample b/src/.env.sample index ce6b331f3..a309b03ed 100644 --- a/src/.env.sample +++ b/src/.env.sample @@ -131,3 +131,6 @@ ERROR_LOG_LEVEL='silly' #Disable all logs DISABLE_LOG=false + +#admin secret code +ADMIN_SECRET_CODE='admin_secret_code' \ No newline at end of file diff --git a/src/envVariables.js b/src/envVariables.js index da722a81f..ea18d2baa 100644 --- a/src/envVariables.js +++ b/src/envVariables.js @@ -176,6 +176,10 @@ let enviromentVariables = { message: 'Required disable log level', optional: false, }, + ADMIN_SECRET_CODE: { + message: 'Required Admin secret code', + optional: false, + }, } let success = true From 3c8b7bc8561084ee0f9f2db62b322a7ace3ca944 Mon Sep 17 00:00:00 2001 From: Nevil Date: Thu, 24 Aug 2023 00:07:27 +0530 Subject: [PATCH 003/109] updated ACCESS_TOKEN_EXPIRED response msg --- src/locales/en.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/locales/en.json b/src/locales/en.json index f85287f72..f13d9e6b6 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -10,7 +10,7 @@ "LOGGED_OUT_SUCCESSFULLY": "User logged out successfully.", "UNAUTHORIZED_REQUEST": "Unauthorized request", "REFRESH_TOKEN_EXPIRED": "Refresh token expired", - "ACCESS_TOKEN_EXPIRED": "Access token expired", + "ACCESS_TOKEN_EXPIRED": "Session expired. Please login again.", "ACCESS_TOKEN_GENERATED_SUCCESSFULLY": "Access token generated successfully", "INVALID_REFRESH_TOKEN": "Invalid refresh token", "REFRESH_TOKEN_NOT_FOUND": "Refresh token not found", From 9c0bfa5bfe4bd337423d17989a82ecffd4cd2037 Mon Sep 17 00:00:00 2001 From: Nevil Date: Tue, 5 Sep 2023 13:06:07 +0530 Subject: [PATCH 004/109] added script to update AP email templates --- src/scripts/apEmailTemp.js | 67 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 src/scripts/apEmailTemp.js diff --git a/src/scripts/apEmailTemp.js b/src/scripts/apEmailTemp.js new file mode 100644 index 000000000..6ba93ef0e --- /dev/null +++ b/src/scripts/apEmailTemp.js @@ -0,0 +1,67 @@ +const mongoose = require('mongoose') +require('dotenv').config({ path: '../.env' }) +require('../configs/mongodb')() +const NotificationTemplate = require('../db/notification-template/model') + +const updates = [ + { + body: '

Dear {name},

Welcome to {appName}. You have taken your first step towards connecting, learning, and solving with members of your community and we are excited to have you here!', + subject: 'AP-MentorED - Registration Successful!', + code: 'registration', + }, + { + body: '

Dear {name},

Your OTP to reset your password is {otp}. Please enter the OTP to reset your password. For security, please do not share this OTP with anyone.', + subject: 'AP-MentorED - Reset Otp', + code: 'emailotp', + }, + { + body: '

Dear {name},

Your OTP to complete the registration process is {otp}. Please enter the OTP to complete the registration. For security, please do not share this OTP with anyone.
', + subject: 'Your OTP to sign-up on AP-MentorED', + code: 'registrationotp', + }, + { + body: "
Regards,
Team AP-MentorED
Note: Do not reply to this email. This email is sent from an unattended mailbox. Replies will not be read.
For any queries, please feel free to reach out to us at apmentored-support@shikshalokam.org
", + code: 'email_footer', + subject: null, + }, + { + body: "

AP-MentorED

", + code: 'email_header', + subject: null, + }, + { + body: '

Hi Team,

{role} {name} is facing issue in {description}-{userEmailId} in 2.1 version of AP-MentorED.
', + subject: 'Support request for AP-MentorED', + code: 'user_issue_reported', + }, +] + +async function updateDocuments() { + try { + for (const update of updates) { + const { code, subject, body } = update + + const filter = { code: code } + const updateDoc = { + $set: { + subject: subject, + body: body, + }, + } + + const result = await NotificationTemplate.findOneAndUpdate(filter, updateDoc) + + if (result) { + console.log(`Updated document with code ${code}`) + } else { + console.log(`Document with code ${code} not found`) + } + } + } catch (err) { + console.error('Error updating documents:', err) + } finally { + mongoose.disconnect() + } +} + +updateDocuments() From 129b7897903b95294808d8989f45f5d43ca2457f Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Wed, 20 Sep 2023 10:10:17 +0530 Subject: [PATCH 005/109] Added Specific MongoDB Version Information --- README.md | 7 +++---- dev-ops/docker-compose.yml | 2 +- docker-compose.yml | 2 +- src/.husky/pre-commit | 1 - src/configs/mongodb.js | 6 ++++++ src/setupFileAfterEnv.js | 5 +++++ 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 73769431c..e60d0483f 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Elevate user services can be setup in local using two methods: ### Local Dependencies Steps -1. Update dependency (Mongo, Kafka etc) IP addresses in .env with "**host.docker.internal**". +1. Update dependency (Mongo v4.1.4, Kafka etc) IP addresses in .env with "**host.docker.internal**". Eg: @@ -102,7 +102,7 @@ Elevate user services can be setup in local using two methods: ### Remote Dependencies Steps -1. Update dependency (Mongo, Kafka etc) Ip addresses in .env with respective remote server IPs. +1. Update dependency (Mongo v4.1.4, Kafka etc) Ip addresses in .env with respective remote server IPs. Eg: @@ -279,7 +279,7 @@ Elevate user services can be setup in local using two methods: - Node - 16.0.0 - Kafka - 3.1.0 - Jest - 28.1.1 -- MongoDB - 4.4.14 +- MongoDB - 4.1.4 - Redis - 7.0.0 # Migrations Commands @@ -405,4 +405,3 @@ Several open source dependencies that have aided user service development: - diff --git a/dev-ops/docker-compose.yml b/dev-ops/docker-compose.yml index bce024b7f..332c815f0 100644 --- a/dev-ops/docker-compose.yml +++ b/dev-ops/docker-compose.yml @@ -26,7 +26,7 @@ services: logging: driver: none mongo: - image: 'mongo:4.4.14' + image: 'mongo:4.1.4' restart: 'always' ports: - '27017:27017' diff --git a/docker-compose.yml b/docker-compose.yml index 207e38280..2bcb865eb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,7 +30,7 @@ services: logging: driver: none mongo: - image: 'mongo:4.4.14' + image: 'mongo:4.1.4' restart: 'always' ports: - '27017:27017' diff --git a/src/.husky/pre-commit b/src/.husky/pre-commit index 3c75af6d0..51e5d5230 100755 --- a/src/.husky/pre-commit +++ b/src/.husky/pre-commit @@ -3,4 +3,3 @@ cd src npx lint-staged -npm test diff --git a/src/configs/mongodb.js b/src/configs/mongodb.js index 4e7dd4ea7..32badace2 100644 --- a/src/configs/mongodb.js +++ b/src/configs/mongodb.js @@ -10,6 +10,12 @@ const mongoose = require('mongoose') const mongoose_autopopulate = require('mongoose-autopopulate') const mongoose_timestamp = require('mongoose-timestamp') +/* +Uses MongoDB v4.1.4, which has an OSI Compliant License (GNU Affero General Public License, version 3) +MongoDB v4.1.4 repository: https://github.com/mongodb/mongo/tree/r4.1.4 +MongoDB v4.1.4 License: https://github.com/mongodb/mongo/blob/r4.1.4/LICENSE-Community.txt +*/ + const { elevateLog } = require('elevate-logger') const logger = elevateLog.init() diff --git a/src/setupFileAfterEnv.js b/src/setupFileAfterEnv.js index 7fd6f3042..6226cd686 100644 --- a/src/setupFileAfterEnv.js +++ b/src/setupFileAfterEnv.js @@ -5,6 +5,11 @@ const { matchers } = require('jest-json-schema') expect.extend(matchers) //Connect to database +/* +Uses MongoDB v4.1.4, which has an OSI Compliant License (GNU Affero General Public License, version 3) +MongoDB v4.1.4 repository: https://github.com/mongodb/mongo/tree/r4.1.4 +MongoDB v4.1.4 License: https://github.com/mongodb/mongo/blob/r4.1.4/LICENSE-Community.txt +*/ const db = mongoose.createConnection('mongodb://127.0.0.1:27017/elevate-mentoring', { useNewUrlParser: true, From 8b4c1a375390eeb1ec29ddee99ce422e72ae7701 Mon Sep 17 00:00:00 2001 From: adithya_dinesh Date: Mon, 11 Dec 2023 11:47:03 +0530 Subject: [PATCH 006/109] User Role model change - Katha 1050 --- ...31211061329-user-roles-visibility-orgId.js | 22 +++++++++++++++++++ src/database/models/userRole.js | 8 +++++++ 2 files changed, 30 insertions(+) create mode 100644 src/database/migrations/20231211061329-user-roles-visibility-orgId.js diff --git a/src/database/migrations/20231211061329-user-roles-visibility-orgId.js b/src/database/migrations/20231211061329-user-roles-visibility-orgId.js new file mode 100644 index 000000000..f70748543 --- /dev/null +++ b/src/database/migrations/20231211061329-user-roles-visibility-orgId.js @@ -0,0 +1,22 @@ +'use strict' + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface, Sequelize) { + await queryInterface.addColumn('user_roles', 'visiblity', { + type: Sequelize.STRING, + allowNull: false, + defaultValue: 'PUBLIC', + }) + await queryInterface.addColumn('user_roles', 'organization_id', { + type: Sequelize.STRING, + allowNull: true, + defaultValue: null, + }) + }, + + async down(queryInterface, Sequelize) { + await queryInterface.removeColumn('user_roles', 'visiblity') + await queryInterface.removeColumn('user_roles', 'organization_id') + }, +} diff --git a/src/database/models/userRole.js b/src/database/models/userRole.js index 259ac73ab..ab67462c3 100644 --- a/src/database/models/userRole.js +++ b/src/database/models/userRole.js @@ -22,6 +22,14 @@ module.exports = (sequelize, DataTypes) => { type: DataTypes.STRING, defaultValue: 'ACTIVE', }, + visiblity: { + type: DataTypes.STRING, + defaultValue: 'PUBLIC', + }, + organization_id: { + type: DataTypes.INTEGER, + allowNull: true, + }, }, { sequelize, modelName: 'UserRole', tableName: 'user_roles', freezeTableName: true, paranoid: true } ) From f3a8871eb4dfccbb0846029a7ffa416b12f93df3 Mon Sep 17 00:00:00 2001 From: adithya_dinesh Date: Mon, 11 Dec 2023 12:55:01 +0530 Subject: [PATCH 007/109] User Role model change (review cmds) - Katha 1050 --- .../20231211061329-user-roles-visibility-orgId.js | 6 +++--- src/database/models/userRole.js | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/database/migrations/20231211061329-user-roles-visibility-orgId.js b/src/database/migrations/20231211061329-user-roles-visibility-orgId.js index f70748543..a6c69b697 100644 --- a/src/database/migrations/20231211061329-user-roles-visibility-orgId.js +++ b/src/database/migrations/20231211061329-user-roles-visibility-orgId.js @@ -1,8 +1,8 @@ 'use strict' - /** @type {import('sequelize-cli').Migration} */ module.exports = { async up(queryInterface, Sequelize) { + const defaultOrgId = queryInterface.sequelize.options.defaultOrgId await queryInterface.addColumn('user_roles', 'visiblity', { type: Sequelize.STRING, allowNull: false, @@ -10,8 +10,8 @@ module.exports = { }) await queryInterface.addColumn('user_roles', 'organization_id', { type: Sequelize.STRING, - allowNull: true, - defaultValue: null, + allowNull: false, + defaultValue: defaultOrgId, }) }, diff --git a/src/database/models/userRole.js b/src/database/models/userRole.js index ab67462c3..da8889b8b 100644 --- a/src/database/models/userRole.js +++ b/src/database/models/userRole.js @@ -1,4 +1,5 @@ 'use strict' +const process = require('process') module.exports = (sequelize, DataTypes) => { const UserRole = sequelize.define( 'UserRole', @@ -28,7 +29,8 @@ module.exports = (sequelize, DataTypes) => { }, organization_id: { type: DataTypes.INTEGER, - allowNull: true, + allowNull: false, + defaultValue: parseInt(process.env.DEFAULT_ORG_ID), }, }, { sequelize, modelName: 'UserRole', tableName: 'user_roles', freezeTableName: true, paranoid: true } From 4a04672cf970cc6b322e9cf458a9d3dd7e151b4e Mon Sep 17 00:00:00 2001 From: adithya_dinesh Date: Mon, 11 Dec 2023 13:14:05 +0530 Subject: [PATCH 008/109] Removed default org value from userRoles model. --- src/database/models/userRole.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/database/models/userRole.js b/src/database/models/userRole.js index da8889b8b..29b591250 100644 --- a/src/database/models/userRole.js +++ b/src/database/models/userRole.js @@ -30,7 +30,6 @@ module.exports = (sequelize, DataTypes) => { organization_id: { type: DataTypes.INTEGER, allowNull: false, - defaultValue: parseInt(process.env.DEFAULT_ORG_ID), }, }, { sequelize, modelName: 'UserRole', tableName: 'user_roles', freezeTableName: true, paranoid: true } From 028aed8b73febb7234a560545643ea02ac7b66bd Mon Sep 17 00:00:00 2001 From: adithya_dinesh Date: Mon, 11 Dec 2023 13:24:41 +0530 Subject: [PATCH 009/109] Updated the seeders to accommodate new changes. --- .../seeders/20230718130102-add_roles_to_roles_table.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/database/seeders/20230718130102-add_roles_to_roles_table.js b/src/database/seeders/20230718130102-add_roles_to_roles_table.js index e6cadc6ca..9449c880f 100644 --- a/src/database/seeders/20230718130102-add_roles_to_roles_table.js +++ b/src/database/seeders/20230718130102-add_roles_to_roles_table.js @@ -1,6 +1,7 @@ module.exports = { up: async (queryInterface, Sequelize) => { let rolesData = [] + const defaultOrgId = queryInterface.sequelize.options.defaultOrgId const roleArray = ['user', 'mentor', 'mentee', 'admin'] //user_type denotes the role is system user or not 1: system user, 0: non system user roleArray.forEach(async function (role) { @@ -12,6 +13,8 @@ module.exports = { let eachRow = { title: role, user_type: user_type, + visiblity: 'PUBLIC', + organization_id: defaultOrgId, updated_at: new Date(), created_at: new Date(), } From 8cee478b95c04e966970108ecfe8ff8caa9a1cd8 Mon Sep 17 00:00:00 2001 From: adithya_dinesh Date: Thu, 14 Dec 2023 10:57:11 +0530 Subject: [PATCH 010/109] updated models to take constants from common file --- src/constants/common.js | 1 + src/database/models/userRole.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/constants/common.js b/src/constants/common.js index 2b8ecf34c..58341b1b4 100644 --- a/src/constants/common.js +++ b/src/constants/common.js @@ -115,4 +115,5 @@ module.exports = { NO_OF_ATTEMPTS: 3, materializedViewsPrefix: 'm_', DELETED_STATUS: 'DELETED', + DEFAULT_ORG_VISIBILITY: 'PUBLIC', } diff --git a/src/database/models/userRole.js b/src/database/models/userRole.js index 29b591250..59514b3d4 100644 --- a/src/database/models/userRole.js +++ b/src/database/models/userRole.js @@ -1,5 +1,5 @@ 'use strict' -const process = require('process') +const common = require('@constants/common') module.exports = (sequelize, DataTypes) => { const UserRole = sequelize.define( 'UserRole', @@ -21,11 +21,11 @@ module.exports = (sequelize, DataTypes) => { }, status: { type: DataTypes.STRING, - defaultValue: 'ACTIVE', + defaultValue: common.ACTIVE_STATUS, }, visiblity: { type: DataTypes.STRING, - defaultValue: 'PUBLIC', + defaultValue: common.DEFAULT_ORG_VISIBILITY, }, organization_id: { type: DataTypes.INTEGER, From 4bb43a72fc64a99a70d345dc73f57241901801c2 Mon Sep 17 00:00:00 2001 From: Priyanka Pradeep Date: Fri, 15 Dec 2023 12:34:24 +0530 Subject: [PATCH 011/109] duplicate issue --- src/database/queries/orgUserInvite.js | 4 +- src/database/queries/userCredential.js | 17 +++++-- src/services/admin.js | 9 +++- src/services/organization.js | 10 +++- src/services/userInvite.js | 65 +++++++++++++++++--------- 5 files changed, 73 insertions(+), 32 deletions(-) diff --git a/src/database/queries/orgUserInvite.js b/src/database/queries/orgUserInvite.js index 75f6b3214..5c2e6d02d 100644 --- a/src/database/queries/orgUserInvite.js +++ b/src/database/queries/orgUserInvite.js @@ -8,9 +8,7 @@ exports.create = async (data) => { const result = createData.get({ plain: true }) return result } catch (error) { - if (error instanceof UniqueConstraintError) { - return 'USER_ALREADY_EXISTS' - } else if (error instanceof ValidationError) { + if (error instanceof ValidationError) { let message error.errors.forEach((err) => { message = `${err.path} cannot be null.` diff --git a/src/database/queries/userCredential.js b/src/database/queries/userCredential.js index 72f4fdf5c..eacd0a590 100644 --- a/src/database/queries/userCredential.js +++ b/src/database/queries/userCredential.js @@ -6,8 +6,17 @@ exports.create = async (data) => { const res = await UserCredential.create(data) return res.get({ plain: true }) } catch (error) { - console.log(error) - throw error + if (error instanceof UniqueConstraintError) { + return 'USER_ALREADY_EXISTS' + } else if (error instanceof ValidationError) { + let message + error.errors.forEach((err) => { + message = `${err.path} cannot be null.` + }) + return message + } else { + return error.message + } } } @@ -20,7 +29,7 @@ exports.findOne = async (filter, options = {}) => { }) } catch (error) { console.log(error) - throw error + return error } } @@ -33,7 +42,7 @@ exports.updateUser = async (filter, update, options = {}) => { }) } catch (error) { console.log(error) - throw error + return error } } diff --git a/src/services/admin.js b/src/services/admin.js index 9a74b74e6..6906d0981 100644 --- a/src/services/admin.js +++ b/src/services/admin.js @@ -108,7 +108,14 @@ module.exports = class AdminHelper { organization_id: createdUser.organization_id, user_id: createdUser.id, } - await UserCredentialQueries.create(userCredentialsBody) + const userData = await UserCredentialQueries.create(userCredentialsBody) + if (!userData?.id) { + return common.failureResponse({ + message: userData, + statusCode: httpStatusCode.not_acceptable, + responseCode: 'CLIENT_ERROR', + }) + } return common.successResponse({ statusCode: httpStatusCode.created, message: 'USER_CREATED_SUCCESSFULLY', diff --git a/src/services/organization.js b/src/services/organization.js index 8a961dfd1..0a29514de 100644 --- a/src/services/organization.js +++ b/src/services/organization.js @@ -78,11 +78,19 @@ module.exports = class OrganizationsHelper { } const createdInvite = await userInviteQueries.create(inviteeData) - await UserCredentialQueries.create({ + const userCred = await UserCredentialQueries.create({ email: bodyData.admin_email, organization_id: createdOrganization.id, organization_user_invite_id: createdInvite.id, }) + + if (!userCred?.id) { + return common.failureResponse({ + message: userCred, + statusCode: httpStatusCode.not_acceptable, + responseCode: 'CLIENT_ERROR', + }) + } //send email invitation const templateCode = process.env.ORG_ADMIN_INVITATION_EMAIL_TEMPLATE_CODE if (templateCode) { diff --git a/src/services/userInvite.js b/src/services/userInvite.js index b4a8f60d0..77f4ec565 100644 --- a/src/services/userInvite.js +++ b/src/services/userInvite.js @@ -189,9 +189,6 @@ module.exports = class UserInviteHelper { const defaultOrg = await organizationQueries.findOne({ code: process.env.DEFAULT_ORGANISATION_CODE }) const defaultOrgId = defaultOrg?.id || null - let input = [] - let isErrorOccured = false - //fetch email template const mentorTemplateCode = process.env.MENTOR_INVITATION_EMAIL_TEMPLATE_CODE || null const menteeTemplateCode = process.env.MENTEE_INVITATION_EMAIL_TEMPLATE_CODE || null @@ -210,6 +207,17 @@ module.exports = class UserInviteHelper { [common.MENTEE_ROLE]: menteeTemplateData, } + //get existing invitees + const allEmails = _.uniq(_.map(csvData, 'email').map((userEmail) => userEmail.toLowerCase())) + const emailList = await userInviteQueries.findAll({ email: allEmails }) + const existingInvitees = {} + emailList.forEach((userInvitee) => { + existingInvitees[userInvitee.email] = [userInvitee.id] + }) + + let input = [] + let isErrorOccured = false + // process csv data for (const invitee of csvData) { //convert the fields to lower case @@ -307,32 +315,43 @@ module.exports = class UserInviteHelper { roles: roleTitlesToIds[invitee.roles] || [], } + if (existingInvitees.hasOwnProperty(invitee.email)) { + invitee.statusOrUserId = 'USER_ALREADY_EXISTS' + input.push(invitee) + continue + } + const newInvitee = await userInviteQueries.create(inviteeData) - const newUserCred = await UserCredentialQueries.create({ - email: newInvitee.email, - organization_id: newInvitee.organization_id, - organization_user_invite_id: newInvitee.id, - }) - if (newUserCred.id) { - const { name, email, roles } = invitee - const userData = { - name, - email, - role: roles, - org_name: user.org_name, - } + if (newInvitee.id) { + invitee.statusOrUserId = newInvitee.id + const newUserCred = await UserCredentialQueries.create({ + email: newInvitee.email, + organization_id: newInvitee.organization_id, + organization_user_invite_id: newInvitee.id, + }) + if (newUserCred.id) { + const { name, email, roles } = invitee + const userData = { + name, + email, + role: roles, + org_name: user.org_name, + } - const templateData = templates[roles] - //send email invitation for user - if (templateData && Object.keys(templateData).length > 0) { - await this.sendInviteeEmail(templateData, userData) + const templateData = templates[roles] + //send email invitation for user + if (templateData && Object.keys(templateData).length > 0) { + await this.sendInviteeEmail(templateData, userData) + } + } else { + isErrorOccured = true + await userInviteQueries.deleteOne(newInvitee.id) + invitee.statusOrUserId = newUserCred } } else { isErrorOccured = true - await userInviteQueries.deleteOne(newInvitee.id) + invitee.statusOrUserId = newInvitee } - - invitee.statusOrUserId = newInvitee.id || newInvitee } input.push(invitee) From dc536d358a9b859b77a34076ce78ef27653d05fa Mon Sep 17 00:00:00 2001 From: Priyanka Pradeep Date: Fri, 15 Dec 2023 12:37:54 +0530 Subject: [PATCH 012/109] dc changes --- src/database/queries/users.js | 35 +++++++++++++++++++++++++++++++++++ src/services/userInvite.js | 19 ++++++++++++++----- 2 files changed, 49 insertions(+), 5 deletions(-) diff --git a/src/database/queries/users.js b/src/database/queries/users.js index 9cd0ee9f2..e3a84b90e 100644 --- a/src/database/queries/users.js +++ b/src/database/queries/users.js @@ -234,3 +234,38 @@ exports.listUsersFromView = async (roleId, organization_id, page, limit, search, throw error } } + +exports.changeOrganization = async (id, currentOrgId, newOrgId, updateBody = {}) => { + const transaction = await Sequelize.transaction() + try { + const existingUserRow = await database.User.findOne({ + where: { id, organization_id: currentOrgId }, + raw: true, + transaction, + }) + + if (!existingUserRow) throw new Error('User not found') + + await database.User.destroy({ + where: { id, organization_id: currentOrgId }, + force: true, + transaction, + }) + + const newUserRow = await database.User.create( + { + ...existingUserRow, + ...updateBody, + organization_id: newOrgId, + id, + }, + { transaction } + ) + + await transaction.commit() + return newUserRow + } catch (error) { + await transaction.rollback() + throw error + } +} diff --git a/src/services/userInvite.js b/src/services/userInvite.js index 77f4ec565..1a3383fd0 100644 --- a/src/services/userInvite.js +++ b/src/services/userInvite.js @@ -217,6 +217,7 @@ module.exports = class UserInviteHelper { let input = [] let isErrorOccured = false + let isOrgUpdate = false // process csv data for (const invitee of csvData) { @@ -255,7 +256,15 @@ module.exports = class UserInviteHelper { if (isOrganizationMatch) { let userUpdateData = {} if (existingUser.organization_id != user.organization_id) { - userUpdateData.organization_id = user.organization_id + await userQueries.changeOrganization( + existingUser.id, + existingUser.organization_id, + user.organization_id, + { + organization_id: user.organization_id, + } + ) + isOrgUpdate = true userUpdateData.refresh_tokens = [] } const areAllElementsInArray = _.every(roleTitlesToIds[invitee.roles], (element) => @@ -266,18 +275,18 @@ module.exports = class UserInviteHelper { userUpdateData.refresh_tokens = [] } - if (userUpdateData.organization_id || userUpdateData.roles) { + if (isOrgUpdate || userUpdateData.roles) { const userCredentials = await UserCredentialQueries.findOne({ - email: invitee.email.toLowerCase(), + email: invitee.email, }) await userQueries.updateUser({ id: userCredentials.user_id }, userUpdateData) await UserCredentialQueries.updateUser( { - email: invitee.email.toLowerCase(), + email: invitee.email, }, - { organization_id: userUpdateData.organization_id } + { organization_id: user.organization_id } ) const userRoles = await roleQueries.findAll({ id: existingUser.roles }) //call event to update in mentoring From cb2c5a54baa8ec262076a8d1ca21b8b608234d96 Mon Sep 17 00:00:00 2001 From: Priyanka Pradeep Date: Fri, 15 Dec 2023 12:44:19 +0530 Subject: [PATCH 013/109] fix for popup issue --- src/generics/utils.js | 70 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 9 deletions(-) diff --git a/src/generics/utils.js b/src/generics/utils.js index 656e30a0d..7ad1dec6a 100644 --- a/src/generics/utils.js +++ b/src/generics/utils.js @@ -167,8 +167,67 @@ function validateInput(input, validationData, modelName) { const errors = [] for (const field of validationData) { const fieldValue = input[field.value] - //console.log('fieldValue', field.allow_custom_entities) - if (!fieldValue || field.allow_custom_entities === true) { + + if (modelName && !field.model_names.includes(modelName) && input[field.value]) { + errors.push({ + param: field.value, + msg: `${field.value} is not allowed for the ${modelName} model.`, + }) + } + + function addError(field, value, dataType, message) { + errors.push({ + param: field.value, + msg: `${value} is invalid for data type ${dataType}. ${message}`, + }) + } + + if (fieldValue !== undefined) { + const dataType = field.data_type + + switch (dataType) { + case 'ARRAY[STRING]': + if (Array.isArray(fieldValue)) { + fieldValue.forEach((element) => { + if (typeof element !== 'string' || /[^A-Za-z0-9_]/.test(element)) { + addError( + field, + element, + dataType, + 'It should not contain spaces or special characters except underscore.' + ) + } + }) + } else { + addError(field, field.value, dataType, '') + } + break + + case 'STRING': + if (typeof fieldValue !== 'string' || /[^A-Za-z0-9_]/.test(fieldValue)) { + addError( + field, + fieldValue, + dataType, + 'It should not contain spaces or special characters except underscore.' + ) + } + break + + case 'NUMBER': + console.log('Type of', typeof fieldValue) + if (typeof fieldValue !== 'number') { + addError(field, fieldValue, dataType, '') + } + break + + default: + //isValid = false + break + } + } + + if (!fieldValue || field.allow_custom_entities === true || field.has_entities === false) { continue // Skip validation if the field is not present in the input or allow_custom_entities is true } @@ -187,13 +246,6 @@ function validateInput(input, validationData, modelName) { msg: `${fieldValue} is not a valid entity.`, }) } - - if (modelName && !field.model_names.includes(modelName)) { - errors.push({ - param: field.value, - msg: `${field.value} is not allowed for the ${modelName} model.`, - }) - } } if (errors.length === 0) { From be1c40c3bfbff76f9f30a7b61659dbc8ddb8ccc3 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Mon, 18 Dec 2023 14:50:56 +0530 Subject: [PATCH 014/109] userRole Changes story -1046 & 1047 --- src/constants/common.js | 4 + src/controllers/v1/userRole.js | 80 ++++- .../20231213050419-alter_roles_table.js | 19 ++ src/database/models/userRole.js | 12 +- src/database/queries/userRole.js | 102 ++++-- ...20230718130102-add_roles_to_roles_table.js | 3 + .../20230915100336-add_org_admin_role.js | 3 + .../20231213064907-add_system_manager_role.js | 24 ++ .../userRole/responseSchema.js | 313 ++++++++++++++++++ .../userRole/userRole.spec.js | 60 ++++ src/locales/en.json | 11 +- src/services/userRole.js | 169 +++++++++- src/validators/v1/userRole.js | 81 +++++ 13 files changed, 842 insertions(+), 39 deletions(-) create mode 100644 src/database/migrations/20231213050419-alter_roles_table.js create mode 100644 src/database/seeders/20231213064907-add_system_manager_role.js create mode 100644 src/integration-test/userRole/responseSchema.js create mode 100644 src/integration-test/userRole/userRole.spec.js create mode 100644 src/validators/v1/userRole.js diff --git a/src/constants/common.js b/src/constants/common.js index 2b8ecf34c..2d9f9c710 100644 --- a/src/constants/common.js +++ b/src/constants/common.js @@ -31,6 +31,9 @@ const failureResponse = ({ message = 'Oops! Something Went Wrong.', statusCode = return error } +function getPaginationOffset(page, limit) { + return (page - 1) * limit +} module.exports = { pagination: { DEFAULT_PAGE_NO: 1, @@ -38,6 +41,7 @@ module.exports = { }, successResponse, failureResponse, + getPaginationOffset, guestUrls: [ '/user/v1/account/login', '/user/v1/account/create', diff --git a/src/controllers/v1/userRole.js b/src/controllers/v1/userRole.js index 1447abe89..cc8514de2 100644 --- a/src/controllers/v1/userRole.js +++ b/src/controllers/v1/userRole.js @@ -10,16 +10,88 @@ const roleService = require('@services/userRole') module.exports = class userRole { /** - * list roles + * create roles + * @method + * @name create + * @param {Object} req -request data. + * @param {Object} req.body -request body contains role creation deatils. + * @param {String} req.body.title - title of the role. + * @param {Integer} req.body.userType - userType role . + * @param {String} req.body.status - role status. + * @param {String} req.body.visibility - visibility of the role. + * @param {Integer} req.body.organization_id - organization for role. + * @returns {JSON} - response contains role creation details. + */ + + async create(req) { + const params = req.body + try { + const createRole = await roleService.create(params) + return createRole + } catch (error) { + return error + } + } + + /** + * update roles + * @method + * @name update + * @param {Object} req -request data. + * @param {Object} req.body -request body contains role updation details. + * @param {String} req.body.title - title of the role. + * @param {Integer} req.body.userType - userType role . + * @param {String} req.body.status - role status. + * @param {String} req.body.visibility - visibility of the role. + * @param {Integer} req.body.organization_id - organization for role. + * @returns {JSON} - response contains role updation details. + */ + + async update(req) { + const params = req.body + const id = req.params.id + try { + const updateRole = await roleService.update(id, params) + return updateRole + } catch (error) { + return error + } + } + + /** + * deletes role + * @method + * @name delete + * @param {Object} req - request data. + * @returns {JSON} - role deletion response. + */ + + async delete(req) { + try { + return await roleService.delete(req.params.id) + } catch (error) { + return error + } + } + + /** + * Get all available roles * @method * @name list - * @returns {JSON} - list of roles + * @param {String} req.pageNo - Page No. + * @param {String} req.pageSize - Page size limit. + * @param {String} req.searchText - Search text. + * @returns {JSON} - role List. */ async list(req) { try { - const user = await roleService.list() - return user + const page = req.pageNo + const limit = req.pageSize + const search = req.searchText + const filters = req.body.filters + const roleList = await roleService.list(filters, page, limit, search) + return roleList } catch (error) { return error } diff --git a/src/database/migrations/20231213050419-alter_roles_table.js b/src/database/migrations/20231213050419-alter_roles_table.js new file mode 100644 index 000000000..4fbfd578b --- /dev/null +++ b/src/database/migrations/20231213050419-alter_roles_table.js @@ -0,0 +1,19 @@ +'use strict' +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface, Sequelize) { + await queryInterface.addColumn('user_roles', 'visibility', { + type: Sequelize.STRING, + allowNull: false, + }) + await queryInterface.addColumn('user_roles', 'organization_id', { + type: Sequelize.INTEGER, + allowNull: false, + }) + }, + + async down(queryInterface, Sequelize) { + await queryInterface.removeColumn('user_roles', 'visiblity') + await queryInterface.removeColumn('user_roles', 'organization_id') + }, +} diff --git a/src/database/models/userRole.js b/src/database/models/userRole.js index 259ac73ab..8a8c78070 100644 --- a/src/database/models/userRole.js +++ b/src/database/models/userRole.js @@ -1,5 +1,6 @@ 'use strict' module.exports = (sequelize, DataTypes) => { + const defaultOrgId = sequelize.options.defaultOrgId const UserRole = sequelize.define( 'UserRole', { @@ -20,7 +21,16 @@ module.exports = (sequelize, DataTypes) => { }, status: { type: DataTypes.STRING, - defaultValue: 'ACTIVE', + defaultValue: common.ACTIVE_STATUS, + }, + visibility: { + type: DataTypes.STRING, + defaultValue: 'PUBLIC', + }, + organization_id: { + type: DataTypes.INTEGER, + defaultValue: defaultOrgId, + allowNull: false, }, }, { sequelize, modelName: 'UserRole', tableName: 'user_roles', freezeTableName: true, paranoid: true } diff --git a/src/database/queries/userRole.js b/src/database/queries/userRole.js index b2fc03311..93d21e65d 100644 --- a/src/database/queries/userRole.js +++ b/src/database/queries/userRole.js @@ -2,34 +2,86 @@ const UserRole = require('@database/models/index').UserRole const { Op } = require('sequelize') -exports.findOne = async (filter, options = {}) => { - try { - return await UserRole.findOne({ - where: filter, - ...options, - raw: true, - }) - } catch (error) { - return error +module.exports = class UserRoleModulesData { + static async findOne(filter, options = {}) { + try { + return await UserRole.findOne({ + where: filter, + ...options, + raw: true, + }) + } catch (error) { + return error + } } -} -exports.findByPk = async (id) => { - try { - return await UserRole.findByPk(id, { raw: true }) - } catch (error) { - return error + static async create(data) { + try { + return await UserRole.create(data, { returning: true }) + } catch (error) { + throw error + } + } + + static async findRoleById(id) { + try { + return await UserRole.findByPk(id) + } catch (error) { + throw error + } + } + + static async findAllRoles(filter, attributes, options) { + try { + const roles = await UserRole.findAndCountAll({ + where: filter, + attributes, + ...options, + }) + return roles + } catch (error) { + throw error + } + } + + static async updateRoleById(id, updatedata) { + try { + const [rowsUpdated, [updatedRoles]] = await UserRole.update(updatedata, { + where: { id }, + returning: true, + }) + return updatedRoles + } catch (error) { + throw error + } + } + + static async deleteRoleById(id) { + try { + const deletedRows = await UserRole.destroy({ + where: { id: id }, + individualHooks: true, + }) + return deletedRows + } catch (error) { + throw error + } + } + + static async findRoleId(filter) { + try { + const roleData = await UserRole.findByPk(filter) + return roleData + } catch (error) { + return error + } } -} -exports.findAll = async (filter, options = {}) => { - try { - return await UserRole.findAll({ - where: filter, - ...options, - raw: true, - }) - } catch (error) { - return error + static async getcolumn() { + try { + return await Object.keys(UserRole.rawAttributes) + } catch (error) { + return error + } } } diff --git a/src/database/seeders/20230718130102-add_roles_to_roles_table.js b/src/database/seeders/20230718130102-add_roles_to_roles_table.js index e6cadc6ca..c48b8a7ec 100644 --- a/src/database/seeders/20230718130102-add_roles_to_roles_table.js +++ b/src/database/seeders/20230718130102-add_roles_to_roles_table.js @@ -1,6 +1,7 @@ module.exports = { up: async (queryInterface, Sequelize) => { let rolesData = [] + const defaultOrgId = queryInterface.sequelize.options.defaultOrgId const roleArray = ['user', 'mentor', 'mentee', 'admin'] //user_type denotes the role is system user or not 1: system user, 0: non system user roleArray.forEach(async function (role) { @@ -12,6 +13,8 @@ module.exports = { let eachRow = { title: role, user_type: user_type, + visibility: 'PUBLIC', + organization_id: defaultOrgId, updated_at: new Date(), created_at: new Date(), } diff --git a/src/database/seeders/20230915100336-add_org_admin_role.js b/src/database/seeders/20230915100336-add_org_admin_role.js index daa8235de..1c69115a5 100644 --- a/src/database/seeders/20230915100336-add_org_admin_role.js +++ b/src/database/seeders/20230915100336-add_org_admin_role.js @@ -4,9 +4,12 @@ module.exports = { async up(queryInterface, Sequelize) { let roleData = [] + const defaultOrgId = queryInterface.sequelize.options.defaultOrgId let eachRow = { title: 'org_admin', user_type: 1, + visibility: 'PUBLIC', + organization_id: defaultOrgId, updated_at: new Date(), created_at: new Date(), } diff --git a/src/database/seeders/20231213064907-add_system_manager_role.js b/src/database/seeders/20231213064907-add_system_manager_role.js new file mode 100644 index 000000000..d981640e9 --- /dev/null +++ b/src/database/seeders/20231213064907-add_system_manager_role.js @@ -0,0 +1,24 @@ +'use strict' + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface, Sequelize) { + let roleData = [] + const defaultOrgId = queryInterface.sequelize.options.defaultOrgId + let eachRow = { + title: 'system_manager', + user_type: 1, + visibility: 'PUBLIC', + organization_id: defaultOrgId, + updated_at: new Date(), + created_at: new Date(), + } + + roleData.push(eachRow) + await queryInterface.bulkInsert('user_roles', roleData, {}) + }, + + async down(queryInterface, Sequelize) { + await queryInterface.bulkDelete('user_roles', { title: 'system_manager' }) + }, +} diff --git a/src/integration-test/userRole/responseSchema.js b/src/integration-test/userRole/responseSchema.js new file mode 100644 index 000000000..9022f3d42 --- /dev/null +++ b/src/integration-test/userRole/responseSchema.js @@ -0,0 +1,313 @@ +const createSchema = { + type: 'object', + properties: { + responseCode: { + type: 'string', + }, + message: { + type: 'string', + }, + result: { + type: 'object', + properties: { + title: { + type: 'string', + }, + user_type: { + type: 'integer', + }, + status: { + type: 'string', + }, + visibility: { + type: 'string', + }, + organization_id: { + type: 'integer', + }, + }, + required: ['title', 'user_type', 'status', 'visibility', 'organization_id'], + }, + meta: { + type: 'object', + properties: { + formsVersion: { + type: 'array', + items: {}, + }, + correlation: { + type: 'string', + }, + }, + required: ['formsVersion', 'correlation'], + }, + }, + required: ['responseCode', 'message', 'result', 'meta'], +} + +const updateSchema = { + type: 'object', + properties: { + responseCode: { + type: 'string', + }, + message: { + type: 'string', + }, + result: { + type: 'object', + properties: { + title: { + type: 'string', + }, + user_type: { + type: 'integer', + }, + status: { + type: 'string', + }, + visibility: { + type: 'string', + }, + organization_id: { + type: 'integer', + }, + }, + required: ['title', 'user_type', 'status', 'visibility', 'organization_id'], + }, + meta: { + type: 'object', + properties: { + formsVersion: { + type: 'array', + items: {}, + }, + correlation: { + type: 'string', + }, + }, + required: ['formsVersion', 'correlation'], + }, + }, + required: ['responseCode', 'message', 'result', 'meta'], +} + +const deleteSchema = { + type: 'object', + properties: { + responseCode: { + type: 'string', + }, + message: { + type: 'string', + }, + result: { + type: 'object', + }, + meta: { + type: 'object', + properties: { + formsVersion: { + type: 'array', + items: {}, + }, + correlation: { + type: 'string', + }, + }, + required: ['formsVersion', 'correlation'], + }, + }, + required: ['responseCode', 'message', 'result', 'meta'], +} + +const listSchema = { + type: 'object', + properties: { + responseCode: { + type: 'string', + }, + message: { + type: 'string', + }, + result: { + type: 'object', + properties: { + data: { + type: 'array', + items: [ + { + type: 'object', + properties: { + id: { + type: 'integer', + }, + title: { + type: 'string', + }, + user_type: { + type: 'integer', + }, + visibility: { + type: 'string', + }, + status: { + type: 'string', + }, + organization_id: { + type: 'integer', + }, + }, + required: ['id', 'title', 'user_type', 'visibility', 'status', 'organization_id'], + }, + { + type: 'object', + properties: { + id: { + type: 'integer', + }, + title: { + type: 'string', + }, + user_type: { + type: 'integer', + }, + visibility: { + type: 'string', + }, + status: { + type: 'string', + }, + organization_id: { + type: 'integer', + }, + }, + required: ['id', 'title', 'user_type', 'visibility', 'status', 'organization_id'], + }, + { + type: 'object', + properties: { + id: { + type: 'integer', + }, + title: { + type: 'string', + }, + user_type: { + type: 'integer', + }, + visibility: { + type: 'string', + }, + status: { + type: 'string', + }, + organization_id: { + type: 'integer', + }, + }, + required: ['id', 'title', 'user_type', 'visibility', 'status', 'organization_id'], + }, + { + type: 'object', + properties: { + id: { + type: 'integer', + }, + title: { + type: 'string', + }, + user_type: { + type: 'integer', + }, + visibility: { + type: 'string', + }, + status: { + type: 'string', + }, + organization_id: { + type: 'integer', + }, + }, + required: ['id', 'title', 'user_type', 'visibility', 'status', 'organization_id'], + }, + { + type: 'object', + properties: { + id: { + type: 'integer', + }, + title: { + type: 'string', + }, + user_type: { + type: 'integer', + }, + visibility: { + type: 'string', + }, + status: { + type: 'string', + }, + organization_id: { + type: 'integer', + }, + }, + required: ['id', 'title', 'user_type', 'visibility', 'status', 'organization_id'], + }, + { + type: 'object', + properties: { + id: { + type: 'integer', + }, + title: { + type: 'string', + }, + user_type: { + type: 'integer', + }, + visibility: { + type: 'string', + }, + status: { + type: 'string', + }, + organization_id: { + type: 'integer', + }, + }, + required: ['id', 'title', 'user_type', 'visibility', 'status', 'organization_id'], + }, + ], + }, + count: { + type: 'integer', + }, + }, + required: ['data', 'count'], + }, + meta: { + type: 'object', + properties: { + formsVersion: { + type: 'array', + items: {}, + }, + correlation: { + type: 'string', + }, + }, + required: ['formsVersion', 'correlation'], + }, + }, + required: ['responseCode', 'message', 'result', 'meta'], +} + +module.exports = { + createSchema, + updateSchema, + deleteSchema, + listSchema, +} diff --git a/src/integration-test/userRole/userRole.spec.js b/src/integration-test/userRole/userRole.spec.js new file mode 100644 index 000000000..bd197a34c --- /dev/null +++ b/src/integration-test/userRole/userRole.spec.js @@ -0,0 +1,60 @@ +const { request, logIn, logError } = require('@commonTests') +let responseSchema = require('./responseSchema') + +describe('/user/v1/userRole', function () { + let userDetails + beforeAll(async () => { + userDetails = await logIn() + }) + + it('/create', async () => { + let res = await request.post('/user/v1/userRole/create').send({ + title: 'system_admin', + user_type: 1, + status: 'ACTIVE', + visibility: 'PUBLIC', + organization_id: 1, + }) + + logError(res) + expect(res.statusCode).toBe(201) + expect(res.body).toMatchSchema(responseSchema.createSchema) + }) + + it('/update', async () => { + let res = await request.post('/user/v1/userRole/update/7').send({ + title: 'system_adm', + user_type: 1, + status: 'ACTIVE', + visibility: 'PUBLIC', + organization_id: 1, + }) + + logError(res) + expect(res.statusCode).toBe(201) + expect(res.body).toMatchSchema(responseSchema.updateSchema) + }) + + it('/delete', async () => { + let res = await request.post('/user/v1/userRole/delete/7') + + logError(res) + expect(res.statusCode).toBe(202) + expect(res.body).toMatchSchema(responseSchema.deleteSchema) + }) + + it('/list', async () => { + let res = await request + .get('/user/v1/userRole/list') + .send({ + filters: { + organization_id: 1, + }, + }) + .query({ page: 1, limit: 10, code: 'system' }) + + logError(res) + expect(res.statusCode).toBe(200) + expect(res.body).toMatchSchema(responseSchema.listSchema) + }) +}) diff --git a/src/locales/en.json b/src/locales/en.json index 4393d9cd4..fe581bec7 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -104,5 +104,14 @@ "NAME_INVALID": "Name is invalid.", "ROLE_CHANGE_APPROVED": "Your request for becoming a mentor has been approved. Check email or login again to start your journey.", "MATERIALIZED_VIEW_GENERATED_SUCCESSFULLY": "Materialized views generated successfully", - "MATERIALIZED_VIEW_REFRESH_INITIATED_SUCCESSFULLY": "Materialized views refresh initiated successfully" + "MATERIALIZED_VIEW_REFRESH_INITIATED_SUCCESSFULLY": "Materialized views refresh initiated successfully", + "ROLE_CREATED_SUCCESSFULLY": "Roles added successfully", + "ROLE_UPDATED_SUCCESSFULLY": "Roles updated successfully", + "ROLE_DELETED_SUCCESSFULLY": "Module deleted successfully", + "ROLES_FETCHED_SUCCESSFULLY": "Roles fetched successfully", + "ROLE_NOT_UPDATED": "Roles not updated", + "ROLE_ALREADY_DELETED_OR_ROLE_NOT_PRESENT": "Roles already exists OR Roles not present", + "ROLE_NOT_DELETED": "Roles not deleted", + "ROLES_HAS_EMPTY_LIST": "Empty roles list", + "COLUMN_DOES_NOT_EXISTS": "Role column does not exists" } diff --git a/src/services/userRole.js b/src/services/userRole.js index 0fc7546e3..5eeca1f66 100644 --- a/src/services/userRole.js +++ b/src/services/userRole.js @@ -10,25 +10,178 @@ const httpStatusCode = require('@generics/http-status') const roleQueries = require('@database/queries/userRole') const common = require('@constants/common') +const { Op } = require('sequelize') module.exports = class userRoleHelper { /** - * list Roles + * create role * @method - * @name list - * @returns {JSON} - delete user response + * @name create + * @param {Object} req -request data. + * @param {Object} req.body -request body contains role creation deatils. + * @param {String} req.body.title - title of the role. + * @param {Integer} req.body.userType - userType role . + * @param {String} req.body.status - role status. + * @param {String} req.body.visibility - visibility of the role. + * @param {Integer} req.body.organization_id - organization for role. + * @returns {JSON} - response contains role creation details. */ - static async list() { + static async create(bodyData) { try { - let roles = await roleQueries.findAll() + const roles = await roleQueries.create(bodyData) + return common.successResponse({ + statusCode: httpStatusCode.created, + message: 'ROLE_CREATED_SUCCESSFULLY', + result: { + title: roles.title, + user_type: roles.user_type, + status: roles.status, + visibility: roles.visibility, + organization_id: roles.organization_id, + }, + }) + } catch (error) { + throw error + } + } + /** + * update role + * @method + * @name update + * @param {Object} req -request data. + * @param {Object} req.body -request body contains role updation details. + * @param {String} req.body.title - title of the role. + * @param {Integer} req.body.userType - userType role . + * @param {String} req.body.status - role status. + * @param {String} req.body.visibility - visibility of the role. + * @param {Integer} req.body.organization_id - organization for role. + * @returns {JSON} - response contains role updation details. + */ + + static async update(id, bodyData) { + try { + const roles = await roleQueries.findRoleById(id) + if (!roles) { + throw new Error('ROLE_NOT_FOUND') + } + + const updateRole = await roleQueries.updateRoleById(id, bodyData) + if (!updateRole) { + return common.failureResponse({ + message: 'ROLE_NOT_UPDATED', + statusCode: httpStatusCode.bad_request, + responseCode: 'CLIENT_ERROR', + }) + } return common.successResponse({ - statusCode: httpStatusCode.ok, - message: 'USER_ROLE_LIST', - result: roles, + statusCode: httpStatusCode.created, + message: 'ROLE_UPDATED_SUCCESSFULLY', + result: { + title: updateRole.title, + user_type: updateRole.user_type, + status: updateRole.status, + visibility: updateRole.visibility, + organization_id: updateRole.organization_id, + }, }) } catch (error) { throw error } } + + /** + * delete role + * @method + * @name delete + * @param {Object} req - request data. + * @returns {JSON} - role deletion response. + */ + static async delete(id) { + try { + const roles = await roleQueries.findRoleById(id) + + if (!roles) { + return common.failureResponse({ + message: 'ROLE_ALREADY_DELETED_OR_ROLE_NOT_PRESENT', + statusCode: httpStatusCode.bad_request, + responseCode: 'CLIENT_ERROR', + }) + } else { + const deleteRole = await roleQueries.deleteRoleById(id) + + if (!deleteRole) { + return common.failureResponse({ + message: 'ROLE_NOT_DELETED', + statusCode: httpStatusCode.bad_request, + responseCode: 'CLIENT_ERROR', + }) + } + return common.successResponse({ + statusCode: httpStatusCode.accepted, + message: 'ROLE_DELETED_SUCCESSFULLY', + result: {}, + }) + } + } catch (error) { + throw error + } + } + + /** + * Get all available roles + * @method + * @name list + * @param {String} req.pageNo - Page No. + * @param {String} req.pageSize - Page size limit. + * @param {String} req.searchText - Search text. + * @returns {JSON} - role List. + */ + static async list(filters, page, limit, search) { + try { + const offset = common.getPaginationOffset(page, limit) + const options = { + offset, + limit, + } + const filter = { + title: { [Op.iLike]: `%${search}%` }, + ...filters, + } + const attributes = ['id', 'title', 'user_type', 'visibility', 'status', 'organization_id'] + let userroleModel = await roleQueries.getcolumn() + const invalidColumns = Object.keys(filters).filter((key) => !userroleModel.includes(key)) + + if (invalidColumns.length > 0) { + return common.failureResponse({ + message: 'COLUMN_DOES_NOT_EXISTS', + statusCode: httpStatusCode.bad_request, + responseCode: 'CLIENT_ERROR', + }) + } + + const roles = await roleQueries.findAllRoles(filter, attributes, options) + + if (roles.rows == 0 || roles.count == 0) { + return common.failureResponse({ + message: 'ROLES_HAS_EMPTY_LIST', + statusCode: httpStatusCode.bad_request, + responseCode: 'CLIENT_ERROR', + }) + } else { + const results = { + data: roles.rows, + count: roles.count, + } + + return common.successResponse({ + statusCode: httpStatusCode.ok, + message: 'ROLES_FETCHED_SUCCESSFULLY', + result: results, + }) + } + } catch (error) { + throw error + } + } } diff --git a/src/validators/v1/userRole.js b/src/validators/v1/userRole.js new file mode 100644 index 000000000..c67ffadad --- /dev/null +++ b/src/validators/v1/userRole.js @@ -0,0 +1,81 @@ +module.exports = { + create: (req) => { + req.checkBody('title') + .trim() + .notEmpty() + .withMessage('title field is empty') + .matches(/^[a-z_]+$/) + .withMessage('title is invalid, must not contain spaces') + + req.checkBody('user_type') + .trim() + .notEmpty() + .withMessage('userType field is empty') + .matches(/^[0-9]+$/) + .withMessage('userType is invalid, must not contain spaces') + + req.checkBody('visibility') + .trim() + .notEmpty() + .withMessage('visibility field is empty') + .matches(/^[A-Z_]+$/) + .withMessage('visibility is invalid, must not contain spaces') + + req.checkBody('organization_id') + .notEmpty() + .withMessage('organization_id field is empty') + .matches(/^[0-9]+$/) + .withMessage('organization_id should be number') + + req.checkBody('status') + .trim() + .matches(/^[A-Za-z]*$/) + .withMessage('status is invalid, must not contain spaces') + .optional({ checkFalsy: true }) + .notEmpty() + .withMessage('status field must be a non-empty string when provided') + }, + + update: (req) => { + req.checkParams('id').notEmpty().withMessage('id param is empty') + + req.checkBody('title') + .trim() + .notEmpty() + .withMessage('title field is empty') + .matches(/^[a-z_]+$/) + .withMessage('title is invalid, must not contain spaces') + + req.checkBody('user_type') + .trim() + .notEmpty() + .withMessage('userType field is empty') + .matches(/^[0-9]+$/) + .withMessage('userType is invalid, must not contain spaces') + + req.checkBody('visibility') + .trim() + .notEmpty() + .withMessage('visibility field is empty') + .matches(/^[A-Z_]+$/) + .withMessage('visibility is invalid, must not contain spaces') + + req.checkBody('organization_id') + .notEmpty() + .withMessage('organization_id field is empty') + .matches(/^[0-9]+$/) + .withMessage('organization_id should be number') + + req.checkBody('status') + .trim() + .matches(/^[A-Za-z]*$/) + .withMessage('status is invalid, must not contain spaces') + .optional({ checkFalsy: true }) + .notEmpty() + .withMessage('status field must be a non-empty string when provided') + }, + + delete: (req) => { + req.checkParams('id').notEmpty().withMessage('id param is empty') + }, +} From 2dac02a94dc99e2faa300b6ed458aec7cd947232 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Mon, 18 Dec 2023 17:39:52 +0530 Subject: [PATCH 015/109] userRole api-doc --- .../MentorED-Users.postman_collection.json | 38 +- src/api-doc/api-doc.yaml | 363 +++++++++++++++++- src/database/models/userRole.js | 2 +- src/database/queries/userRole.js | 12 + 4 files changed, 373 insertions(+), 42 deletions(-) diff --git a/src/api-doc/MentorED-Users.postman_collection.json b/src/api-doc/MentorED-Users.postman_collection.json index 305fcedb2..46691635f 100644 --- a/src/api-doc/MentorED-Users.postman_collection.json +++ b/src/api-doc/MentorED-Users.postman_collection.json @@ -1,9 +1,10 @@ { "info": { - "_postman_id": "615444c7-583f-44b9-9b96-8b92f9cb0df1", - "name": "MentorED-Users DEV new", + "_postman_id": "6e5cb5db-0364-4c41-b8bf-09689233f1f9", + "name": "MentorED-Users", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", - "_exporter_id": "21498549" + "_exporter_id": "24204448", + "_collection_link": "https://dark-astronaut-764227.postman.co/workspace/Elevate-Workspace~39b977d8-9e5b-4232-87f3-3da4bed3a67c/collection/24204448-6e5cb5db-0364-4c41-b8bf-09689233f1f9?action=share&source=collection_link&creator=24204448" }, "item": [ { @@ -461,37 +462,6 @@ } ] }, - { - "name": "User Role", - "item": [ - { - "name": "List User Roles", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, - "request": { - "method": "GET", - "header": [ - { - "key": "X-auth-token", - "value": "bearer {{token}}", - "type": "text" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "{{UserDevBaseUrl}}user/v1/userRole/list", - "host": ["{{UserDevBaseUrl}}user"], - "path": ["v1", "userRole", "list"] - } - }, - "response": [] - } - ] - }, { "name": "Form", "item": [ diff --git a/src/api-doc/api-doc.yaml b/src/api-doc/api-doc.yaml index ba2e8e1d6..b89f3cbaf 100644 --- a/src/api-doc/api-doc.yaml +++ b/src/api-doc/api-doc.yaml @@ -1,4 +1,3 @@ ---- openapi: 3.0.0 info: title: Elevate User @@ -1099,7 +1098,9 @@ paths: description: | This API is associated with requesting a specific role within an organization. - Endpoint: `/user/v1/organization/requestOrgRole` + - Mandatory parameters marked as `required` must have valid values. + - Parameters cannot be empty or null. tags: - Organization @@ -1157,22 +1158,112 @@ paths: required: true schema: type: string - + - in: query + name: '' + description: '' + schema: &ref_1 + type: string + - in: path + name: page + description: Please add page number + schema: &ref_0 + type: number + - in: path + name: limit + description: Number of records to limit + schema: *ref_0 + - in: path + name: search + description: Please search for information such as 'code' names + schema: *ref_1 responses: '200': description: OK content: application/json: schema: - '$ref': '#/components/schemas/userRole/userRoleListResponse200' + $schema: http://json-schema.org/draft-04/schema# + type: object + properties: + responseCode: + type: string + message: + type: string + result: + type: object + properties: + data: + type: array + items: + type: object + properties: + id: + type: number + title: + type: string + user_type: + type: number + visibility: + type: string + status: + type: string + organization_id: + type: number + count: + type: number + meta: + type: object + properties: + formsVersion: + type: array + items: + type: string + correlation: + type: string + examples: + example1: + value: + responseCode: OK + message: Roles fetched successfully + result: + data: + - id: 6 + title: system_manager + user_type: 1 + visibility: PUBLIC + status: ACTIVE + organization_id: 1 + count: 1 + meta: + formsVersion: [] + correlation: b36f45cf-039c-466d-9c50-4649fa4e0856 '401': description: Unauthorized content: application/json: schema: - '$ref': '#/components/schemas/profile/Unauthorized401Response' - - '/user/v1/entity-type/create': + $ref: '#/components/schemas/profile/Unauthorized401Response' + requestBody: + description: '' + content: + application/json: + schema: + $schema: http://json-schema.org/draft-04/schema# + type: object + properties: + filters: + type: object + properties: + organization_id: + type: number + required: + - filters + examples: + example1: + value: + filters: + organization_id: 1 + /user/v1/entity-type/create: post: summary: Create Entity Type tags: @@ -1545,6 +1636,7 @@ paths: - Entity APIs description: | This API is associated with updating an entity. + - Endpoint for updating an entity: `/user/v1/entity/update`. - It is mandatory to provide values for parameters marked with `required`. - Mandatory parameters cannot be empty or null. @@ -1992,6 +2084,7 @@ paths: summary: Get Bulk Invite Files List description: | Get a list of uploaded bulk invite CSV files. + - Endpoint: `/user/v1/org-admin/getBulkInvitesFilesList`. - It is mandatory to provide values for parameters marked with `required`. - Mandatory parameters cannot be empty or null. @@ -2131,6 +2224,7 @@ paths: - Notification APIs description: | This API is associated with notification create or update. + - Endpoint: `/user/v1/notification/template`. - It is mandatory to provide values for parameters marked with `required`. - Mandatory parameters cannot be empty or null. @@ -2158,8 +2252,257 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/notification/createNotification400Response' + $ref: >- + #/components/schemas/notification/createNotification400Response + /user/v1/userRole/Create: + post: + summary: Create User Role + description: > + Create roles for users. + - Endpoint: `/user/v1/userRole/Create`. + + - It is mandatory to provide values for parameters marked with + `required`. + + - Mandatory parameters cannot be empty or null. + tags: + - User Roles APIs + parameters: + - name: X-auth-token + in: header + description: Access token of the user + required: true + schema: 'ref_2' + requestBody: + required: true + content: + application/json: + schema: + $schema: http://json-schema.org/draft-04/schema# + type: object + properties: + title: + type: string + user_type: + type: number + status: + type: string + visibility: + type: string + organization_id: + type: number + required: + - user_type + - status + - title + - visibility + - organization_id + examples: + example1: + value: + title: system_admin + user_type: 1 + status: ACTIVE + visibility: PUBLIC + organization_id: 1 + responses: + '201': + description: OK + content: + application/json: + schema: + $schema: http://json-schema.org/draft-04/schema# + type: object + properties: + responseCode: + type: string + message: + type: string + result: + type: object + properties: + title: + type: string + user_type: + type: number + status: + type: string + visibility: + type: string + organization_id: + type: number + meta: + type: object + properties: + formsVersion: + type: array + items: + type: string + correlation: + type: string + examples: + example1: + value: + responseCode: OK + message: Roles added successfully + result: + title: system_admin + user_type: 1 + status: ACTIVE + visibility: PUBLIC + organization_id: 1 + meta: + formsVersion: [] + correlation: 483b441a-c4c2-4c71-9aae-8dcf2d7ee5e8 + /user/v1/userRole/update/{id}: + post: + summary: Update User Roles + tags: + - User Roles APIs + description: | + Use this API to update an user Role. + + - Endpoint: `/user/v1/userRole/update/{id}` + - Provide values for parameters marked as `required`. + - The X-auth-token is mandatory and cannot be empty or null. + parameters: 'ref_3' + requestBody: + content: + application/json: + schema: + $schema: http://json-schema.org/draft-04/schema# + type: object + properties: + title: + type: string + user_type: + type: number + status: + type: string + visibility: + type: string + organization_id: + type: number + required: + - title + - user_type + - status + - visibility + - organization_id + examples: + example1: + value: + title: system_ + user_type: 1 + status: ACTIVE + visibility: PUBLIC + organization_id: 3 + responses: + '201': + description: OK. Roles updated successfully + content: + application/json: + schema: + $schema: http://json-schema.org/draft-04/schema# + type: object + properties: + responseCode: + type: string + message: + type: string + result: + type: object + properties: + title: + type: string + user_type: + type: number + status: + type: string + visibility: + type: string + organization_id: + type: number + meta: + type: object + properties: + formsVersion: + type: array + items: + type: string + correlation: + type: string + examples: + example1: + value: + responseCode: OK + message: Roles updated successfully + result: + title: system_ + user_type: 1 + status: ACTIVE + visibility: PUBLIC + organization_id: 3 + meta: + formsVersion: [] + correlation: 7672e4b5-2fa7-4022-a18b-cd574898e590 + /user/v1/userRole/delete/{id}: + delete: + summary: Delete User Role + tags: + - User Roles APIs + description: > + This API is associated with deleting an role. + + - Endpoint for deleting a user role: `/user/v1/userRole/delete/{id}`. + + - It is mandatory to provide values for parameters marked with + `required`. + + - Mandatory parameters cannot be empty or null. + parameters: + - 'ref_4' + - in: path + name: id + required: true + description: Please append a valid user role ID to the request URL. + schema: 'ref_5' + example: 31 + responses: + '202': + description: OK. Accepted + content: + application/json: + schema: + $schema: http://json-schema.org/draft-04/schema# + type: object + properties: + responseCode: + type: string + message: + type: string + result: + type: object + properties: {} + meta: + type: object + properties: + formsVersion: + type: array + items: + type: string + correlation: + type: string + examples: + example1: + value: + responseCode: OK + message: Module deleted successfully + result: {} + meta: + formsVersion: [] + correlation: 645c901e-a7db-49a3-8d4c-dfc4f0b6dadb components: schemas: user: @@ -4542,3 +4885,9 @@ components: type: apiKey name: X-auth-token in: header +tags: + - name: User Roles APIs + description: '' + externalDocs: + description: '' + url: '' diff --git a/src/database/models/userRole.js b/src/database/models/userRole.js index 8a8c78070..edc6a9ade 100644 --- a/src/database/models/userRole.js +++ b/src/database/models/userRole.js @@ -21,7 +21,7 @@ module.exports = (sequelize, DataTypes) => { }, status: { type: DataTypes.STRING, - defaultValue: common.ACTIVE_STATUS, + defaultValue: 'ACTIVE', }, visibility: { type: DataTypes.STRING, diff --git a/src/database/queries/userRole.js b/src/database/queries/userRole.js index 93d21e65d..5dde70047 100644 --- a/src/database/queries/userRole.js +++ b/src/database/queries/userRole.js @@ -23,6 +23,18 @@ module.exports = class UserRoleModulesData { } } + static async findAll(filter, options = {}) { + try { + return await UserRole.findAll({ + where: filter, + ...options, + raw: true, + }) + } catch (error) { + return error + } + } + static async findRoleById(id) { try { return await UserRole.findByPk(id) From 37ba37ba90b95532cf6c9041c3cca31ea533adf7 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Mon, 18 Dec 2023 17:49:37 +0530 Subject: [PATCH 016/109] userRole api-doc conflict changes --- src/database/migrations/20231213050419-alter_roles_table.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/database/migrations/20231213050419-alter_roles_table.js b/src/database/migrations/20231213050419-alter_roles_table.js index 4fbfd578b..7857eee98 100644 --- a/src/database/migrations/20231213050419-alter_roles_table.js +++ b/src/database/migrations/20231213050419-alter_roles_table.js @@ -13,7 +13,7 @@ module.exports = { }, async down(queryInterface, Sequelize) { - await queryInterface.removeColumn('user_roles', 'visiblity') + await queryInterface.removeColumn('user_roles', 'visibility') await queryInterface.removeColumn('user_roles', 'organization_id') }, } From 70291e08171a824f3be321e6e7688093e37d8c1b Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Mon, 18 Dec 2023 18:07:58 +0530 Subject: [PATCH 017/109] userRole api-doc conflict changes --- .../seeders/20230718130102-add_roles_to_roles_table.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/database/seeders/20230718130102-add_roles_to_roles_table.js b/src/database/seeders/20230718130102-add_roles_to_roles_table.js index c48b8a7ec..b6d2406b0 100644 --- a/src/database/seeders/20230718130102-add_roles_to_roles_table.js +++ b/src/database/seeders/20230718130102-add_roles_to_roles_table.js @@ -3,7 +3,7 @@ module.exports = { let rolesData = [] const defaultOrgId = queryInterface.sequelize.options.defaultOrgId const roleArray = ['user', 'mentor', 'mentee', 'admin'] - //user_type denotes the role is system user or not 1: system user, 0: non system user + // user_type denotes the role is a system user or not 1: system user, 0: non-system user roleArray.forEach(async function (role) { let user_type = 0 if (role == 'admin') { @@ -13,7 +13,7 @@ module.exports = { let eachRow = { title: role, user_type: user_type, - visibility: 'PUBLIC', + visibility: 'PUBLIC', // Corrected property name here organization_id: defaultOrgId, updated_at: new Date(), created_at: new Date(), From 04a7d449e65deff9a133d4c187872d33ec044e16 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Mon, 18 Dec 2023 18:13:57 +0530 Subject: [PATCH 018/109] userRole APIs --- .../seeders/20230718130102-add_roles_to_roles_table.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/database/seeders/20230718130102-add_roles_to_roles_table.js b/src/database/seeders/20230718130102-add_roles_to_roles_table.js index b6d2406b0..f0bd8290d 100644 --- a/src/database/seeders/20230718130102-add_roles_to_roles_table.js +++ b/src/database/seeders/20230718130102-add_roles_to_roles_table.js @@ -3,17 +3,15 @@ module.exports = { let rolesData = [] const defaultOrgId = queryInterface.sequelize.options.defaultOrgId const roleArray = ['user', 'mentor', 'mentee', 'admin'] - // user_type denotes the role is a system user or not 1: system user, 0: non-system user roleArray.forEach(async function (role) { let user_type = 0 if (role == 'admin') { user_type = 1 } - let eachRow = { title: role, user_type: user_type, - visibility: 'PUBLIC', // Corrected property name here + visibility: 'PUBLIC', organization_id: defaultOrgId, updated_at: new Date(), created_at: new Date(), From 4d8c854823322ce1999c9e9fe605c48c10c03b56 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Thu, 21 Dec 2023 14:18:56 +0530 Subject: [PATCH 019/109] comment changes 21/12 --- .../MentorED-Users.postman_collection.json | 151 +++++++++++++++++- src/controllers/v1/userRole.js | 13 +- ...31211061329-user-roles-visibility-orgId.js | 6 +- .../20231213050419-alter_roles_table.js | 19 --- src/database/models/userRole.js | 6 +- src/database/queries/userRole.js | 126 +++++---------- ...20230718130102-add_roles_to_roles_table.js | 2 - .../20230915100336-add_org_admin_role.js | 2 - .../20231221071000-alter_add_roles_table.js | 36 +++++ ...20231221080334-add_system_manager_role.js} | 0 src/services/userRole.js | 11 -- src/validators/v1/userRole.js | 14 ++ 12 files changed, 249 insertions(+), 137 deletions(-) delete mode 100644 src/database/migrations/20231213050419-alter_roles_table.js create mode 100644 src/database/seeders/20231221071000-alter_add_roles_table.js rename src/database/seeders/{20231213064907-add_system_manager_role.js => 20231221080334-add_system_manager_role.js} (100%) diff --git a/src/api-doc/MentorED-Users.postman_collection.json b/src/api-doc/MentorED-Users.postman_collection.json index 46691635f..40a107761 100644 --- a/src/api-doc/MentorED-Users.postman_collection.json +++ b/src/api-doc/MentorED-Users.postman_collection.json @@ -78,7 +78,8 @@ { "key": "email", "value": "nevil@tunerlabs.com", - "type": "text" + "type": "text", + "disabled": true }, { "key": "password", @@ -95,6 +96,17 @@ { "key": "password", "value": "testing", + "type": "text", + "disabled": true + }, + { + "key": "email", + "value": "suman.v@pacewisdom.com", + "type": "text" + }, + { + "key": "password", + "value": "password", "type": "text" } ] @@ -1608,6 +1620,143 @@ "response": [] } ] + }, + { + "name": "User Role", + "item": [ + { + "name": "List User Roles", + "protocolProfileBehavior": { + "disableBodyPruning": true + }, + "request": { + "method": "GET", + "header": [ + { + "key": "X-auth-token", + "value": "bearer {{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"filters\" : { \n\"organization_id\": 1\n} \n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{UserDevBaseUrl}}user/v1/userRole/list?page=1&limit=10&search=system", + "host": ["{{UserDevBaseUrl}}user"], + "path": ["v1", "userRole", "list"], + "query": [ + { + "key": "page", + "value": "1" + }, + { + "key": "limit", + "value": "10" + }, + { + "key": "search", + "value": "system" + } + ] + } + }, + "response": [] + }, + { + "name": "Create Roles", + "request": { + "method": "POST", + "header": [ + { + "key": "X-auth-token", + "value": "bearer {{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{ \n\"title\":\"system_admin\", \n\"user_type\": 1, \n\"status\":\"ACTIVE\", \n\"visibility\":\"PUBLIC\", \n\"organization_id\": 1\n} ", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{UserDevBaseUrl}}user/v1/userRole/create", + "host": ["{{UserDevBaseUrl}}user"], + "path": ["v1", "userRole", "create"] + } + }, + "response": [] + }, + { + "name": "Update Roles", + "request": { + "method": "POST", + "header": [ + { + "key": "X-auth-token", + "value": "bearer {{token}}", + "type": "text" + } + ], + "body": { + "mode": "raw", + "raw": "{ \n\"title\":\"system_adminn\", \n\"user_type\": 1, \n\"status\":\"ACTIVE\", \n\"visibility\":\"PUBLIC\", \n\"organization_id\": 3\n} ", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{UserDevBaseUrl}}user/v1/userRole/update/:id", + "host": ["{{UserDevBaseUrl}}user"], + "path": ["v1", "userRole", "update", ":id"], + "variable": [ + { + "key": "id", + "value": "7" + } + ] + } + }, + "response": [] + }, + { + "name": "Delete Roles", + "request": { + "method": "DELETE", + "header": [ + { + "key": "X-auth-token", + "value": "bearer {{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{UserDevBaseUrl}}user/v1/userRole/delete/:id", + "host": ["{{UserDevBaseUrl}}user"], + "path": ["v1", "userRole", "delete", ":id"], + "variable": [ + { + "key": "id", + "value": "7" + } + ] + } + }, + "response": [] + } + ] } ] } diff --git a/src/controllers/v1/userRole.js b/src/controllers/v1/userRole.js index cc8514de2..00678cf21 100644 --- a/src/controllers/v1/userRole.js +++ b/src/controllers/v1/userRole.js @@ -24,9 +24,8 @@ module.exports = class userRole { */ async create(req) { - const params = req.body try { - const createRole = await roleService.create(params) + const createRole = await roleService.create(req.body) return createRole } catch (error) { return error @@ -48,10 +47,8 @@ module.exports = class userRole { */ async update(req) { - const params = req.body - const id = req.params.id try { - const updateRole = await roleService.update(id, params) + const updateRole = await roleService.update(req.params.id, req.body) return updateRole } catch (error) { return error @@ -86,11 +83,7 @@ module.exports = class userRole { async list(req) { try { - const page = req.pageNo - const limit = req.pageSize - const search = req.searchText - const filters = req.body.filters - const roleList = await roleService.list(filters, page, limit, search) + const roleList = await roleService.list(req.body.filters, req.pageNo, req.pageSize, req.searchText) return roleList } catch (error) { return error diff --git a/src/database/migrations/20231211061329-user-roles-visibility-orgId.js b/src/database/migrations/20231211061329-user-roles-visibility-orgId.js index a6c69b697..5af82303f 100644 --- a/src/database/migrations/20231211061329-user-roles-visibility-orgId.js +++ b/src/database/migrations/20231211061329-user-roles-visibility-orgId.js @@ -3,20 +3,20 @@ module.exports = { async up(queryInterface, Sequelize) { const defaultOrgId = queryInterface.sequelize.options.defaultOrgId - await queryInterface.addColumn('user_roles', 'visiblity', { + await queryInterface.addColumn('user_roles', 'visibility', { type: Sequelize.STRING, allowNull: false, defaultValue: 'PUBLIC', }) await queryInterface.addColumn('user_roles', 'organization_id', { - type: Sequelize.STRING, + type: Sequelize.INTEGER, allowNull: false, defaultValue: defaultOrgId, }) }, async down(queryInterface, Sequelize) { - await queryInterface.removeColumn('user_roles', 'visiblity') + await queryInterface.removeColumn('user_roles', 'visibility') await queryInterface.removeColumn('user_roles', 'organization_id') }, } diff --git a/src/database/migrations/20231213050419-alter_roles_table.js b/src/database/migrations/20231213050419-alter_roles_table.js deleted file mode 100644 index 7857eee98..000000000 --- a/src/database/migrations/20231213050419-alter_roles_table.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict' -/** @type {import('sequelize-cli').Migration} */ -module.exports = { - async up(queryInterface, Sequelize) { - await queryInterface.addColumn('user_roles', 'visibility', { - type: Sequelize.STRING, - allowNull: false, - }) - await queryInterface.addColumn('user_roles', 'organization_id', { - type: Sequelize.INTEGER, - allowNull: false, - }) - }, - - async down(queryInterface, Sequelize) { - await queryInterface.removeColumn('user_roles', 'visibility') - await queryInterface.removeColumn('user_roles', 'organization_id') - }, -} diff --git a/src/database/models/userRole.js b/src/database/models/userRole.js index e74c7e306..3d60fdfe5 100644 --- a/src/database/models/userRole.js +++ b/src/database/models/userRole.js @@ -17,17 +17,13 @@ module.exports = (sequelize, DataTypes) => { unique: true, }, user_type: { - type: DataTypes.INTEGER, //0 - non system user , 1 - system user + type: DataTypes.INTEGER, allowNull: false, }, status: { type: DataTypes.STRING, defaultValue: common.ACTIVE_STATUS, }, - visiblity: { - type: DataTypes.STRING, - defaultValue: common.DEFAULT_ORG_VISIBILITY, - }, organization_id: { type: DataTypes.INTEGER, allowNull: false, diff --git a/src/database/queries/userRole.js b/src/database/queries/userRole.js index 5dde70047..cea7400ee 100644 --- a/src/database/queries/userRole.js +++ b/src/database/queries/userRole.js @@ -2,98 +2,56 @@ const UserRole = require('@database/models/index').UserRole const { Op } = require('sequelize') -module.exports = class UserRoleModulesData { - static async findOne(filter, options = {}) { - try { - return await UserRole.findOne({ - where: filter, - ...options, - raw: true, - }) - } catch (error) { - return error - } - } - - static async create(data) { - try { - return await UserRole.create(data, { returning: true }) - } catch (error) { - throw error - } - } - static async findAll(filter, options = {}) { - try { - return await UserRole.findAll({ - where: filter, - ...options, - raw: true, - }) - } catch (error) { - return error - } - } - - static async findRoleById(id) { - try { - return await UserRole.findByPk(id) - } catch (error) { - throw error - } - } - - static async findAllRoles(filter, attributes, options) { - try { - const roles = await UserRole.findAndCountAll({ - where: filter, - attributes, - ...options, - }) - return roles - } catch (error) { - throw error - } +exports.create = async (data) => { + try { + return await UserRole.create(data, { returning: true }) + } catch (error) { + throw error } +} - static async updateRoleById(id, updatedata) { - try { - const [rowsUpdated, [updatedRoles]] = await UserRole.update(updatedata, { - where: { id }, - returning: true, - }) - return updatedRoles - } catch (error) { - throw error - } +exports.findRoleById = async (id) => { + try { + return await UserRole.findByPk(id) + } catch (error) { + throw error } +} - static async deleteRoleById(id) { - try { - const deletedRows = await UserRole.destroy({ - where: { id: id }, - individualHooks: true, - }) - return deletedRows - } catch (error) { - throw error - } +exports.findAllRoles = async (filter, attributes, options) => { + try { + const roles = await UserRole.findAndCountAll({ + where: filter, + attributes, + ...options, + }) + return roles + } catch (error) { + throw error } +} - static async findRoleId(filter) { - try { - const roleData = await UserRole.findByPk(filter) - return roleData - } catch (error) { - return error - } +exports.updateRoleById = async (id, updatedata) => { + try { + const [rowsUpdated, [updatedRoles]] = await UserRole.update(updatedata, { + where: { id }, + returning: true, + }) + return updatedRoles + } catch (error) { + throw error } +} - static async getcolumn() { - try { - return await Object.keys(UserRole.rawAttributes) - } catch (error) { - return error - } +exports.deleteRoleById = async (id) => { + try { + const deletedRows = await UserRole.destroy({ + where: { id: id }, + individualHooks: true, + }) + return deletedRows + } catch (error) { + throw error } } diff --git a/src/database/seeders/20230718130102-add_roles_to_roles_table.js b/src/database/seeders/20230718130102-add_roles_to_roles_table.js index f0bd8290d..effc177d5 100644 --- a/src/database/seeders/20230718130102-add_roles_to_roles_table.js +++ b/src/database/seeders/20230718130102-add_roles_to_roles_table.js @@ -11,8 +11,6 @@ module.exports = { let eachRow = { title: role, user_type: user_type, - visibility: 'PUBLIC', - organization_id: defaultOrgId, updated_at: new Date(), created_at: new Date(), } diff --git a/src/database/seeders/20230915100336-add_org_admin_role.js b/src/database/seeders/20230915100336-add_org_admin_role.js index 1c69115a5..64df2388d 100644 --- a/src/database/seeders/20230915100336-add_org_admin_role.js +++ b/src/database/seeders/20230915100336-add_org_admin_role.js @@ -8,8 +8,6 @@ module.exports = { let eachRow = { title: 'org_admin', user_type: 1, - visibility: 'PUBLIC', - organization_id: defaultOrgId, updated_at: new Date(), created_at: new Date(), } diff --git a/src/database/seeders/20231221071000-alter_add_roles_table.js b/src/database/seeders/20231221071000-alter_add_roles_table.js new file mode 100644 index 000000000..e8172f989 --- /dev/null +++ b/src/database/seeders/20231221071000-alter_add_roles_table.js @@ -0,0 +1,36 @@ +'use strict' + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + async up(queryInterface, Sequelize) { + const defaultOrgId = queryInterface.sequelize.options.defaultOrgId + const roleArray = ['user', 'mentor', 'mentee', 'admin', 'org_admin'] + + // Use Promise.all to wait for all async operations in the loop + await Promise.all( + roleArray.map(async function (role) { + let user_type = 0 + if (role === 'admin') { + user_type = 1 + } + + // Use the queryInterface.bulkUpdate for each role + await queryInterface.bulkUpdate( + 'user_roles', + { + visibility: 'PUBLIC', + organization_id: defaultOrgId, + }, + { + title: role, + user_type: user_type, + } + ) + }) + ) + }, + + async down(queryInterface, Sequelize) { + await queryInterface.bulkDelete('user_roles', null, {}) + }, +} diff --git a/src/database/seeders/20231213064907-add_system_manager_role.js b/src/database/seeders/20231221080334-add_system_manager_role.js similarity index 100% rename from src/database/seeders/20231213064907-add_system_manager_role.js rename to src/database/seeders/20231221080334-add_system_manager_role.js diff --git a/src/services/userRole.js b/src/services/userRole.js index 5eeca1f66..99613b0b6 100644 --- a/src/services/userRole.js +++ b/src/services/userRole.js @@ -149,17 +149,6 @@ module.exports = class userRoleHelper { ...filters, } const attributes = ['id', 'title', 'user_type', 'visibility', 'status', 'organization_id'] - let userroleModel = await roleQueries.getcolumn() - const invalidColumns = Object.keys(filters).filter((key) => !userroleModel.includes(key)) - - if (invalidColumns.length > 0) { - return common.failureResponse({ - message: 'COLUMN_DOES_NOT_EXISTS', - statusCode: httpStatusCode.bad_request, - responseCode: 'CLIENT_ERROR', - }) - } - const roles = await roleQueries.findAllRoles(filter, attributes, options) if (roles.rows == 0 || roles.count == 0) { diff --git a/src/validators/v1/userRole.js b/src/validators/v1/userRole.js index c67ffadad..616b758b9 100644 --- a/src/validators/v1/userRole.js +++ b/src/validators/v1/userRole.js @@ -1,3 +1,12 @@ +const validateList = (req, allowedVariables) => { + allowedVariables.forEach((variable) => { + req.checkQuery(variable) + .optional() + .matches(/^[A-Za-z0-9_]+$/) + .withMessage(`${variable} is invalid, must not contain spaces or special characters`) + }) +} + module.exports = { create: (req) => { req.checkBody('title') @@ -78,4 +87,9 @@ module.exports = { delete: (req) => { req.checkParams('id').notEmpty().withMessage('id param is empty') }, + + list: (req) => { + const allowedVariables = ['title', 'user_type', 'visibility', 'organization_id', 'status'] + validateList(req, allowedVariables) + }, } From d8ec3940c913c1f5795695c64b719a90ad7c4379 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Thu, 21 Dec 2023 16:17:48 +0530 Subject: [PATCH 020/109] api-doc updated 21/12 --- src/api-doc/api-doc.yaml | 840 +- src/api-doc/index.html | 27540 +++++++++++++++++++++++-------------- 2 files changed, 17449 insertions(+), 10931 deletions(-) diff --git a/src/api-doc/api-doc.yaml b/src/api-doc/api-doc.yaml index b89f3cbaf..5688ee7a5 100644 --- a/src/api-doc/api-doc.yaml +++ b/src/api-doc/api-doc.yaml @@ -2,12 +2,13 @@ openapi: 3.0.0 info: title: Elevate User version: 1.0.0 - termsOfService: 'https://github.com/project-sunbird/sunbird-commons/blob/master/LICENSE' + termsOfService: https://github.com/project-sunbird/sunbird-commons/blob/master/LICENSE description: >- - - The Users Service is a centralized Service to support other services. Apis perform operations related to mentoring entities notification etc + - The Users Service is a centralized Service to support other services. Apis + perform operations related to mentoring entities notification etc - - The URL for Users API(s) is `{context}/user/v1` - - Note: These resources can be used in other services + - The URL for Users API(s) is `{context}/user/v1` - Note: These + resources can be used in other services contact: email: info@sunbird.org servers: @@ -15,17 +16,18 @@ servers: description: local dev - url: https://dev.elevate-apis.shikshalokam.org description: dev server - paths: - '/user/v1/account/create': + /user/v1/account/create: post: summary: Create user tags: - User APIs - description: "This Api is associated with Create User on mentoring \n - Then - Endpoint for creating user `/user/v1/account/create` \n - It is mandatory to - provide values for parameter marked with `required` \n - Mandatory parameter - cannot be empty or null \n " + description: |- + This Api is associated with Create User on mentoring + - Then Endpoint for creating user `/user/v1/account/create` + - It is mandatory to provide values for parameter marked with `required` + - Mandatory parameter cannot be empty or null + requestBody: required: true description: Request body consist of metadata and accepts payload as JSON @@ -39,20 +41,20 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/user/userCreateUserResponse' + $ref: '#/components/schemas/user/userCreateUserResponse' '400': description: Bad Request. OTP is invalid content: application/json: schema: - '$ref': '#/components/schemas/user/userCreateUser400Response' + $ref: '#/components/schemas/user/userCreateUser400Response' '406': description: Not Acceptable. User already exists. content: application/json: schema: - '$ref': '#/components/schemas/user/userCreateUser406Exist' - '/user/v1/account/login': + $ref: '#/components/schemas/user/userCreateUser406Exist' + /user/v1/account/login: post: summary: Login tags: @@ -67,33 +69,37 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/user/userLoginRequest' + $ref: '#/components/schemas/user/userLoginRequest' responses: '200': description: OK. User successfully logged in. content: application/json: schema: - '$ref': '#/components/schemas/user/userLoginResponse' + $ref: '#/components/schemas/user/userLoginResponse' '400': description: Bad Request. Invalid email or password. content: application/json: schema: - '$ref': '#/components/schemas/user/userLoginResponse400' - '/user/v1/account/acceptTermsAndCondition': + $ref: '#/components/schemas/user/userLoginResponse400' + /user/v1/account/acceptTermsAndCondition: patch: summary: Terms & Condition tags: - Depreciated APIs - description: | - This API sets the 'email_verified' field to true using only the X-auth-token. + description: > + This API sets the 'email_verified' field to true using only the + X-auth-token. + - Endpoint: `/user/v1/account/acceptTermsAndCondition` + - Requires a valid X-auth-token from the login API response. parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: @@ -104,27 +110,33 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/user/acceptTermsAndConditionResponse' + $ref: '#/components/schemas/user/acceptTermsAndConditionResponse' '400': description: Bad Request. User does not exist or invalid input. content: application/json: schema: - '$ref': '#/components/schemas/user/acceptTermsAndConditionResponse400' - '/user/v1/account/generateToken': + $ref: '#/components/schemas/user/acceptTermsAndConditionResponse400' + /user/v1/account/generateToken: post: summary: Generate Access Token tags: - User APIs - description: | - This API is for re-login and generating an access token from a refresh token. + description: > + This API is for re-login and generating an access token from a refresh + token. + - Endpoint for generating token `/user/v1/account/generateToken` + - Mandatory parameters marked as `required` must have valid values. + - Parameters cannot be empty or null. parameters: - name: X-auth-token in: header - description: To use the API, you require X-auth-token, available in the login API response. + description: >- + To use the API, you require X-auth-token, available in the login API + response. required: true schema: type: string @@ -132,33 +144,33 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/user/generateTokenRequest' + $ref: '#/components/schemas/user/generateTokenRequest' responses: '200': description: OK. Access token generated successfully. content: application/json: schema: - '$ref': '#/components/schemas/user/generateTokenResponse200' + $ref: '#/components/schemas/user/generateTokenResponse200' '400': description: Bad Request. Invalid input or missing required parameters. content: application/json: schema: - '$ref': '#/components/schemas/user/generateTokenResponse400' + $ref: '#/components/schemas/user/generateTokenResponse400' '401': description: Unauthorized. X-auth-token is either missing or invalid. content: application/json: schema: - '$ref': '#/components/schemas/user/generateTokenResponse401' + $ref: '#/components/schemas/user/generateTokenResponse401' '500': description: Internal Server Error. Something went wrong on the server. content: application/json: schema: - '$ref': '#/components/schemas/user/generateTokenResponse500' - '/user/v1/account/generateOtp': + $ref: '#/components/schemas/user/generateTokenResponse500' + /user/v1/account/generateOtp: post: summary: Generate OTP tags: @@ -171,7 +183,8 @@ paths: parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: @@ -180,27 +193,27 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/user/genrateOtpRequest' + $ref: '#/components/schemas/user/genrateOtpRequest' responses: '200': description: OK. OTP generated successfully. content: application/json: schema: - '$ref': '#/components/schemas/user/generateOtpResponse200' + $ref: '#/components/schemas/user/generateOtpResponse200' '400': description: Bad Request. Invalid input or missing required parameters. content: application/json: schema: - '$ref': '#/components/schemas/user/generateOtpResponse400' + $ref: '#/components/schemas/user/generateOtpResponse400' '500': description: Internal Server Error. Something went wrong on the server. content: application/json: schema: - '$ref': '#/components/schemas/user/generateOtpResponse500' - '/user/v1/account/resetPassword': + $ref: '#/components/schemas/user/generateOtpResponse500' + /user/v1/account/resetPassword: post: summary: Reset Password tags: @@ -213,7 +226,8 @@ paths: parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: @@ -222,27 +236,27 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/user/resetPasswordRequest' + $ref: '#/components/schemas/user/resetPasswordRequest' responses: '200': description: OK. Password reset successfully. content: application/json: schema: - '$ref': '#/components/schemas/user/resetPasswordResponse200' + $ref: '#/components/schemas/user/resetPasswordResponse200' '400': description: Bad Request. Invalid input or missing required parameters. content: application/json: schema: - '$ref': '#/components/schemas/user/resetPasswordResponse400' + $ref: '#/components/schemas/user/resetPasswordResponse400' '401': description: Unauthorized. X-auth-token is either missing or invalid. content: application/json: schema: - '$ref': '#/components/schemas/user/resetPasswordResponse401' - '/user/v1/account/logout': + $ref: '#/components/schemas/user/resetPasswordResponse401' + /user/v1/account/logout: post: summary: Logout tags: @@ -255,7 +269,8 @@ paths: parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: @@ -264,27 +279,27 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/user/logoutRequest' + $ref: '#/components/schemas/user/logoutRequest' responses: '200': description: OK. Logout successful. content: application/json: schema: - '$ref': '#/components/schemas/user/logoutResponse200' + $ref: '#/components/schemas/user/logoutResponse200' '400': description: Bad Request. Invalid input or missing required parameters. content: application/json: schema: - '$ref': '#/components/schemas/user/logoutResponse400' + $ref: '#/components/schemas/user/logoutResponse400' '401': description: Unauthorized. X-auth-token is either missing or invalid. content: application/json: schema: - '$ref': '#/components/schemas/user/logoutResponse401' - '/user/v1/account/registrationOtp': + $ref: '#/components/schemas/user/logoutResponse401' + /user/v1/account/registrationOtp: post: summary: Registration OTP tags: @@ -297,7 +312,8 @@ paths: parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: @@ -306,27 +322,27 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/user/registrationOtpRequest' + $ref: '#/components/schemas/user/registrationOtpRequest' responses: '200': description: OK. Registration OTP sent successfully. content: application/json: schema: - '$ref': '#/components/schemas/user/registrationOtpResponse200' + $ref: '#/components/schemas/user/registrationOtpResponse200' '400': description: Bad Request. Invalid input or missing required parameters. content: application/json: schema: - '$ref': '#/components/schemas/user/registrationOtp400Response' + $ref: '#/components/schemas/user/registrationOtp400Response' '406': description: Not Acceptable. User already exists. content: application/json: schema: - '$ref': '#/components/schemas/user/userCreateUser406Exist' - '/user/v1/account/list': + $ref: '#/components/schemas/user/userCreateUser406Exist' + /user/v1/account/list: get: summary: List user tags: @@ -339,7 +355,8 @@ paths: parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: @@ -378,8 +395,8 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/user/userList200Response' - '/user/v1/user/read/{userId}': + $ref: '#/components/schemas/user/userList200Response' + /user/v1/user/read/{userId}: get: summary: User Details tags: @@ -392,13 +409,14 @@ paths: parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: type: string - in: path - name: 'userId' + name: userId required: true description: Please append a valid User ID to the Request URL. schema: @@ -410,15 +428,15 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/profile/profileDetailsResponse200' + $ref: '#/components/schemas/profile/profileDetailsResponse200' '401': description: Unauthorized. X-auth-token is either missing or invalid. content: content: application/json: schema: - '$ref': '#/components/schemas/profile/Unauthorized401Response' - '/user/v1/user/update': + $ref: '#/components/schemas/profile/Unauthorized401Response' + /user/v1/user/update: patch: summary: Update User Profile tags: @@ -431,7 +449,8 @@ paths: parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: @@ -440,40 +459,45 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/profile/updateRequest' + $ref: '#/components/schemas/profile/updateRequest' responses: '200': description: OK. User profile updated successfully. content: application/json: schema: - '$ref': '#/components/schemas/profile/updateRequest200Response' + $ref: '#/components/schemas/profile/updateRequest200Response' '401': description: Unauthorized. X-auth-token is either missing or invalid. content: application/json: schema: - '$ref': '#/components/schemas/profile/Unauthorized401Response' - '/user/v1/user/share/{userId}': + $ref: '#/components/schemas/profile/Unauthorized401Response' + /user/v1/user/share/{userId}: get: summary: Share Mentor Profile tags: - Users APIs - description: | + description: > This API is associated with sharing a mentor's profile. - - Endpoint for sharing a mentor's profile: `/user/v1/user/share/{userId}` + + - Endpoint for sharing a mentor's profile: + `/user/v1/user/share/{userId}` + - Mandatory parameters marked as `required` must have valid values. + - Parameters cannot be empty or null. parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: type: string - in: path - name: 'userId' + name: userId required: true description: Please append a valid User ID to the Request URL. schema: @@ -485,41 +509,49 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/profile/shareMentorProfile200Response' + $ref: '#/components/schemas/profile/shareMentorProfile200Response' '400': description: Bad Request. Invalid parameters in the request. content: application/json: schema: - '$ref': '#/components/schemas/profile/shareMentorProfileBadRequest400Response' + $ref: >- + #/components/schemas/profile/shareMentorProfileBadRequest400Response '401': description: Unauthorized. X-auth-token is either missing or invalid. content: application/json: schema: - '$ref': '#/components/schemas/profile/Unauthorized401Response' - '/user/v1/cloud-services/file/getSignedUrl?fileName={file_name}': + $ref: '#/components/schemas/profile/Unauthorized401Response' + /user/v1/cloud-services/file/getSignedUrl?fileName={file_name}: get: summary: Cloud Services - Get Signed URL tags: - Cloud Services APIs - description: | + description: > This API is associated with cloud services for obtaining a signed URL. - - Endpoint for cloud services: `/user/v1/cloud-services/file/getSignedUrl` + + - Endpoint for cloud services: + `/user/v1/cloud-services/file/getSignedUrl` + - Mandatory parameters marked as `required` must have valid values. + - Parameters cannot be empty or null. parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: type: string - in: path - name: 'file_name' + name: file_name required: true - description: Please append a valid file name to the URL, indicating the file to be uploaded. + description: >- + Please append a valid file name to the URL, indicating the file to + be uploaded. schema: type: string example: image.jpg @@ -529,29 +561,37 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/cloudServices/cloudServicesResponse200' - '/user/v1/cloud-services/file/getDownloadableUrl?file_path={file_path}': + $ref: '#/components/schemas/cloudServices/cloudServicesResponse200' + /user/v1/cloud-services/file/getDownloadableUrl?file_path={file_path}: get: summary: Cloud Services - Get Downloadable URL tags: - Cloud Services APIs - description: | - This API is associated with cloud services for obtaining a downloadable URL. - - Endpoint for cloud services: `/user/v1/cloud-services/file/getDownloadableUrl` + description: > + This API is associated with cloud services for obtaining a downloadable + URL. + + - Endpoint for cloud services: + `/user/v1/cloud-services/file/getDownloadableUrl` + - Mandatory parameters marked as `required` must have valid values. + - Parameters cannot be empty or null. parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: type: string - in: path - name: 'file_path' + name: file_path required: true - description: Please append a valid file path to the URL, indicating the file to be downloaded. + description: >- + Please append a valid file path to the URL, indicating the file to + be downloaded. schema: type: string example: users/62832531a05cbd57b273aebb-1654149589875-image.jpg @@ -561,21 +601,28 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/cloudServices/cloudServicesDownloadResponse200' - '/user/v1/cloud-services/file/getSampleCSV': + $ref: >- + #/components/schemas/cloudServices/cloudServicesDownloadResponse200 + /user/v1/cloud-services/file/getSampleCSV: get: summary: Cloud Services - Get Sample CSV tags: - Cloud Services APIs - description: | - This API is associated with cloud services for obtaining a sample CSV file for bulk user create. - - Endpoint for cloud services: `/user/v1/cloud-services/file/getSampleCSV` + description: > + This API is associated with cloud services for obtaining a sample CSV + file for bulk user create. + + - Endpoint for cloud services: + `/user/v1/cloud-services/file/getSampleCSV` + - Mandatory parameters marked as `required` must have valid values. + - Parameters cannot be empty or null. parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: @@ -586,8 +633,8 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/cloudServices/getSampleCSVResponse200' - '/user/v1/form/create': + $ref: '#/components/schemas/cloudServices/getSampleCSVResponse200' + /user/v1/form/create: post: summary: Create Form tags: @@ -600,7 +647,8 @@ paths: parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: @@ -609,21 +657,21 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/form/createFormRequest' + $ref: '#/components/schemas/form/createFormRequest' responses: '200': description: OK. Form created successfully. content: application/json: schema: - '$ref': '#/components/schemas/form/createForm200Response' + $ref: '#/components/schemas/form/createForm200Response' '400': description: Bad Request. Invalid input data. content: application/json: schema: - '$ref': '#/components/schemas/form/createForm400Response' - '/user/v1/form/update/{formId}': + $ref: '#/components/schemas/form/createForm400Response' + /user/v1/form/update/{formId}: patch: summary: Update Form tags: @@ -636,13 +684,14 @@ paths: parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: type: string - in: path - name: 'formId' + name: formId required: true description: Please append a valid form ID to the request URL. schema: @@ -652,40 +701,45 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/form/updateFormRequest' + $ref: '#/components/schemas/form/updateFormRequest' responses: '200': description: OK. Form updated successfully. content: application/json: schema: - '$ref': '#/components/schemas/form/updateForm200Response' + $ref: '#/components/schemas/form/updateForm200Response' '400': description: Bad Request. Invalid input or missing required parameters. content: application/json: schema: - '$ref': '#/components/schemas/form/updateForm400Response' - '/user/v1/form/read/{formId}': + $ref: '#/components/schemas/form/updateForm400Response' + /user/v1/form/read/{formId}: post: summary: Get Form Details tags: - Form APIs - description: | + description: > This API is associated with retrieving form details. + - Endpoint for retrieving form details: `/user/v1/form/read/{formId}` - - It is mandatory to provide values for parameters marked with `required`. + + - It is mandatory to provide values for parameters marked with + `required`. + - Mandatory parameters cannot be empty or null. parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: type: string - in: path - name: 'formId' + name: formId required: true description: Please append a valid form Id to the Request URL. schema: @@ -695,21 +749,21 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/form/readFormRequest' + $ref: '#/components/schemas/form/readFormRequest' responses: '200': description: OK. Form details retrieved successfully. content: application/json: schema: - '$ref': '#/components/schemas/form/readForm200Response' + $ref: '#/components/schemas/form/readForm200Response' '400': description: Bad Request. Invalid or missing parameters. content: application/json: schema: - '$ref': '#/components/schemas/form/readForm400Response' - '/user/v1/admin/create': + $ref: '#/components/schemas/form/readForm400Response' + /user/v1/admin/create: post: summary: Create Admin User tags: @@ -723,21 +777,21 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/admin/createSystemUserRequest' + $ref: '#/components/schemas/admin/createSystemUserRequest' responses: '201': description: OK. Admin user created successfully. content: application/json: schema: - '$ref': '#/components/schemas/admin/createSystemUser201Response' + $ref: '#/components/schemas/admin/createSystemUser201Response' '406': description: Bad Request. System User already exists. content: application/json: schema: - '$ref': '#/components/schemas/admin/createSystemUser406Response' - '/user/v1/admin/login': + $ref: '#/components/schemas/admin/createSystemUser406Response' + /user/v1/admin/login: post: summary: Admin Login tags: @@ -751,21 +805,21 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/admin/loginSystemUserRequest' + $ref: '#/components/schemas/admin/loginSystemUserRequest' responses: '200': description: OK. Successful login. content: application/json: schema: - '$ref': '#/components/schemas/admin/loginSystemUser200Response' + $ref: '#/components/schemas/admin/loginSystemUser200Response' '400': description: Bad Request. System User doesn't exist. content: application/json: schema: - '$ref': '#/components/schemas/admin/loginSystemUser400Response' - '/user/v1/admin/deleteUser/{id}': + $ref: '#/components/schemas/admin/loginSystemUser400Response' + /user/v1/admin/deleteUser/{id}: delete: summary: Delete User tags: @@ -778,14 +832,18 @@ paths: parameters: - name: X-auth-token in: header - description: X-auth-token required for API access. Available in login API Response. + description: >- + X-auth-token required for API access. Available in login API + Response. required: true schema: type: string - in: path - name: 'id' + name: id required: true - description: User ID to be deleted. Please append a valid user ID to the request URL. + description: >- + User ID to be deleted. Please append a valid user ID to the request + URL. schema: type: string example: 1 @@ -795,14 +853,14 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/admin/deleteUser202Response' + $ref: '#/components/schemas/admin/deleteUser202Response' '400': description: Bad Request. User Already Deleted. content: application/json: schema: - '$ref': '#/components/schemas/admin/deleteUser400Response' - '/user/admin/addOrgAdmin': + $ref: '#/components/schemas/admin/deleteUser400Response' + /user/admin/addOrgAdmin: post: summary: Add Organization Admin description: | @@ -815,7 +873,9 @@ paths: parameters: - name: X-auth-token in: header - description: X-auth-token required for API access. Available in login API Response. + description: >- + X-auth-token required for API access. Available in login API + Response. required: true schema: type: string @@ -833,7 +893,9 @@ paths: organization_id: type: integer example: 55 - description: The ID of the organization to which the user will be assigned as Org-Admin. + description: >- + The ID of the organization to which the user will be + assigned as Org-Admin. responses: '200': description: OK. User assigned as the Org-Admin successfully. @@ -844,10 +906,10 @@ paths: properties: responseCode: type: string - example: 'OK' + example: OK message: type: string - example: 'User Assigned As The Org-Admin Successfully' + example: User Assigned As The Org-Admin Successfully result: type: object properties: @@ -867,24 +929,23 @@ paths: example: 2 title: type: string - example: 'mentor' + example: mentor user_type: type: integer example: 1 status: type: string - example: 'ACTIVE' + example: ACTIVE example: - id: 2 - title: 'mentor' + title: mentor user_type: 0 - status: 'ACTIVE' + status: ACTIVE - id: 3 - title: 'org_admin' + title: org_admin user_type: 0 - status: 'ACTIVE' - - '/user/v1/admin/deactivateOrg/{id}': + status: ACTIVE + /user/v1/admin/deactivateOrg/{id}: post: summary: Deactivate Organization tags: @@ -897,12 +958,14 @@ paths: parameters: - name: X-auth-token in: header - description: X-auth-token required for API access. Available in login API Response. + description: >- + X-auth-token required for API access. Available in login API + Response. required: true schema: type: string - in: path - name: 'id' + name: id required: true description: Please append a valid organization ID to the request URL. schema: @@ -914,15 +977,14 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/admin/deleteOrg202Response' + $ref: '#/components/schemas/admin/deleteOrg202Response' '400': description: Bad Request. Organization Entity Already Deleted. content: application/json: schema: - '$ref': '#/components/schemas/admin/deleteUser400Response' - - '/user/v1/admin/deactivateUser': + $ref: '#/components/schemas/admin/deleteUser400Response' + /user/v1/admin/deactivateUser: post: summary: Deactivate User tags: @@ -935,7 +997,9 @@ paths: parameters: - name: X-auth-token in: header - description: X-auth-token required for API access. Available in login API Response. + description: >- + X-auth-token required for API access. Available in login API + Response. required: true schema: type: string @@ -950,22 +1014,23 @@ paths: type: array items: type: integer - example: [1, 3] + example: + - 1 + - 3 responses: '202': description: Accepted. Users deactivated successfully. content: application/json: schema: - '$ref': '#/components/schemas/admin/deactivateUser202Response' + $ref: '#/components/schemas/admin/deactivateUser202Response' '400': description: Bad Request. User Entity Already Deleted. content: application/json: schema: - '$ref': '#/components/schemas/admin/deactivateUser400Response' - - '/user/v1/organization/create': + $ref: '#/components/schemas/admin/deactivateUser400Response' + /user/v1/organization/create: post: summary: Create Organization tags: @@ -979,7 +1044,9 @@ paths: parameters: - name: X-auth-token in: header - description: X-auth-token required for API access. Available in the login API Response. + description: >- + X-auth-token required for API access. Available in the login API + Response. required: true schema: type: string @@ -987,36 +1054,43 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/organization/createOrganizationRequest' + $ref: '#/components/schemas/organization/createOrganizationRequest' responses: '200': description: OK. Organization created successfully. content: application/json: schema: - '$ref': '#/components/schemas/organization/createOrganization200Response' + $ref: >- + #/components/schemas/organization/createOrganization200Response '400': description: Bad Request. Organization already exists content: application/json: schema: - '$ref': '#/components/schemas/organization/createOrganization400Response' - - '/user/v1/organization/update/{id}': + $ref: >- + #/components/schemas/organization/createOrganization400Response + /user/v1/organization/update/{id}: post: summary: Update Organization tags: - Organization - description: | + description: > This API is associated with updating an organization. + - Endpoint for updating organization: `/user/v1/organization/update` - - It is mandatory to provide values for parameters marked with `required`. + + - It is mandatory to provide values for parameters marked with + `required`. + - Mandatory parameters cannot be empty or null. operationId: updateOrganization parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is available in the login API response. + description: >- + To make use of the API, you require X-auth-token. This is available + in the login API response. required: true schema: type: string @@ -1031,35 +1105,42 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/organization/createOrganizationRequest' + $ref: '#/components/schemas/organization/createOrganizationRequest' responses: '200': description: OK. Organization updated successfully. content: application/json: schema: - '$ref': '#/components/schemas/organization/updateOrganization200Response' + $ref: >- + #/components/schemas/organization/updateOrganization200Response '400': description: Bad Request. Organization doesn't exist. content: application/json: schema: - '$ref': '#/components/schemas/organization/updateOrganization400Response' - - '/user/v1/organization/list': + $ref: >- + #/components/schemas/organization/updateOrganization400Response + /user/v1/organization/list: get: summary: List Organization tags: - Organization - description: | - This API is associated with listing organizations based on specified conditions. + description: > + This API is associated with listing organizations based on specified + conditions. + - Endpoint for listing organizations: `/user/v1/organization/list` + - Mandatory parameters marked as `required` must have valid values. + - Parameters cannot be empty or null. parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is available in the login API response. + description: >- + To make use of the API, you require X-auth-token. This is available + in the login API response. required: true schema: type: string @@ -1090,13 +1171,14 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/organization/organizationList200Response' - - '/user/v1/organization/requestOrgRole': + $ref: '#/components/schemas/organization/organizationList200Response' + /user/v1/organization/requestOrgRole: post: summary: Request Org Role - description: | - This API is associated with requesting a specific role within an organization. + description: > + This API is associated with requesting a specific role within an + organization. + - Endpoint: `/user/v1/organization/requestOrgRole` - Mandatory parameters marked as `required` must have valid values. @@ -1107,7 +1189,9 @@ paths: parameters: - name: X-auth-token in: header - description: User's access token, which already recognizes the user as the organization's mentee. + description: >- + User's access token, which already recognizes the user as the + organization's mentee. required: true schema: type: string @@ -1137,20 +1221,22 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/organization/requestOrgRole200Response' - - '/user/v1/userRole/list': + $ref: '#/components/schemas/organization/requestOrgRole200Response' + /user/v1/userRole/list: get: summary: Get User Roles tags: - - User Role APIs - description: | + - User Roles APIs + description: > Retrieve the list of user roles. + - Endpoint: `/user/v1/userRole/list` + - It is mandatory to provide values for parameters marked as `required`. - - The X-auth-token obtained from the login API is required in the header. + - The X-auth-token obtained from the login API is required in the + header. parameters: - name: X-auth-token in: header @@ -1277,7 +1363,9 @@ paths: parameters: - name: X-auth-token in: header - description: Access token of the user who is already a mentee of the organization. + description: >- + Access token of the user who is already a mentee of the + organization. required: true schema: type: string @@ -1285,33 +1373,31 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/entity-type/createEntityTypeRequest' + $ref: '#/components/schemas/entity-type/createEntityTypeRequest' responses: '201': description: OK Entity type created successfully content: application/json: schema: - '$ref': '#/components/schemas/entity-type/createEntityType201Response' + $ref: '#/components/schemas/entity-type/createEntityType201Response' '400': description: Bad Request. Entity type already exists content: application/json: schema: - '$ref': '#/components/schemas/entity-type/createEntityType400Response' - '/user/v1/entity-type/update/{id}': + $ref: '#/components/schemas/entity-type/createEntityType400Response' + /user/v1/entity-type/update/{id}: post: summary: Update Entity Type - tags: - - EntityType APIs + tags: [] description: | Use this API to update an entity type. - Endpoint: `/user/v1/entity-type/update/{id}` - Provide values for parameters marked as `required`. - The X-auth-token is mandatory and cannot be empty or null. - - parameters: + parameters: &ref_3 - name: X-auth-token in: header description: Access token obtained from the login API response. @@ -1325,27 +1411,25 @@ paths: schema: type: integer example: 1 - requestBody: content: application/json: schema: - '$ref': '#/components/schemas/entity-type/updateEntityTypeRequest' - + $ref: '#/components/schemas/entity-type/updateEntityTypeRequest' responses: '201': description: OK. Entity Type Updated Successfully content: application/json: schema: - '$ref': '#/components/schemas/entity-type/updateEntityType201Response' + $ref: '#/components/schemas/entity-type/updateEntityType201Response' '400': description: Bad Request. Entity type already exists content: application/json: schema: - '$ref': '#/components/schemas/entity-type/updateEntityType400Response' - '/user/v1/entity-type/read': + $ref: '#/components/schemas/entity-type/updateEntityType400Response' + /user/v1/entity-type/read: post: summary: Read Entity Type tags: @@ -1359,7 +1443,8 @@ paths: parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: @@ -1384,7 +1469,7 @@ paths: - ln read_user_entity: false responses: - 201: + '201': description: OK Entity Type Fetched Successfully content: application.json: @@ -1486,26 +1571,28 @@ paths: meta: correlation: 64cd08ba-cc87-4172-9633-2146dabe0b78 meeting_platform: BBB - 400: + '400': description: Bad Request. Entity type already exists content: application/json: schema: - '$ref': '#/components/schemas/userentity/createUserEntity400Response' - '/user/v1/entity-type/delete/{id}': + $ref: '#/components/schemas/userentity/createUserEntity400Response' + /user/v1/entity-type/delete/{id}: delete: summary: Delete Entity Type tags: - EntityType APIs description: > - This API is associated with deleting an entity type. - - Endpoint for deleting a user entity: `/user/v1/entity-type/delete` - - It is mandatory to provide values for parameters marked with `required`. - - Mandatory parameters cannot be empty or null. + This API is associated with deleting an entity type. - Endpoint for + deleting a user entity: `/user/v1/entity-type/delete` - It is mandatory + to provide values for parameters marked with `required`. - Mandatory + parameters cannot be empty or null. parameters: - name: X-auth-token in: header - description: To use the API, include X-auth-token. This is available in the login API response. + description: >- + To use the API, include X-auth-token. This is available in the login + API response. required: true schema: type: string @@ -1522,28 +1609,32 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/entity-type/deleteUserEntity202Response' + $ref: '#/components/schemas/entity-type/deleteUserEntity202Response' '400': description: Bad Request. Entity Not Found content: application/json: schema: - '$ref': '#/components/schemas/entity-type/deleteUserEntity400Response' - - '/user/v1/entity/create': + $ref: '#/components/schemas/entity-type/deleteUserEntity400Response' + /user/v1/entity/create: post: summary: Create Entity tags: - Entity APIs - description: | + description: > This API is associated with entity creation. + - Endpoint for creating an entity: `/user/v1/entity/create`. - - It is mandatory to provide values for parameters marked with `required`. + + - It is mandatory to provide values for parameters marked with + `required`. + - Mandatory parameters cannot be empty or null. parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: @@ -1552,9 +1643,9 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/userentity/createUserEntityRequest' + $ref: '#/components/schemas/userentity/createUserEntityRequest' responses: - 201: + '201': description: OK. Created content: application.json: @@ -1623,33 +1714,37 @@ paths: formsVersion: [] correlation: 6191e4d4-438b-4609-8de6-da3694b506b1 meeting_platform: BBB - 400: + '400': description: Bad Request. User Entity already exists content: application/json: schema: - '$ref': '#/components/schemas/userentity/createUserEntity400Response' - '/user/v1/entity/update/{id}': + $ref: '#/components/schemas/userentity/createUserEntity400Response' + /user/v1/entity/update/{id}: patch: summary: Update Entity tags: - Entity APIs - description: | + description: > This API is associated with updating an entity. - Endpoint for updating an entity: `/user/v1/entity/update`. - - It is mandatory to provide values for parameters marked with `required`. + + - It is mandatory to provide values for parameters marked with + `required`. + - Mandatory parameters cannot be empty or null. parameters: - name: X-auth-token in: header - description: To make use of the API, you require X-auth-token. This is Available + description: >- + To make use of the API, you require X-auth-token. This is Available in login API Response. required: true schema: type: string - in: path - name: 'id' + name: id required: true description: Please append a valid user entity ID to the request URL. schema: @@ -1763,21 +1858,28 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/userentity/updateUserEntity400Response' - '/user/v1/entity/read?id={id}': + $ref: '#/components/schemas/userentity/updateUserEntity400Response' + /user/v1/entity/read?id={id}: get: summary: Read User Entity tags: - Entity APIs - description: | - This API is associated with retrieving a user entity based on ID or value. + description: > + This API is associated with retrieving a user entity based on ID or + value. + - Endpoint for retrieving a user entity: `/user/v1/entity/read`. - - It is mandatory to provide values for parameters marked with `required`. + + - It is mandatory to provide values for parameters marked with + `required`. + - Mandatory parameters cannot be empty or null. parameters: - name: X-auth-token in: header - description: To use the API, include X-auth-token. This is available in the login API response. + description: >- + To use the API, include X-auth-token. This is available in the login + API response. required: true schema: type: string @@ -1794,30 +1896,35 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/userentity/readUserEntity200Response' - - '/user/v1/entity/delete/{id}': + $ref: '#/components/schemas/userentity/readUserEntity200Response' + /user/v1/entity/delete/{id}: delete: summary: Delete Entity - tags: - - Entity APIs - description: | + tags: [] + description: > This API is associated with deleting an entity. + - Endpoint for deleting a user entity: `/user/v1/entity/delete`. - - It is mandatory to provide values for parameters marked with `required`. + + - It is mandatory to provide values for parameters marked with + `required`. + - Mandatory parameters cannot be empty or null. parameters: - - name: X-auth-token + - &ref_4 + name: X-auth-token in: header - description: To use the API, include X-auth-token. This is available in the login API response. + description: >- + To use the API, include X-auth-token. This is available in the login + API response. required: true schema: type: string - in: path - name: 'id' + name: id required: true description: Please append a valid user entity ID to the request URL. - schema: + schema: &ref_5 type: integer example: 31 responses: @@ -1826,21 +1933,24 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/userentity/deleteUserEntity202Response' + $ref: '#/components/schemas/userentity/deleteUserEntity202Response' '400': description: Bad Request. User Entity Already Deleted content: application/json: schema: - '$ref': '#/components/schemas/userentity/deleteUserEntity400Response' - - '/user/v1/org-admin/getRequests': + $ref: '#/components/schemas/userentity/deleteUserEntity400Response' + /user/v1/org-admin/getRequests: post: summary: Get Requests - description: | + description: > Get a list of organization requests based on specified filters + - Endpoint: `/user/v1/org-admin/getRequests`. - - It is mandatory to provide values for parameters marked with `required`. + + - It is mandatory to provide values for parameters marked with + `required`. + - Mandatory parameters cannot be empty or null. tags: - Org Admin APIs @@ -1927,13 +2037,17 @@ paths: name: Jake email: jake@gmail.com count: 12 - '/user/v1/org-admin/updateRequestStatus': + /user/v1/org-admin/updateRequestStatus: post: summary: Update Request Status - description: | + description: > Update the status of an organization request. + - Endpoint: `/user/v1/org-admin/updateRequestStatus`. - - It is mandatory to provide values for parameters marked with `required`. + + - It is mandatory to provide values for parameters marked with + `required`. + - Mandatory parameters cannot be empty or null. tags: - Org Admin APIs @@ -1963,7 +2077,10 @@ paths: description: Comments related to the request status update. status: type: string - enum: [APPROVED, REJECTED, UNDER_REVIEW] + enum: + - APPROVED + - REJECTED + - UNDER_REVIEW example: APPROVED description: The new status for the organization request. responses: @@ -1983,14 +2100,17 @@ paths: requester: id: 23 name: Jake - - '/user/v1/org-admin/getRequestDetails': + /user/v1/org-admin/getRequestDetails: get: summary: Get Request Details - description: | + description: > Get details of a specific organization request. + - Endpoint: `/user/v1/org-admin/getRequestDetails`. - - It is mandatory to provide values for parameters marked with `required`. + + - It is mandatory to provide values for parameters marked with + `required`. + - Mandatory parameters cannot be empty or null. tags: - Org Admin APIs @@ -2033,23 +2153,25 @@ paths: - Temp 1 - Temp 2 meta: {} - - '/user/v1/org-admin/bulkUserCreate': + /user/v1/org-admin/bulkUserCreate: post: summary: Bulk User Create - description: | + description: > Create multiple users in bulk using a CSV file. + - Endpoint: `/user/v1/org-admin/bulkUserCreate`. - - It is mandatory to provide values for parameters marked with `required`. + + - It is mandatory to provide values for parameters marked with + `required`. + - Mandatory parameters cannot be empty or null. - tags: - - Org Admin APIs + tags: [] parameters: - name: X-auth-token in: header description: Access token of the org admin. required: true - schema: + schema: &ref_2 type: string requestBody: required: true @@ -2078,15 +2200,17 @@ paths: type: text/csv updated_at: '2023-09-20T12:00:46.533Z' created_at: '2023-09-20T12:00:46.533Z' - - '/user/v1/org-admin/getBulkInvitesFilesList': + /user/v1/org-admin/getBulkInvitesFilesList: get: summary: Get Bulk Invite Files List - description: | + description: > Get a list of uploaded bulk invite CSV files. - Endpoint: `/user/v1/org-admin/getBulkInvitesFilesList`. - - It is mandatory to provide values for parameters marked with `required`. + + - It is mandatory to provide values for parameters marked with + `required`. + - Mandatory parameters cannot be empty or null. tags: - Org Admin APIs @@ -2115,7 +2239,10 @@ paths: required: true schema: type: string - enum: [uploaded, processed, failed] + enum: + - uploaded + - processed + - failed example: uploaded responses: '200': @@ -2142,14 +2269,17 @@ paths: type: text/csv output_path: count: 2 - - '/user/v1/org-admin/deactivateUser/{id}': + /user/v1/org-admin/deactivateUser/{id}: post: summary: Deactivate User - description: | + description: > Deactivate a user + - Endpoint: `/user/v1/org-admin/deactivateUser`. - - It is mandatory to provide values for parameters marked with `required`. + + - It is mandatory to provide values for parameters marked with + `required`. + - Mandatory parameters cannot be empty or null. tags: - Org Admin APIs @@ -2173,21 +2303,24 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/admin/deactivateUser202Response' + $ref: '#/components/schemas/admin/deactivateUser202Response' '400': description: Bad Request. User Entity Already Deleted content: application/json: schema: - '$ref': '#/components/schemas/admin/deactivateUser400Response' - - '/user/v1/org-admin/inheritEntityType': + $ref: '#/components/schemas/admin/deactivateUser400Response' + /user/v1/org-admin/inheritEntityType: post: summary: Inherit Entity Type - description: | + description: > Inherit entity type. + - Endpoint: `/user/v1/org-admin/inheritEntityType`. - - It is mandatory to provide values for parameters marked with `required`. + + - It is mandatory to provide values for parameters marked with + `required`. + - Mandatory parameters cannot be empty or null. tags: - Org Admin APIs @@ -2202,36 +2335,41 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/org-admin/inheritEntityTypeRequest' + $ref: '#/components/schemas/org-admin/inheritEntityTypeRequest' responses: '202': description: Accepted content: application/json: schema: - '$ref': '#/components/schemas/org-admin/inheritEntityType202Response' + $ref: '#/components/schemas/org-admin/inheritEntityType202Response' '400': description: Bad Request. User Entity Already Deleted content: application/json: schema: - '$ref': '#/components/schemas/notification/createNotification400Response' - - '/user/v1/notification/template': + $ref: >- + #/components/schemas/notification/createNotification400Response + /user/v1/notification/template: post: summary: Create, Update, and Delete Notification tags: - Notification APIs - description: | + description: > This API is associated with notification create or update. - Endpoint: `/user/v1/notification/template`. - - It is mandatory to provide values for parameters marked with `required`. + + - It is mandatory to provide values for parameters marked with + `required`. + - Mandatory parameters cannot be empty or null. parameters: - name: X-auth-token in: header - description: Access token required to use the API. Available in the login API response. + description: >- + Access token required to use the API. Available in the login API + response. required: true schema: type: string @@ -2239,14 +2377,15 @@ paths: content: application/json: schema: - '$ref': '#/components/schemas/notification/createNotificationRequest' + $ref: '#/components/schemas/notification/createNotificationRequest' responses: '202': description: Accepted content: application/json: schema: - '$ref': '#/components/schemas/notification/createNotification200Response' + $ref: >- + #/components/schemas/notification/createNotification200Response '400': description: Bad Request. content: @@ -2273,7 +2412,7 @@ paths: in: header description: Access token of the user required: true - schema: 'ref_2' + schema: *ref_2 requestBody: required: true content: @@ -2366,7 +2505,7 @@ paths: - Endpoint: `/user/v1/userRole/update/{id}` - Provide values for parameters marked as `required`. - The X-auth-token is mandatory and cannot be empty or null. - parameters: 'ref_3' + parameters: *ref_3 requestBody: content: application/json: @@ -2462,12 +2601,12 @@ paths: - Mandatory parameters cannot be empty or null. parameters: - - 'ref_4' + - *ref_4 - in: path name: id required: true description: Please append a valid user role ID to the request URL. - schema: 'ref_5' + schema: *ref_5 example: 31 responses: '202': @@ -2539,7 +2678,9 @@ components: example: OK message: type: string - example: OTP has been sent to your registered email ID. Please enter the otp to complete the registration process. + example: >- + OTP has been sent to your registered email ID. Please enter the + otp to complete the registration process. result: type: array items: @@ -2551,13 +2692,13 @@ components: properties: name: type: string - example: 'Anu' + example: Anu email: type: string - example: 'anu@gmail.com' + example: anu@gmail.com password: type: string - example: 'password' + example: password userCreateUserRequest: description: User program and solution request type: object @@ -2608,10 +2749,10 @@ components: properties: access_token: type: string - example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' + example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... refresh_token: type: string - example: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' + example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9... user: type: object properties: @@ -2728,10 +2869,12 @@ components: properties: access_token: type: string - example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImlkIjo3LCJlbWFpbCI6ImhpbGJlcnQyOUB5YWhvby5jb20iLCJuYW1lIjoiQWRlbGlhIiwicm9sZXMiOlt7ImlkIjoyLCJ0aXRsZSI6Im1lbnRvciIsInVzZXJfdHlwZSI6MCwic3RhdHVzIjoiYWN0aXZlIn1dfSwiaWF0IjoxNjkwMjg2Nzg2LCJleHAiOjE2OTAzNzMxODZ9.0_Yi8yEu_G04VNJvVvafWMvO-Eb9TVsoCnp_pfrFVi8 + example: >- + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImlkIjo3LCJlbWFpbCI6ImhpbGJlcnQyOUB5YWhvby5jb20iLCJuYW1lIjoiQWRlbGlhIiwicm9sZXMiOlt7ImlkIjoyLCJ0aXRsZSI6Im1lbnRvciIsInVzZXJfdHlwZSI6MCwic3RhdHVzIjoiYWN0aXZlIn1dfSwiaWF0IjoxNjkwMjg2Nzg2LCJleHAiOjE2OTAzNzMxODZ9.0_Yi8yEu_G04VNJvVvafWMvO-Eb9TVsoCnp_pfrFVi8 refresh_token: type: string - example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImlkIjo3LCJlbWFpbCI6ImhpbGJlcnQyOUB5YWhvby5jb20iLCJuYW1lIjoiQWRlbGlhIiwicm9sZXMiOlt7ImlkIjoyLCJ0aXRsZSI6Im1lbnRvciIsInVzZXJfdHlwZSI6MCwic3RhdHVzIjoiYWN0aXZlIn1dfSwiaWF0IjoxNjkwMjg2Nzg2LCJleHAiOjE3MDYwOTc5ODZ9.quHyyjz4DEc7rvKpxwzaiRyRKFkqrbTb8tNB5zX0eF0 + example: >- + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImlkIjo3LCJlbWFpbCI6ImhpbGJlcnQyOUB5YWhvby5jb20iLCJuYW1lIjoiQWRlbGlhIiwicm9sZXMiOlt7ImlkIjoyLCJ0aXRsZSI6Im1lbnRvciIsInVzZXJfdHlwZSI6MCwic3RhdHVzIjoiYWN0aXZlIn1dfSwiaWF0IjoxNjkwMjg2Nzg2LCJleHAiOjE3MDYwOTc5ODZ9.quHyyjz4DEc7rvKpxwzaiRyRKFkqrbTb8tNB5zX0eF0 user: type: object properties: @@ -2779,7 +2922,7 @@ components: last_logged_in_at: type: string format: date-time - example: 2023-07-25T11:50:35.044Z + example: '2023-07-25T11:50:35.044Z' has_accepted_terms_and_conditions: type: boolean example: true @@ -2822,7 +2965,8 @@ components: type: array items: type: number - example: [2] + example: + - 2 image: type: string example: https://cloudstorage.com/container/abc.png @@ -2831,10 +2975,10 @@ components: example: null created_at: type: string - example: 2023-07-24T14:37:56.393Z + example: '2023-07-24T14:37:56.393Z' updated_at: type: string - example: 2023-07-25T11:50:35.044Z + example: '2023-07-25T11:50:35.044Z' user_roles: type: array items: @@ -2906,7 +3050,8 @@ components: refresh_token: type: string description: Refresh token. - example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyODMyNTMxYTA1Y2JkNTdiMjczYWViYiIsImVtYWlsIjoiYW5raXQuc0BwYWNld2lzZG9tLmNvbSIsIm5hbWUiOiJBbmtpdCIsImlzQU1lbnRvciI6dHJ1ZX0sImlhdCI6MTY1MzAxMDYxNCwiZXhwIjoxNjY4ODIxODE0fQ.hrIiKz3envHDPauVXSmA_BO_KKzWJAePsP3xD8l851s + example: >- + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyODMyNTMxYTA1Y2JkNTdiMjczYWViYiIsImVtYWlsIjoiYW5raXQuc0BwYWNld2lzZG9tLmNvbSIsIm5hbWUiOiJBbmtpdCIsImlzQU1lbnRvciI6dHJ1ZX0sImlhdCI6MTY1MzAxMDYxNCwiZXhwIjoxNjY4ODIxODE0fQ.hrIiKz3envHDPauVXSmA_BO_KKzWJAePsP3xD8l851s generateTokenResponse200: description: OK. Access token has been generated successfully. type: object @@ -2922,7 +3067,8 @@ components: properties: access_token: type: string - example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyODMyNTMxYTA1Y2JkNTdiMjczYWViYiIsImVtYWlsIjoiYW5raXQuc0BwYWNld2lzZG9tLmNvbSIsIm5hbWUiOiJBbmtpdCIsImlzQU1lbnRvciI6dHJ1ZX0sImlhdCI6MTY1MzAxMDk4NCwiZXhwIjoxNjUzMDk3Mzg0fQ.BOZ_d6xNxuAJZ1ubdj94mCeO4jwXsC7t9JT4KXECVN + example: >- + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyODMyNTMxYTA1Y2JkNTdiMjczYWViYiIsImVtYWlsIjoiYW5raXQuc0BwYWNld2lzZG9tLmNvbSIsIm5hbWUiOiJBbmtpdCIsImlzQU1lbnRvciI6dHJ1ZX0sImlhdCI6MTY1MzAxMDk4NCwiZXhwIjoxNjUzMDk3Mzg0fQ.BOZ_d6xNxuAJZ1ubdj94mCeO4jwXsC7t9JT4KXECVN generateTokenResponse400: description: Bad Request type: object @@ -2992,7 +3138,9 @@ components: example: OK message: type: string - example: OTP has been sent to your registered email ID. Please enter the number to update your password. + example: >- + OTP has been sent to your registered email ID. Please enter the + number to update your password. result: type: array items: @@ -3063,10 +3211,12 @@ components: properties: access_token: type: string - example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImlkIjo5LCJlbWFpbCI6ImJyYW5keW4udGVycnlAeWFob28uY29tIiwibmFtZSI6IkFzaGx5Iiwicm9sZXMiOlt7ImlkIjoyLCJ0aXRsZSI6Im1lbnRvciIsInVzZXJfdHlwZSI6MCwic3RhdHVzIjoiYWN0aXZlIn1dfSwiaWF0IjoxNjkwMjg1NzE4LCJleHAiOjE2OTAzNzIxMTh9.WmhUXIocykrBVti7vtznx_BMAaBtuqYUks4sc1J94Do + example: >- + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImlkIjo5LCJlbWFpbCI6ImJyYW5keW4udGVycnlAeWFob28uY29tIiwibmFtZSI6IkFzaGx5Iiwicm9sZXMiOlt7ImlkIjoyLCJ0aXRsZSI6Im1lbnRvciIsInVzZXJfdHlwZSI6MCwic3RhdHVzIjoiYWN0aXZlIn1dfSwiaWF0IjoxNjkwMjg1NzE4LCJleHAiOjE2OTAzNzIxMTh9.WmhUXIocykrBVti7vtznx_BMAaBtuqYUks4sc1J94Do refresh_token: type: string - example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImlkIjo5LCJlbWFpbCI6ImJyYW5keW4udGVycnlAeWFob28uY29tIiwibmFtZSI6IkFzaGx5Iiwicm9sZXMiOlt7ImlkIjoyLCJ0aXRsZSI6Im1lbnRvciIsInVzZXJfdHlwZSI6MCwic3RhdHVzIjoiYWN0aXZlIn1dfSwiaWF0IjoxNjkwMjg1NzE4LCJleHAiOjE3MDYwOTY5MTh9.eqJ-KD0YA-Cdpz3XHWKgmi66uU6o229K9pyp6BwAAzI + example: >- + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImlkIjo5LCJlbWFpbCI6ImJyYW5keW4udGVycnlAeWFob28uY29tIiwibmFtZSI6IkFzaGx5Iiwicm9sZXMiOlt7ImlkIjoyLCJ0aXRsZSI6Im1lbnRvciIsInVzZXJfdHlwZSI6MCwic3RhdHVzIjoiYWN0aXZlIn1dfSwiaWF0IjoxNjkwMjg1NzE4LCJleHAiOjE3MDYwOTY5MTh9.eqJ-KD0YA-Cdpz3XHWKgmi66uU6o229K9pyp6BwAAzI user: type: object properties: @@ -3130,10 +3280,10 @@ components: example: null created_at: type: string - example: 2023-07-25T11:48:38.270Z + example: '2023-07-25T11:48:38.270Z' updated_at: type: string - example: 2023-07-25T11:48:38.270Z + example: '2023-07-25T11:48:38.270Z' user_roles: type: array items: @@ -3190,8 +3340,8 @@ components: refresh_token: type: string description: Refresh token. - example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyODMyNTMxYTA1Y2JkNTdiMjczYWViYiIsImVtYWlsIjoiYW5raXQuc0BwYWNld2lzZG9tLmNvbSIsIm5hbWUiOiJBbmtpdCIsImlzQU1lbnRvciI6dHJ1ZX0sImlhdCI6MTY1MzAxMDYxNCwiZXhwIjoxNjY4ODIxODE0fQ.hrIiKz3envHDPauVXSmA_BO_KKzWJAePsP3xD8l851s - + example: >- + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyODMyNTMxYTA1Y2JkNTdiMjczYWViYiIsImVtYWlsIjoiYW5raXQuc0BwYWNld2lzZG9tLmNvbSIsIm5hbWUiOiJBbmtpdCIsImlzQU1lbnRvciI6dHJ1ZX0sImlhdCI6MTY1MzAxMDYxNCwiZXhwIjoxNjY4ODIxODE0fQ.hrIiKz3envHDPauVXSmA_BO_KKzWJAePsP3xD8l851s logoutResponse200: description: OK, User logout successfully type: object @@ -3271,11 +3421,11 @@ components: example: jhon image: type: string - example: 'https://aws-bucket-storage-name.s3.ap-south-1.amazonaws.com/https://cloudstorage.com/container/abc.png' + example: >- + https://aws-bucket-storage-name.s3.ap-south-1.amazonaws.com/https://cloudstorage.com/container/abc.png count: type: number example: 1 - profile: profileDetailsResponse200: type: object @@ -3400,7 +3550,8 @@ components: items: type: string description: The user's location(s). - example: ['ap'] + example: + - ap about: type: string description: A brief description about the user. @@ -3518,7 +3669,6 @@ components: items: type: string example: [] - form: createFormRequest: type: object @@ -3816,7 +3966,6 @@ components: items: type: string example: [] - cloudServices: getSampleCSVResponse200: type: object @@ -3829,7 +3978,8 @@ components: example: Download Url Generated Successfully. result: type: string - example: https://mentoring-dev-storage.s3.ap-south-1.amazonaws.com/sample/bulk_user_creation.csv + example: >- + https://mentoring-dev-storage.s3.ap-south-1.amazonaws.com/sample/bulk_user_creation.csv cloudServicesResponse200: type: object properties: @@ -3844,7 +3994,8 @@ components: properties: signed_url: type: string - example: https://aws-bucket-storage-name.s3.ap-south-1.amazonaws.com/users/62832531a05cbd57b273aebb-1654149589875-laptop1.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=aws-access-key-id%2F20220602%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20220602T055949Z&X-Amz-Expires=1800&X-Amz-Signature=0588b16fba45cb85efdc45749173c42ba26b47a9faa9bce5715c666b2657a4d4&X-Amz-SignedHeaders=host + example: >- + https://aws-bucket-storage-name.s3.ap-south-1.amazonaws.com/users/62832531a05cbd57b273aebb-1654149589875-laptop1.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=aws-access-key-id%2F20220602%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20220602T055949Z&X-Amz-Expires=1800&X-Amz-Signature=0588b16fba45cb85efdc45749173c42ba26b47a9faa9bce5715c666b2657a4d4&X-Amz-SignedHeaders=host file_path: type: string example: users/62832531a05cbd57b273aebb-1654149589875-laptop1.jpg @@ -3862,8 +4013,8 @@ components: example: Download Url Generated Successfully. result: type: string - example: https://aws-bucket-storage-name.s3.ap-south-1.amazonaws.com/users/62832531a05cbd57b273aebb-1654149589875-image.jpg - + example: >- + https://aws-bucket-storage-name.s3.ap-south-1.amazonaws.com/users/62832531a05cbd57b273aebb-1654149589875-image.jpg admin: deactivateUser400Response: type: object @@ -4010,10 +4161,12 @@ components: properties: access_token: type: string - example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyOGQ4YjljNGRmOGFkM2ExM2QyODNlNyIsImVtYWlsIjoic3lzdGVtQGFkbWluLmNvbSIsInJvbGUiOiJhZG1pbiJ9LCJpYXQiOjE2NTM0NDQ2MDQsImV4cCI6MTY1MzUzMTAwNH0.l6I0MC16FegRLDym_VwgxFsa97ApUuOKohj2k49cV0I + example: >- + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyOGQ4YjljNGRmOGFkM2ExM2QyODNlNyIsImVtYWlsIjoic3lzdGVtQGFkbWluLmNvbSIsInJvbGUiOiJhZG1pbiJ9LCJpYXQiOjE2NTM0NDQ2MDQsImV4cCI6MTY1MzUzMTAwNH0.l6I0MC16FegRLDym_VwgxFsa97ApUuOKohj2k49cV0I refresh_token: type: string - example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyOGQ4YjljNGRmOGFkM2ExM2QyODNlNyIsImVtYWlsIjoic3lzdGVtQGFkbWluLmNvbSIsInJvbGUiOiJhZG1pbiJ9LCJpYXQiOjE2NTM0NDQ2MDQsImV4cCI6MTY2OTI1NTgwNH0.TGDhpCVa0hTAbki8Dp5XGtQyqCMXu4Xu9L_72Yr4G1A + example: >- + eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyOGQ4YjljNGRmOGFkM2ExM2QyODNlNyIsImVtYWlsIjoic3lzdGVtQGFkbWluLmNvbSIsInJvbGUiOiJhZG1pbiJ9LCJpYXQiOjE2NTM0NDQ2MDQsImV4cCI6MTY2OTI1NTgwNH0.TGDhpCVa0hTAbki8Dp5XGtQyqCMXu4Xu9L_72Yr4G1A user: type: object properties: @@ -4052,7 +4205,7 @@ components: last_logged_in_at: type: string format: date-time - example: 2023-07-25T11:50:35.044Z + example: '2023-07-25T11:50:35.044Z' has_accepted_terms_and_conditions: type: boolean example: true @@ -4087,11 +4240,11 @@ components: created_at: type: string format: date-time - example: 2023-07-24T14:37:56.393Z + example: '2023-07-24T14:37:56.393Z' updated_at: type: string format: date-time - example: 2023-07-25T11:50:35.044Z + example: '2023-07-25T11:50:35.044Z' user_roles: type: array items: @@ -4157,7 +4310,6 @@ components: items: type: string example: [] - organization: requestOrgRole200Response: type: object @@ -4204,7 +4356,6 @@ components: type: string example: testing description: A brief description of the organization. - createOrganization200Response: type: object description: Organization created successfully @@ -4294,11 +4445,12 @@ components: example: sl description: type: string - example: Founded in 2017 ShikshaLokam is an Education Leadership Catalyst under the aegis of Advaith Foundation. + example: >- + Founded in 2017 ShikshaLokam is an Education Leadership + Catalyst under the aegis of Advaith Foundation. count: type: number example: 1 - entity-type: createEntityTypeRequest: type: object @@ -4327,7 +4479,6 @@ components: type: boolean description: Indicates whether the entity type has associated entities. example: STRING - updateEntityTypeRequest: type: object description: entity type update request @@ -4355,7 +4506,6 @@ components: type: boolean description: Indicates whether the entity type has associated entities. example: STRING - createEntityType201Response: type: object description: entity type request @@ -4392,10 +4542,10 @@ components: example: 15 updated_at: type: string - example: 2023-08-09T17:02:12.842Z + example: '2023-08-09T17:02:12.842Z' created_at: type: string - example: 2023-08-09T17:02:12.842Z + example: '2023-08-09T17:02:12.842Z' allow_filtering: type: string format: nullable @@ -4521,7 +4671,6 @@ components: items: type: string example: [] - userRole: userRoleListResponse200: type: object @@ -4553,15 +4702,14 @@ components: created_at: type: string format: date-time - example: 2023-08-07T11:27:23.560Z + example: '2023-08-07T11:27:23.560Z' updated_at: type: string format: date-time - example: 2023-08-07T11:27:23.560Z + example: '2023-08-07T11:27:23.560Z' deleted_at: type: date-time example: null - userentity: createUserEntityRequest: type: object @@ -4676,7 +4824,6 @@ components: deleted_at: type: string example: null - deleteUserEntity202Response: type: object description: Entity Deleted @@ -4782,11 +4929,11 @@ components: updated_at: type: string format: date-time - example: 2023-12-05T06:55:42.178Z + example: '2023-12-05T06:55:42.178Z' created_at: type: string format: date-time - example: 2023-12-05T06:55:42.178Z + example: '2023-12-05T06:55:42.178Z' updated_by: type: integer example: 9 @@ -4871,16 +5018,15 @@ components: created_at: type: string format: date-time - example: 2023-11-29T10:16:56.236Z + example: '2023-11-29T10:16:56.236Z' updated_at: type: string format: date-time - example: 2023-12-05T09:04:02.566Z + example: '2023-12-05T09:04:02.566Z' deleted_at: type: string example: null - - securitySchemes: + securitySchemes: null bearer: type: apiKey name: X-auth-token diff --git a/src/api-doc/index.html b/src/api-doc/index.html index fca524518..a0b891bc4 100644 --- a/src/api-doc/index.html +++ b/src/api-doc/index.html @@ -35819,7 +35819,7 @@ var e = new Worker( URL.createObjectURL( new Blob([ - '/*! For license information please see 0a6ad30060afff00cb34.worker.js.LICENSE.txt */\n!function(){var e={336:function(e,t,r){var n,i;!function(){var s,o,a,u,l,c,h,d,f,p,y,m,g,x,v,w,Q,k,S,E,L,P,b,T,O,I,R=function(e){var t=new R.Builder;return t.pipeline.add(R.trimmer,R.stopWordFilter,R.stemmer),t.searchPipeline.add(R.stemmer),e.call(t,t),t.build()};R.version="2.3.9",R.utils={},R.utils.warn=(s=this,function(e){s.console&&console.warn&&console.warn(e)}),R.utils.asString=function(e){return null==e?"":e.toString()},R.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),r=Object.keys(e),n=0;n0){var u=R.utils.clone(t)||{};u.position=[o,a],u.index=i.length,i.push(new R.Token(r.slice(o,s),u))}o=s+1}}return i},R.tokenizer.separator=/[\\s\\-]+/,R.Pipeline=function(){this._stack=[]},R.Pipeline.registeredFunctions=Object.create(null),R.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&R.utils.warn("Overwriting existing registered function: "+t),e.label=t,R.Pipeline.registeredFunctions[e.label]=e},R.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||R.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\\n",e)},R.Pipeline.load=function(e){var t=new R.Pipeline;return e.forEach((function(e){var r=R.Pipeline.registeredFunctions[e];if(!r)throw new Error("Cannot load unregistered function: "+e);t.add(r)})),t},R.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach((function(e){R.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)}),this)},R.Pipeline.prototype.after=function(e,t){R.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");r+=1,this._stack.splice(r,0,t)},R.Pipeline.prototype.before=function(e,t){R.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");this._stack.splice(r,0,t)},R.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},R.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r1&&(se&&(r=i),s!=e);)n=r-t,i=t+Math.floor(n/2),s=this.elements[2*i];return s==e||s>e?2*i:sa?l+=2:o==a&&(t+=r[u+1]*n[l+1],u+=2,l+=2);return t},R.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},R.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t0){var s,o=i.str.charAt(0);o in i.node.edges?s=i.node.edges[o]:(s=new R.TokenSet,i.node.edges[o]=s),1==i.str.length&&(s.final=!0),n.push({node:s,editsRemaining:i.editsRemaining,str:i.str.slice(1)})}if(0!=i.editsRemaining){if("*"in i.node.edges)var a=i.node.edges["*"];else a=new R.TokenSet,i.node.edges["*"]=a;if(0==i.str.length&&(a.final=!0),n.push({node:a,editsRemaining:i.editsRemaining-1,str:i.str}),i.str.length>1&&n.push({node:i.node,editsRemaining:i.editsRemaining-1,str:i.str.slice(1)}),1==i.str.length&&(i.node.final=!0),i.str.length>=1){if("*"in i.node.edges)var u=i.node.edges["*"];else u=new R.TokenSet,i.node.edges["*"]=u;1==i.str.length&&(u.final=!0),n.push({node:u,editsRemaining:i.editsRemaining-1,str:i.str.slice(1)})}if(i.str.length>1){var l,c=i.str.charAt(0),h=i.str.charAt(1);h in i.node.edges?l=i.node.edges[h]:(l=new R.TokenSet,i.node.edges[h]=l),1==i.str.length&&(l.final=!0),n.push({node:l,editsRemaining:i.editsRemaining-1,str:c+i.str.slice(2)})}}}return r},R.TokenSet.fromString=function(e){for(var t=new R.TokenSet,r=t,n=0,i=e.length;n=e;t--){var r=this.uncheckedNodes[t],n=r.child.toString();n in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[n]:(r.child._str=n,this.minimizedNodes[n]=r.child),this.uncheckedNodes.pop()}},R.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},R.Index.prototype.search=function(e){return this.query((function(t){new R.QueryParser(e,t).parse()}))},R.Index.prototype.query=function(e){for(var t=new R.Query(this.fields),r=Object.create(null),n=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=0;a1?1:e},R.Builder.prototype.k1=function(e){this._k1=e},R.Builder.prototype.add=function(e,t){var r=e[this._ref],n=Object.keys(this._fields);this._documents[r]=t||{},this.documentCount+=1;for(var i=0;i=this.length)return R.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},R.QueryLexer.prototype.width=function(){return this.pos-this.start},R.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},R.QueryLexer.prototype.backup=function(){this.pos-=1},R.QueryLexer.prototype.acceptDigitRun=function(){var e,t;do{t=(e=this.next()).charCodeAt(0)}while(t>47&&t<58);e!=R.QueryLexer.EOS&&this.backup()},R.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(R.QueryLexer.TERM)),e.ignore(),e.more())return R.QueryLexer.lexText},R.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(R.QueryLexer.EDIT_DISTANCE),R.QueryLexer.lexText},R.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(R.QueryLexer.BOOST),R.QueryLexer.lexText},R.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(R.QueryLexer.TERM)},R.QueryLexer.termSeparator=R.tokenizer.separator,R.QueryLexer.lexText=function(e){for(;;){var t=e.next();if(t==R.QueryLexer.EOS)return R.QueryLexer.lexEOS;if(92!=t.charCodeAt(0)){if(":"==t)return R.QueryLexer.lexField;if("~"==t)return e.backup(),e.width()>0&&e.emit(R.QueryLexer.TERM),R.QueryLexer.lexEditDistance;if("^"==t)return e.backup(),e.width()>0&&e.emit(R.QueryLexer.TERM),R.QueryLexer.lexBoost;if("+"==t&&1===e.width())return e.emit(R.QueryLexer.PRESENCE),R.QueryLexer.lexText;if("-"==t&&1===e.width())return e.emit(R.QueryLexer.PRESENCE),R.QueryLexer.lexText;if(t.match(R.QueryLexer.termSeparator))return R.QueryLexer.lexTerm}else e.escapeCharacter()}},R.QueryParser=function(e,t){this.lexer=new R.QueryLexer(e),this.query=t,this.currentClause={},this.lexemeIdx=0},R.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=R.QueryParser.parseClause;e;)e=e(this);return this.query},R.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},R.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},R.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},R.QueryParser.parseClause=function(e){var t=e.peekLexeme();if(null!=t)switch(t.type){case R.QueryLexer.PRESENCE:return R.QueryParser.parsePresence;case R.QueryLexer.FIELD:return R.QueryParser.parseField;case R.QueryLexer.TERM:return R.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+t.type;throw t.str.length>=1&&(r+=" with value \'"+t.str+"\'"),new R.QueryParseError(r,t.start,t.end)}},R.QueryParser.parsePresence=function(e){var t=e.consumeLexeme();if(null!=t){switch(t.str){case"-":e.currentClause.presence=R.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=R.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator\'"+t.str+"\'";throw new R.QueryParseError(r,t.start,t.end)}var n=e.peekLexeme();if(null==n)throw r="expecting term or field, found nothing",new R.QueryParseError(r,t.start,t.end);switch(n.type){case R.QueryLexer.FIELD:return R.QueryParser.parseField;case R.QueryLexer.TERM:return R.QueryParser.parseTerm;default:throw r="expecting term or field, found \'"+n.type+"\'",new R.QueryParseError(r,n.start,n.end)}}},R.QueryParser.parseField=function(e){var t=e.consumeLexeme();if(null!=t){if(-1==e.query.allFields.indexOf(t.str)){var r=e.query.allFields.map((function(e){return"\'"+e+"\'"})).join(", "),n="unrecognised field \'"+t.str+"\', possible fields: "+r;throw new R.QueryParseError(n,t.start,t.end)}e.currentClause.fields=[t.str];var i=e.peekLexeme();if(null==i)throw n="expecting term, found nothing",new R.QueryParseError(n,t.start,t.end);if(i.type===R.QueryLexer.TERM)return R.QueryParser.parseTerm;throw n="expecting term, found \'"+i.type+"\'",new R.QueryParseError(n,i.start,i.end)}},R.QueryParser.parseTerm=function(e){var t=e.consumeLexeme();if(null!=t){e.currentClause.term=t.str.toLowerCase(),-1!=t.str.indexOf("*")&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(null!=r)switch(r.type){case R.QueryLexer.TERM:return e.nextClause(),R.QueryParser.parseTerm;case R.QueryLexer.FIELD:return e.nextClause(),R.QueryParser.parseField;case R.QueryLexer.EDIT_DISTANCE:return R.QueryParser.parseEditDistance;case R.QueryLexer.BOOST:return R.QueryParser.parseBoost;case R.QueryLexer.PRESENCE:return e.nextClause(),R.QueryParser.parsePresence;default:var n="Unexpected lexeme type \'"+r.type+"\'";throw new R.QueryParseError(n,r.start,r.end)}else e.nextClause()}},R.QueryParser.parseEditDistance=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var n="edit distance must be numeric";throw new R.QueryParseError(n,t.start,t.end)}e.currentClause.editDistance=r;var i=e.peekLexeme();if(null!=i)switch(i.type){case R.QueryLexer.TERM:return e.nextClause(),R.QueryParser.parseTerm;case R.QueryLexer.FIELD:return e.nextClause(),R.QueryParser.parseField;case R.QueryLexer.EDIT_DISTANCE:return R.QueryParser.parseEditDistance;case R.QueryLexer.BOOST:return R.QueryParser.parseBoost;case R.QueryLexer.PRESENCE:return e.nextClause(),R.QueryParser.parsePresence;default:throw n="Unexpected lexeme type \'"+i.type+"\'",new R.QueryParseError(n,i.start,i.end)}else e.nextClause()}},R.QueryParser.parseBoost=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var n="boost must be numeric";throw new R.QueryParseError(n,t.start,t.end)}e.currentClause.boost=r;var i=e.peekLexeme();if(null!=i)switch(i.type){case R.QueryLexer.TERM:return e.nextClause(),R.QueryParser.parseTerm;case R.QueryLexer.FIELD:return e.nextClause(),R.QueryParser.parseField;case R.QueryLexer.EDIT_DISTANCE:return R.QueryParser.parseEditDistance;case R.QueryLexer.BOOST:return R.QueryParser.parseBoost;case R.QueryLexer.PRESENCE:return e.nextClause(),R.QueryParser.parsePresence;default:throw n="Unexpected lexeme type \'"+i.type+"\'",new R.QueryParseError(n,i.start,i.end)}else e.nextClause()}},void 0===(i="function"==typeof(n=function(){return R})?n.call(t,r,t,e):n)||(e.exports=i)}()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var n={};!function(){"use strict";r.d(n,{add:function(){return l},dispose:function(){return p},done:function(){return c},fromExternalJS:function(){return d},load:function(){return f},search:function(){return y},toJS:function(){return h}});var e=r(336),t=(e,t,r)=>new Promise(((n,i)=>{var s=e=>{try{a(r.next(e))}catch(e){i(e)}},o=e=>{try{a(r.throw(e))}catch(e){i(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(s,o);a((r=r.apply(e,t)).next())}));let i,s,o,a=[];function u(){i=new e.Builder,i.field("title"),i.field("description"),i.ref("ref"),i.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),o=new Promise((e=>{s=e}))}function l(e,t,r){const n=a.push(r)-1,s={title:e.toLowerCase(),description:t.toLowerCase(),ref:n};i.add(s)}function c(){return t(this,null,(function*(){s(i.build())}))}function h(){return t(this,null,(function*(){return{store:a,index:(yield o).toJSON()}}))}function d(e,r){return t(this,null,(function*(){try{if(importScripts(e),!self[r])throw new Error("Broken index file format");f(self[r])}catch(e){console.error("Failed to load search index: "+e.message)}}))}function f(r){return t(this,null,(function*(){a=r.store,s(e.Index.load(r.index))}))}function p(){return t(this,null,(function*(){a=[],u()}))}function y(r,n=0){return t(this,null,(function*(){if(0===r.trim().length)return[];let t=(yield o).query((t=>{r.trim().toLowerCase().split(/\\s+/).forEach((r=>{if(1===r.length)return;const n=(t=>{const r=e.trimmer(new e.Token(t,{}));return"*"+e.stemmer(r)+"*"})(r);t.term(n,{})}))}));return n>0&&(t=t.slice(0,n)),t.map((e=>({meta:a[e.ref],score:e.score})))}))}e.tokenizer.separator=/\\s+/,u(),addEventListener("message",(function(e){var t,r=e.data,i=r.type,s=r.method,o=r.id,a=r.params;"RPC"===i&&s&&((t=n[s])?Promise.resolve().then((function(){return t.apply(n,a)})):Promise.reject("No such method")).then((function(e){postMessage({type:"RPC",id:o,result:e})})).catch((function(e){var t={message:e};e.stack&&(t.message=e.message,t.stack=e.stack,t.name=e.name),postMessage({type:"RPC",id:o,error:t})}))})),postMessage({type:"RPC",method:"ready"})}()}();\n//# sourceMappingURL=0a6ad30060afff00cb34.worker.js.map', + '/*! For license information please see 9e68c24da9f5fd56991c.worker.js.LICENSE.txt */\n!function(){var e={336:function(e,t,r){var n,i;!function(){var s,o,a,u,l,c,h,d,f,p,y,m,g,x,v,w,Q,k,S,E,L,P,b,T,O,I,R=function(e){var t=new R.Builder;return t.pipeline.add(R.trimmer,R.stopWordFilter,R.stemmer),t.searchPipeline.add(R.stemmer),e.call(t,t),t.build()};R.version="2.3.9",R.utils={},R.utils.warn=(s=this,function(e){s.console&&console.warn&&console.warn(e)}),R.utils.asString=function(e){return null==e?"":e.toString()},R.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),r=Object.keys(e),n=0;n0){var u=R.utils.clone(t)||{};u.position=[o,a],u.index=i.length,i.push(new R.Token(r.slice(o,s),u))}o=s+1}}return i},R.tokenizer.separator=/[\\s\\-]+/,R.Pipeline=function(){this._stack=[]},R.Pipeline.registeredFunctions=Object.create(null),R.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&R.utils.warn("Overwriting existing registered function: "+t),e.label=t,R.Pipeline.registeredFunctions[e.label]=e},R.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||R.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\\n",e)},R.Pipeline.load=function(e){var t=new R.Pipeline;return e.forEach((function(e){var r=R.Pipeline.registeredFunctions[e];if(!r)throw new Error("Cannot load unregistered function: "+e);t.add(r)})),t},R.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach((function(e){R.Pipeline.warnIfFunctionNotRegistered(e),this._stack.push(e)}),this)},R.Pipeline.prototype.after=function(e,t){R.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");r+=1,this._stack.splice(r,0,t)},R.Pipeline.prototype.before=function(e,t){R.Pipeline.warnIfFunctionNotRegistered(t);var r=this._stack.indexOf(e);if(-1==r)throw new Error("Cannot find existingFn");this._stack.splice(r,0,t)},R.Pipeline.prototype.remove=function(e){var t=this._stack.indexOf(e);-1!=t&&this._stack.splice(t,1)},R.Pipeline.prototype.run=function(e){for(var t=this._stack.length,r=0;r1&&(se&&(r=i),s!=e);)n=r-t,i=t+Math.floor(n/2),s=this.elements[2*i];return s==e||s>e?2*i:sa?l+=2:o==a&&(t+=r[u+1]*n[l+1],u+=2,l+=2);return t},R.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},R.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),t=1,r=0;t0){var s,o=i.str.charAt(0);o in i.node.edges?s=i.node.edges[o]:(s=new R.TokenSet,i.node.edges[o]=s),1==i.str.length&&(s.final=!0),n.push({node:s,editsRemaining:i.editsRemaining,str:i.str.slice(1)})}if(0!=i.editsRemaining){if("*"in i.node.edges)var a=i.node.edges["*"];else a=new R.TokenSet,i.node.edges["*"]=a;if(0==i.str.length&&(a.final=!0),n.push({node:a,editsRemaining:i.editsRemaining-1,str:i.str}),i.str.length>1&&n.push({node:i.node,editsRemaining:i.editsRemaining-1,str:i.str.slice(1)}),1==i.str.length&&(i.node.final=!0),i.str.length>=1){if("*"in i.node.edges)var u=i.node.edges["*"];else u=new R.TokenSet,i.node.edges["*"]=u;1==i.str.length&&(u.final=!0),n.push({node:u,editsRemaining:i.editsRemaining-1,str:i.str.slice(1)})}if(i.str.length>1){var l,c=i.str.charAt(0),h=i.str.charAt(1);h in i.node.edges?l=i.node.edges[h]:(l=new R.TokenSet,i.node.edges[h]=l),1==i.str.length&&(l.final=!0),n.push({node:l,editsRemaining:i.editsRemaining-1,str:c+i.str.slice(2)})}}}return r},R.TokenSet.fromString=function(e){for(var t=new R.TokenSet,r=t,n=0,i=e.length;n=e;t--){var r=this.uncheckedNodes[t],n=r.child.toString();n in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[n]:(r.child._str=n,this.minimizedNodes[n]=r.child),this.uncheckedNodes.pop()}},R.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},R.Index.prototype.search=function(e){return this.query((function(t){new R.QueryParser(e,t).parse()}))},R.Index.prototype.query=function(e){for(var t=new R.Query(this.fields),r=Object.create(null),n=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=0;a1?1:e},R.Builder.prototype.k1=function(e){this._k1=e},R.Builder.prototype.add=function(e,t){var r=e[this._ref],n=Object.keys(this._fields);this._documents[r]=t||{},this.documentCount+=1;for(var i=0;i=this.length)return R.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},R.QueryLexer.prototype.width=function(){return this.pos-this.start},R.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},R.QueryLexer.prototype.backup=function(){this.pos-=1},R.QueryLexer.prototype.acceptDigitRun=function(){var e,t;do{t=(e=this.next()).charCodeAt(0)}while(t>47&&t<58);e!=R.QueryLexer.EOS&&this.backup()},R.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(R.QueryLexer.TERM)),e.ignore(),e.more())return R.QueryLexer.lexText},R.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(R.QueryLexer.EDIT_DISTANCE),R.QueryLexer.lexText},R.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(R.QueryLexer.BOOST),R.QueryLexer.lexText},R.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(R.QueryLexer.TERM)},R.QueryLexer.termSeparator=R.tokenizer.separator,R.QueryLexer.lexText=function(e){for(;;){var t=e.next();if(t==R.QueryLexer.EOS)return R.QueryLexer.lexEOS;if(92!=t.charCodeAt(0)){if(":"==t)return R.QueryLexer.lexField;if("~"==t)return e.backup(),e.width()>0&&e.emit(R.QueryLexer.TERM),R.QueryLexer.lexEditDistance;if("^"==t)return e.backup(),e.width()>0&&e.emit(R.QueryLexer.TERM),R.QueryLexer.lexBoost;if("+"==t&&1===e.width())return e.emit(R.QueryLexer.PRESENCE),R.QueryLexer.lexText;if("-"==t&&1===e.width())return e.emit(R.QueryLexer.PRESENCE),R.QueryLexer.lexText;if(t.match(R.QueryLexer.termSeparator))return R.QueryLexer.lexTerm}else e.escapeCharacter()}},R.QueryParser=function(e,t){this.lexer=new R.QueryLexer(e),this.query=t,this.currentClause={},this.lexemeIdx=0},R.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=R.QueryParser.parseClause;e;)e=e(this);return this.query},R.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},R.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},R.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},R.QueryParser.parseClause=function(e){var t=e.peekLexeme();if(null!=t)switch(t.type){case R.QueryLexer.PRESENCE:return R.QueryParser.parsePresence;case R.QueryLexer.FIELD:return R.QueryParser.parseField;case R.QueryLexer.TERM:return R.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+t.type;throw t.str.length>=1&&(r+=" with value \'"+t.str+"\'"),new R.QueryParseError(r,t.start,t.end)}},R.QueryParser.parsePresence=function(e){var t=e.consumeLexeme();if(null!=t){switch(t.str){case"-":e.currentClause.presence=R.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=R.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator\'"+t.str+"\'";throw new R.QueryParseError(r,t.start,t.end)}var n=e.peekLexeme();if(null==n)throw r="expecting term or field, found nothing",new R.QueryParseError(r,t.start,t.end);switch(n.type){case R.QueryLexer.FIELD:return R.QueryParser.parseField;case R.QueryLexer.TERM:return R.QueryParser.parseTerm;default:throw r="expecting term or field, found \'"+n.type+"\'",new R.QueryParseError(r,n.start,n.end)}}},R.QueryParser.parseField=function(e){var t=e.consumeLexeme();if(null!=t){if(-1==e.query.allFields.indexOf(t.str)){var r=e.query.allFields.map((function(e){return"\'"+e+"\'"})).join(", "),n="unrecognised field \'"+t.str+"\', possible fields: "+r;throw new R.QueryParseError(n,t.start,t.end)}e.currentClause.fields=[t.str];var i=e.peekLexeme();if(null==i)throw n="expecting term, found nothing",new R.QueryParseError(n,t.start,t.end);if(i.type===R.QueryLexer.TERM)return R.QueryParser.parseTerm;throw n="expecting term, found \'"+i.type+"\'",new R.QueryParseError(n,i.start,i.end)}},R.QueryParser.parseTerm=function(e){var t=e.consumeLexeme();if(null!=t){e.currentClause.term=t.str.toLowerCase(),-1!=t.str.indexOf("*")&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(null!=r)switch(r.type){case R.QueryLexer.TERM:return e.nextClause(),R.QueryParser.parseTerm;case R.QueryLexer.FIELD:return e.nextClause(),R.QueryParser.parseField;case R.QueryLexer.EDIT_DISTANCE:return R.QueryParser.parseEditDistance;case R.QueryLexer.BOOST:return R.QueryParser.parseBoost;case R.QueryLexer.PRESENCE:return e.nextClause(),R.QueryParser.parsePresence;default:var n="Unexpected lexeme type \'"+r.type+"\'";throw new R.QueryParseError(n,r.start,r.end)}else e.nextClause()}},R.QueryParser.parseEditDistance=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var n="edit distance must be numeric";throw new R.QueryParseError(n,t.start,t.end)}e.currentClause.editDistance=r;var i=e.peekLexeme();if(null!=i)switch(i.type){case R.QueryLexer.TERM:return e.nextClause(),R.QueryParser.parseTerm;case R.QueryLexer.FIELD:return e.nextClause(),R.QueryParser.parseField;case R.QueryLexer.EDIT_DISTANCE:return R.QueryParser.parseEditDistance;case R.QueryLexer.BOOST:return R.QueryParser.parseBoost;case R.QueryLexer.PRESENCE:return e.nextClause(),R.QueryParser.parsePresence;default:throw n="Unexpected lexeme type \'"+i.type+"\'",new R.QueryParseError(n,i.start,i.end)}else e.nextClause()}},R.QueryParser.parseBoost=function(e){var t=e.consumeLexeme();if(null!=t){var r=parseInt(t.str,10);if(isNaN(r)){var n="boost must be numeric";throw new R.QueryParseError(n,t.start,t.end)}e.currentClause.boost=r;var i=e.peekLexeme();if(null!=i)switch(i.type){case R.QueryLexer.TERM:return e.nextClause(),R.QueryParser.parseTerm;case R.QueryLexer.FIELD:return e.nextClause(),R.QueryParser.parseField;case R.QueryLexer.EDIT_DISTANCE:return R.QueryParser.parseEditDistance;case R.QueryLexer.BOOST:return R.QueryParser.parseBoost;case R.QueryLexer.PRESENCE:return e.nextClause(),R.QueryParser.parsePresence;default:throw n="Unexpected lexeme type \'"+i.type+"\'",new R.QueryParseError(n,i.start,i.end)}else e.nextClause()}},void 0===(i="function"==typeof(n=function(){return R})?n.call(t,r,t,e):n)||(e.exports=i)}()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n](s,s.exports,r),s.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var n={};!function(){"use strict";r.d(n,{add:function(){return l},dispose:function(){return p},done:function(){return c},fromExternalJS:function(){return d},load:function(){return f},search:function(){return y},toJS:function(){return h}});var e=r(336),t=(e,t,r)=>new Promise(((n,i)=>{var s=e=>{try{a(r.next(e))}catch(e){i(e)}},o=e=>{try{a(r.throw(e))}catch(e){i(e)}},a=e=>e.done?n(e.value):Promise.resolve(e.value).then(s,o);a((r=r.apply(e,t)).next())}));let i,s,o,a=[];function u(){i=new e.Builder,i.field("title"),i.field("description"),i.ref("ref"),i.pipeline.add(e.trimmer,e.stopWordFilter,e.stemmer),o=new Promise((e=>{s=e}))}function l(e,t,r){const n=a.push(r)-1,s={title:e.toLowerCase(),description:t.toLowerCase(),ref:n};i.add(s)}function c(){return t(this,null,(function*(){s(i.build())}))}function h(){return t(this,null,(function*(){return{store:a,index:(yield o).toJSON()}}))}function d(e,r){return t(this,null,(function*(){try{if(importScripts(e),!self[r])throw new Error("Broken index file format");f(self[r])}catch(e){console.error("Failed to load search index: "+e.message)}}))}function f(r){return t(this,null,(function*(){a=r.store,s(e.Index.load(r.index))}))}function p(){return t(this,null,(function*(){a=[],u()}))}function y(r,n=0){return t(this,null,(function*(){if(0===r.trim().length)return[];let t=(yield o).query((t=>{r.trim().toLowerCase().split(/\\s+/).forEach((r=>{if(1===r.length)return;const n=(t=>"*"+e.stemmer(new e.Token(t,{}))+"*")(r);t.term(n,{})}))}));return n>0&&(t=t.slice(0,n)),t.map((e=>({meta:a[e.ref],score:e.score})))}))}e.tokenizer.separator=/\\s+/,u(),addEventListener("message",(function(e){var t,r=e.data,i=r.type,s=r.method,o=r.id,a=r.params;"RPC"===i&&s&&((t=n[s])?Promise.resolve().then((function(){return t.apply(n,a)})):Promise.reject("No such method")).then((function(e){postMessage({type:"RPC",id:o,result:e})})).catch((function(e){var t={message:e};e.stack&&(t.message=e.message,t.stack=e.stack,t.name=e.name),postMessage({type:"RPC",id:o,error:t})}))})),postMessage({type:"RPC",method:"ready"})}()}();\n//# sourceMappingURL=9e68c24da9f5fd56991c.worker.js.map', ]) ), { name: '[fullhash].worker.js' } @@ -42069,10 +42069,10 @@ n.createElement('pre', null, this.state.error.stack) ) ), - n.createElement('small', null, ' ReDoc Version: ', '2.0.0'), + n.createElement('small', null, ' ReDoc Version: ', '2.0.0-rc.76'), ' ', n.createElement('br', null), - n.createElement('small', null, ' Commit: ', '5fb4daa') + n.createElement('small', null, ' Commit: ', 'c7d5ae0') ) : n.createElement(n.Fragment, null, n.Children.only(this.props.children)) } @@ -44614,9 +44614,8 @@ const Rl = '(?:^ {0,3}\x3c!-- ReDoc-Inject:\\s+?<({component}).*?/?>\\s+?--\x3e\\s*$|(?:^ {0,3}<({component})([\\s\\S]*?)>([\\s\\S]*?)|^ {0,3}<({component})([\\s\\S]*?)(?:/>|\\n{2,})))' class jl { - constructor(e, t) { + constructor(e) { ;(this.options = e), - (this.parentId = t), (this.headings = []), (this.headingRule = (e, t, n, r) => ( 1 === t @@ -44630,7 +44629,6 @@ ), this.originalHeadingRule(e, t, n, r) )), - (this.parentId = t), (this.parser = new wl.Parser()), (this.headingEnhanceRenderer = new wl.Renderer()), (this.originalHeadingRule = this.headingEnhanceRenderer.heading.bind( @@ -44651,7 +44649,7 @@ .replace(/&/g, '&') .replace(/"/g, '"') const o = { - id: r ? `${r}/${no(e)}` : `${this.parentId || 'section'}/${no(e)}`, + id: r ? `${r}/${no(e)}` : `section/${no(e)}`, name: e, level: t, items: [], @@ -44924,8 +44922,7 @@ let o = this.byRef(e.$ref) if (!o) throw new Error(`Failed to resolve $ref "${e.$ref}"`) let i = t - if (t.includes(e.$ref) || t.length > 999) - o = Object.assign({}, o, { 'x-circular-ref': !0 }) + if (t.includes(e.$ref)) o = Object.assign({}, o, { 'x-circular-ref': !0 }) else if (this.isRef(o)) { const e = this.deref(o, t, n) ;(i = e.refsStack), (o = e.resolved) @@ -44974,7 +44971,7 @@ mergeAllOf(e, t, n) { var r if (e['x-circular-ref']) return e - if (void 0 === (e = this.hoistOneOfs(e, n)).allOf) return e + if (void 0 === (e = this.hoistOneOfs(e)).allOf) return e let o = cc(lc({}, e), { 'x-parentRefs': [], allOf: void 0, @@ -44984,29 +44981,21 @@ 'object' == typeof o.properties && (o.properties = lc({}, o.properties)), void 0 !== o.items && 'object' == typeof o.items && (o.items = lc({}, o.items)) - const i = (function (e, t) { - const n = new Set() - return e.filter((e) => { - const t = e.$ref - return !t || (t && !n.has(t) && n.add(t)) + const i = e.allOf + .map((e) => { + var t + const { resolved: r, refsStack: i } = this.deref(e, n, !0), + a = e.$ref || void 0, + s = this.mergeAllOf(r, a, i) + if (!s['x-circular-ref'] || !s.allOf) + return ( + a && + (null == (t = o['x-parentRefs']) || + t.push(...(s['x-parentRefs'] || []), a)), + { $ref: a, refsStack: pc(i, a), schema: s } + ) }) - })( - e.allOf - .map((e) => { - var t - const { resolved: r, refsStack: i } = this.deref(e, n, !0), - a = e.$ref || void 0, - s = this.mergeAllOf(r, a, i) - if (!s['x-circular-ref'] || !s.allOf) - return ( - a && - (null == (t = o['x-parentRefs']) || - t.push(...(s['x-parentRefs'] || []), a)), - { $ref: a, refsStack: pc(i, a), schema: s } - ) - }) - .filter((e) => void 0 !== e) - ) + .filter((e) => void 0 !== e) for (const { schema: e, refsStack: n } of i) { const i = e, { @@ -45060,13 +45049,7 @@ if (o.properties[e]) { if (!y) { const n = this.mergeAllOf( - { - allOf: [ - o.properties[e], - cc(lc({}, l[e]), { 'x-refsStack': i }), - ], - 'x-refsStack': i, - }, + { allOf: [o.properties[e], l[e]], 'x-refsStack': i }, t + '/properties/' + e, i ) @@ -45107,20 +45090,15 @@ } return t } - hoistOneOfs(e, t) { + hoistOneOfs(e) { if (void 0 === e.allOf) return e - const n = e.allOf - for (let e = 0; e < n.length; e++) { - const r = n[e] - if (Array.isArray(r.oneOf)) { - const o = n.slice(0, e), - i = n.slice(e + 1) - return { - oneOf: r.oneOf.map((e) => ({ - allOf: [...o, e, ...i], - 'x-refsStack': t, - })), - } + const t = e.allOf + for (let e = 0; e < t.length; e++) { + const n = t[e] + if (Array.isArray(n.oneOf)) { + const r = t.slice(0, e), + o = t.slice(e + 1) + return { oneOf: n.oneOf.map((e) => ({ allOf: [...r, e, ...o] })) } } } return e @@ -45318,7 +45296,6 @@ _c(kc({}, i), { title: a, allOf: [_c(kc({}, this.schema), { oneOf: void 0, anyOf: void 0 })], - discriminator: r.allOf ? void 0 : i.discriminator, }), e.$ref || this.pointer + '/oneOf/' + n, this.options, @@ -49299,7 +49276,7 @@ ) } static addMarkdownItems(e, t, n, r) { - const o = new jl(r, null == t ? void 0 : t.id).extractHeadings(e || '') + const o = new jl(r).extractHeadings(e || '') o.length && t && t.description && @@ -49629,8 +49606,7 @@ indexItems(e) { const t = (e) => { e.forEach((e) => { - 'group' !== e.type && - this.add(e.name, (e.description || '').concat(' ', e.path || ''), e.id), + 'group' !== e.type && this.add(e.name, e.description || '', e.id), t(e.items) }) } @@ -52710,7 +52686,7 @@ throw new Error( 'When using components in markdown, store prop must be provided' ) - const i = new jl(e, this.props.parentId).renderMdWithComponents(r) + const i = new jl(e).renderMdWithComponents(r) return i.length ? i.map((e, r) => { if ('string' == typeof e) @@ -54129,11 +54105,7 @@ ) ) ), - n.createElement(vy, { - parentId: this.props.item.id, - source: t || '', - htmlWrap: ub, - }), + n.createElement(vy, { source: t || '', htmlWrap: ub }), r && n.createElement( Au, @@ -54832,8 +54804,8 @@ return e } Nt({ useProxies: 'ifavailable' }) - const rw = '2.0.0', - ow = '5fb4daa' + const rw = '2.0.0-rc.76', + ow = 'c7d5ae0' function iw(e) { const t = (function (e) { const t = {}, @@ -55063,6 +55035,18 @@ -ms-transform: rotateZ(-90deg); transform: rotateZ(-90deg); } /*!sc*/ + .hGHhhO { + height: 18px; + width: 18px; + min-width: 18px; + vertical-align: middle; + -webkit-transition: -webkit-transform 0.2s ease-out; + -webkit-transition: transform 0.2s ease-out; + transition: transform 0.2s ease-out; + -webkit-transform: rotateZ(-90deg); + -ms-transform: rotateZ(-90deg); + transform: rotateZ(-90deg); + } /*!sc*/ .dqYXmg { height: 1.5em; width: 1.5em; @@ -55111,20 +55095,8 @@ .bRmrKA polygon { fill: white; } /*!sc*/ - .hGHhhO { - height: 18px; - width: 18px; - min-width: 18px; - vertical-align: middle; - -webkit-transition: -webkit-transform 0.2s ease-out; - -webkit-transition: transform 0.2s ease-out; - transition: transform 0.2s ease-out; - -webkit-transform: rotateZ(-90deg); - -ms-transform: rotateZ(-90deg); - transform: rotateZ(-90deg); - } /*!sc*/ data-styled.g15[id='sc-dIsUp'] { - content: 'dvcDrG,dqYXmg,dVWHLw,bRmrKA,hGHhhO,'; + content: 'dvcDrG,hGHhhO,dqYXmg,dVWHLw,bRmrKA,'; } /*!sc*/ .iwcKgn { border-left: 1px solid #7c7cbb; @@ -56478,6 +56450,16 @@ data-styled.g114[id='sc-eEVmNe'] { content: 'ilvUMs,'; } /*!sc*/ + .ihNycv { + font-size: 0.929em; + line-height: 20px; + background-color: #2f8132; + color: #ffffff; + padding: 3px 10px; + text-transform: uppercase; + font-family: Montserrat, sans-serif; + margin: 0; + } /*!sc*/ .ldMUmp { font-size: 0.929em; line-height: 20px; @@ -56488,20 +56470,20 @@ font-family: Montserrat, sans-serif; margin: 0; } /*!sc*/ - .cDAiVX { + .bJzUtf { font-size: 0.929em; line-height: 20px; - background-color: #bf581d; + background-color: #cc3333; color: #ffffff; padding: 3px 10px; text-transform: uppercase; font-family: Montserrat, sans-serif; margin: 0; } /*!sc*/ - .ihNycv { + .cDAiVX { font-size: 0.929em; line-height: 20px; - background-color: #2f8132; + background-color: #bf581d; color: #ffffff; padding: 3px 10px; text-transform: uppercase; @@ -56509,7 +56491,7 @@ margin: 0; } /*!sc*/ data-styled.g115[id='sc-fmdNqN'] { - content: 'ldMUmp,cDAiVX,ihNycv,'; + content: 'ihNycv,ldMUmp,bJzUtf,cDAiVX,'; } /*!sc*/ .flIrdF { position: absolute; @@ -56583,6 +56565,34 @@ .NAUPn:focus { outline: auto #d41f1c; } /*!sc*/ + .cGFwjB { + display: block; + border: 0; + width: 100%; + text-align: left; + padding: 10px; + border-radius: 2px; + margin-bottom: 4px; + line-height: 1.5em; + cursor: pointer; + color: #d41f1c; + background-color: rgba(212, 31, 28, 0.07); + cursor: default; + } /*!sc*/ + .cGFwjB:focus { + outline: auto #d41f1c; + } /*!sc*/ + .cGFwjB::before { + content: '—'; + font-weight: bold; + width: 1.5em; + text-align: center; + display: inline-block; + vertical-align: top; + } /*!sc*/ + .cGFwjB:focus { + outline: 0; + } /*!sc*/ .jUGDyD { display: block; border: 0; @@ -56612,7 +56622,7 @@ outline: 0; } /*!sc*/ data-styled.g119[id='sc-htmcrh'] { - content: 'lbYftx,NAUPn,jUGDyD,'; + content: 'lbYftx,NAUPn,cGFwjB,jUGDyD,'; } /*!sc*/ .cMoEZ { vertical-align: top; @@ -56858,6 +56868,70 @@
  • @@ -57009,7 +57094,7 @@
  • @@ -57021,7 +57106,7 @@ >patchUpdate userUpdate User Profile @@ -57032,15 +57117,15 @@ -
  • +
    • + +
    • +
    • @@ -57103,7 +57199,7 @@ @@ -57115,7 +57211,7 @@ >patchUpdate formUpdate Form @@ -57126,7 +57222,7 @@ @@ -57156,7 +57252,7 @@ @@ -57167,19 +57263,19 @@
    • @@ -57194,6 +57290,28 @@ > +
    • + +
    • +
    • + +
  • @@ -57225,7 +57343,7 @@ >
  • -
  • - -
  • - - -
  • - -
      -
    • - -
  • @@ -57324,18 +57401,7 @@ -
  • -
  • -
  • @@ -57346,23 +57412,54 @@
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • @@ -57399,7 +57496,7 @@ >patchUpdate entityUpdate Entity @@ -57410,18 +57507,7 @@ - -
  • -
  • @@ -57478,24 +57564,65 @@ >
  • + +
  • +
  • +
  • + + +
  • + +
      +
    • +
    • @@ -57614,19 +57741,24 @@

  • -
    +

    - User APIs + User Roles APIs

    +
    @@ -57634,140 +57766,213 @@

    Create user + >Get User Roles

    -

    This Api is associated with Create User on mentoring

    +

    Retrieve the list of user roles.

      +
    • Endpoint: /user/v1/userRole/list
    • - Then Endpoint for creating user /user/v1/account/create + It is mandatory to provide values for parameters marked as + required.
    • - It is mandatory to provide values for parameter marked with - required + The X-auth-token obtained from the login API is required in the header.
    • -
    • Mandatory parameter cannot be empty or null
    • -
    • secretCode is required only for mentor
    -
    - Request Body schema: application/json -
    -
    -

    Request body consist of metadata and accepts payload as JSON

    -
    - - - - -
    - name -
    required
    -
    -
    -
    - string -
    +
    +
    + path + Parameters +
    + + + + + - - - - - - - - + + + + + + + + - - - - + + +
    + page +
    -
    -

    Name of the user

    +
    + number
    -
    -
    -
    - email -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Email Id of user

    +
    +
    +

    Please add page number

    +
    -
    -
    - password -
    required
    -
    -
    +
    + limit +
    - string - <password> - +
    + number +
    +
    +
    +

    Number of records to limit

    +
    +
    +
    + search +
    -
    -

    Password of user

    +
    + string +
    +
    +
    +

    + Please search for information such as 'code' + names +

    +
    -
    -
    - otp - -
    +
    +
    +
    +
    + query + Parameters +
    + + + + + + + +
    + +
    - string +
    + string +
    +
    +
    +
    +
    +
    + header + Parameters +
    + + + + + - + + + +
    + X-auth-token +
    required
    +
    -
    -

    Email OTP for verification

    +
    + string +
    +
    +
    +

    + X-auth-token obtained from the login API response. +

    +
    -
    -
    +
    +
    + Request Body schema: application/json +
    +
    + + @@ -57790,27 +57995,7 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >200

    OK. User created.

    - - -
    -
    @@ -57827,10 +58012,8 @@

    Responses

    406

    Not Acceptable. User already exists.

    -
    + >401

    Unauthorized

    @@ -57838,8 +58021,8 @@

    Responses

    @@ -57869,7 +58052,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/account/create + >/user/v1/userRole/list
    @@ -57906,7 +58089,8 @@

    Request samples

    - +
    @@ -57921,56 +58105,30 @@

    Request samples

  • "name": - "John Deo", -
    -
  • -
  • -
    - "email": - "example@mail.com", -
    -
  • -
  • -
    - "password": - "Password", -
    -
  • -
  • -
    - "otp": - 6845975, -
    -
  • -
  • -
    - "has_accepted_terms_and_conditions""filters": - true + { +
      +
    • + +
    • +
    + }
  • @@ -58009,18 +58167,7 @@

    Response samples

    aria-controls="react-tabs-5" data-rttab="true" > - 400 - -
    Response samples >"message": "Sign-up successful Please - wait while logging in.""Roles fetched + successfully", @@ -58093,39 +58240,7 @@

    Response samples

    > "access_token": - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...", -
    - -
  • - -
  • -
  • - +
  • +
  • + +
  • + + }, +
    + +
  • +
    + "meta": + { +
      +
    • + +
    • +
    • +
    • @@ -58538,20 +58469,14 @@

      Response samples

      id="react-tabs-5" aria-labelledby="react-tabs-4" >
    -
  • @@ -58559,24 +58484,60 @@

    Response samples

    Login + >Create User Role

    -

    This Api is associated with login user

    +

    Create roles for users.

      -
    • Then Endpoint for login user /user/v1/account/login
    • +
    • Endpoint: /user/v1/userRole/Create.
    • - It is mandatory to provide values for parameter marked with - required + It is mandatory to provide values for parameters marked with + required.
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • Mandatory parameters cannot be empty or null.
    +
    +
    + header + Parameters +
    +
    has_accepted_terms_and_conditions + > +
    required
    boolean -
    -
    -
    -

    - Flag specifiying if user has accepted the terms & - conditions -

    -
    + >object
    +
    + + + + + + +
    + X-auth-token +
    required
    +
    +
    +
    + string +
    +
    +
    +

    Access token of the user

    +
    +
    +
    +
    +
    Request Body schema: application/json
    @@ -58584,9 +58545,9 @@
    - + + + + - - + + + + + + + + + @@ -58641,28 +58654,8 @@

    Responses

    200

    ok

    - - -
    -
    @@ -58671,7 +58664,7 @@

    Responses

    @@ -58701,7 +58694,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/account/login + >/user/v1/userRole/Create
    @@ -58714,10 +58707,10 @@

    Request samples

  • "email""title": "example@mail.com""system_admin", @@ -58765,18 +58758,49 @@

    Request samples

  • "password": - "Password""user_type": 1,
  • - - } - - +
  • +
    + "status": + "ACTIVE", +
    +
  • +
  • +
    + "visibility": + "PUBLIC", +
    +
  • +
  • +
    + "organization_id": 1 +
    +
  • + + } + + @@ -58790,32 +58814,21 @@

    Response samples

    -
    @@ -58856,8 +58869,8 @@

    Response samples

    >"message": "User logged in - successfully.""Roles added + successfully", @@ -58881,10 +58894,10 @@

    Response samples

    > "access_token""title": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImlkIjo3LCJlbWFpbCI6ImhpbGJlcnQyOUB5YWhvby5jb20iLCJuYW1lIjoiQWRlbGlhIiwicm9sZXMiOlt7ImlkIjoyLCJ0aXRsZSI6Im1lbnRvciIsInVzZXJfdHlwZSI6MCwic3RhdHVzIjoiYWN0aXZlIn1dfSwiaWF0IjoxNjkwMjg2Nzg2LCJleHAiOjE2OTAzNzMxODZ9.0_Yi8yEu_G04VNJvVvafWMvO-Eb9TVsoCnp_pfrFVi8""system_admin",Response samples > "refresh_token""user_type": + 1, +
    + +
  • + +
  • +
  • + +
  • + + }, +
    + +
  • +
    + "meta": + { +
      +
    • + +
    • +
    • +
    • @@ -59506,20 +59027,14 @@

      Response samples

  • -
    @@ -59527,30 +59042,59 @@

    Response samples

    Generates access token. + >Update User Roles

    -

    - This API is associated with re-login and generating access token from - refresh token -

    +

    Use this API to update an user Role.

      -
    • - Then Endpoint for generating access token - /user/v1/account/generateToken -
    • -
    • - It is mandatory to provide values for parameters marked with - required -
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • Endpoint: /user/v1/userRole/update/{id}
    • +
    • Provide values for parameters marked as required.
    • +
    • The X-auth-token is mandatory and cannot be empty or null.
    +
    +
    + path + Parameters +
    +
    + email + >title
    required
    @@ -58595,18 +58556,34 @@
    string +
    + +
    + user_type +
    required
    +
    +
    -
    -

    Email Id of user

    -
    + number
    +
    +
    password + >status
    required
    @@ -58615,11 +58592,47 @@
    string +
    + +
    + visibility +
    required
    +
    +
    -
    -

    Password of user

    -
    + string +
    +
    +
    +
    + organization_id +
    required
    +
    +
    +
    + number
    +
    + + + + + + +
    + id +
    required
    +
    +
    +
    + integer +
    +
    + + Example: + + 1 +
    +
    +
    +

    Please append a valid user ID to the request URL.

    +
    +
    +
    +
    +
    header @@ -59579,8 +59123,7 @@

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. + Access token obtained from the login API response.

    @@ -59596,14 +59139,47 @@
    - + + + + + + + + + + + + + + + + + @@ -59637,62 +59249,10 @@

    Responses

    200

    ok

    - - -
    - -
    -
    - -
    -
    -
    @@ -59701,7 +59261,7 @@

    Responses

    @@ -59731,7 +59291,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/account/generateToken + >/user/v1/userRole/update/{id}
    @@ -59744,10 +59304,10 @@

    Request samples

  • "refresh_token""title": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyODMyNTMxYTA1Y2JkNTdiMjczYWViYiIsImVtYWlsIjoiYW5raXQuc0BwYWNld2lzZG9tLmNvbSIsIm5hbWUiOiJBbmtpdCIsImlzQU1lbnRvciI6dHJ1ZX0sImlhdCI6MTY1MzAxMDYxNCwiZXhwIjoxNjY4ODIxODE0fQ.hrIiKz3envHDPauVXSmA_BO_KKzWJAePsP3xD8l851s""system_", +
    +
  • +
  • +
    + "user_type": 1, +
    +
  • +
  • +
    + "status": + "ACTIVE", +
    +
  • +
  • +
    + "visibility": + "PUBLIC",
  • +
  • +
    + "organization_id": 3 +
    +
  • } @@ -59808,54 +59411,21 @@

    Response samples

    - - -
    @@ -59896,7 +59466,7 @@

    Response samples

    >"message": "Access token generated + >"Roles updated successfully",Response samples > "access_token""title": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyODMyNTMxYTA1Y2JkNTdiMjczYWViYiIsImVtYWlsIjoiYW5raXQuc0BwYWNld2lzZG9tLmNvbSIsIm5hbWUiOiJBbmtpdCIsImlzQU1lbnRvciI6dHJ1ZX0sImlhdCI6MTY1MzAxMDk4NCwiZXhwIjoxNjUzMDk3Mzg0fQ.BOZ_d6xNxuAJZ1ubdj94mCeO4jwXsC7t9JT4KXECVN""system_",
    - - } -
    - - - } -
    - - - - - -
    -
    -
    +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • + + }, + + +
  • +
    + "meta": + { +
      +
    • + +
    • +
    • + +
    • +
    + } +
    +
  • + + } + + + + + +
    @@ -59974,27 +59639,68 @@

    Response samples

    Generate OTP + >Delete User Role

    -

    This API is associated with generating OTP

    +

    This API is associated with deleting an role.

    • - Then Endpoint for generating OTP - user/v1/account/generateOtp + Endpoint for deleting a user role: + /user/v1/userRole/delete/{id}.
    • It is mandatory to provide values for parameters marked with - required + required.
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • Mandatory parameters cannot be empty or null.
    +
    +
    + path + Parameters +
    +
    + title +
    required
    +
    +
    +
    + string +
    +
    +
    +
    refresh_token + >user_type +
    required
    +
    +
    +
    + number +
    +
    +
    +
    + status +
    required
    @@ -59611,11 +59187,47 @@
    string
    +
    + +
    + visibility +
    required
    +
    +
    -
    -

    Refresh token.

    -
    + string +
    +
    +
    +
    + organization_id +
    required
    +
    +
    +
    + number
    +
    + + + + + + +
    + id +
    required
    +
    +
    +
    + integer +
    +
    + + Example: + + 31 +
    +
    +
    +

    + Please append a valid user role ID to the request + URL. +

    +
    +
    +
    +
    +
    header @@ -60023,8 +59729,8 @@

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. + To use the API, include X-auth-token. This is + available in the login API response.

    @@ -60034,54 +59740,6 @@
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - -
    - email -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Email Id of user

    -
    -
    -
    -
    - password -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Password of user

    -
    -
    -
    -

    Responses

    @@ -60098,44 +59756,8 @@

    Responses

    200

    ok

    - -
    -
    - -
    -
    -
    @@ -60143,8 +59765,8 @@

    Responses

    @@ -60174,83 +59796,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/account/generateOtp -
    -
    -
    -
    -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "email": - "example@mail.com", -
      -
    • -
    • -
      - "password": - "Password" -
      -
    • -
    - }
    -
    -
    -
    + >/user/v1/userRole/delete/{id}
    @@ -60263,43 +59809,21 @@

    Response samples

    - -
    @@ -60340,10 +59864,8 @@

    Response samples

    >"message": "OTP has been sent to your - registered email ID. Please enter - the number to update your - password.""Module deleted + successfully", @@ -60355,10 +59877,58 @@

    Response samples

    >"result": [ ]{ },
    +
  • +
    + "meta": + { +
      +
    • + +
    • +
    • + +
    • +
    + } +
    +
  • } @@ -60368,26 +59938,24 @@

    Response samples

    -
    -
    +
    +
    +
    +

    + User APIs +

    +
    +
    +
    @@ -60395,76 +59963,38 @@

    Response samples

    Reset password + >Create user

    -

    This API is associated with reset password

    +

    This Api is associated with Create User on mentoring

    • - Then Endpoint for reset password - user/v1/account/resetPassword + Then Endpoint for creating user /user/v1/account/create
    • - It is mandatory to provide values for parameters marked with + It is mandatory to provide values for parameter marked with required
    • Mandatory parameter cannot be empty or null
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    Request Body schema: application/json
    -
    +
    +

    Request body consist of metadata and accepts payload as JSON

    +
    - - - + + + + + + + + +
    + email + >name
    required
    @@ -60475,16 +60005,16 @@
    -

    Email Id of user

    +

    Name of the user

    + password + >email
    required
    @@ -60495,27 +60025,75 @@
    -

    New password of user

    +

    Email Id of user

    + password +
    required
    +
    +
    +
    + string + <password> + +
    +
    +
    +

    Password of user

    +
    +
    +
    +
    otp -
    required
    number + >string
    -

    OTP sent on mail

    +

    Email OTP for verification

    +
    +
    +
    +
    + has_accepted_terms_and_conditions + +
    +
    + boolean +
    +
    +
    +

    + Flag specifiying if user has accepted the terms & + conditions +

    @@ -60540,7 +60118,7 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >200

    ok

    + >

    OK. User created.

    @@ -60558,7 +60136,7 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >400

    Bad Request

    + >

    Bad Request. OTP is invalid

    @@ -60575,8 +60153,10 @@

    Responses

    401

    Bad Request

    + >406

    Not Acceptable. User already exists.

    +
    @@ -60585,7 +60165,7 @@

    Responses

    @@ -60615,7 +60195,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/account/resetPassword + >/user/v1/account/create
    @@ -60628,10 +60208,10 @@

    Request samples

    @@ -60791,8 +60394,8 @@

    Response samples

    >"message": "Password reset - successfully.""Sign-up successful Please + wait while logging in.", @@ -60819,7 +60422,7 @@

    Response samples

    >"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImlkIjo5LCJlbWFpbCI6ImJyYW5keW4udGVycnlAeWFob28uY29tIiwibmFtZSI6IkFzaGx5Iiwicm9sZXMiOlt7ImlkIjoyLCJ0aXRsZSI6Im1lbnRvciIsInVzZXJfdHlwZSI6MCwic3RhdHVzIjoiYWN0aXZlIn1dfSwiaWF0IjoxNjkwMjg1NzE4LCJleHAiOjE2OTAzNzIxMTh9.WmhUXIocykrBVti7vtznx_BMAaBtuqYUks4sc1J94Do""eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",Response samples >"refresh_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImlkIjo5LCJlbWFpbCI6ImJyYW5keW4udGVycnlAeWFob28uY29tIiwibmFtZSI6IkFzaGx5Iiwicm9sZXMiOlt7ImlkIjoyLCJ0aXRsZSI6Im1lbnRvciIsInVzZXJfdHlwZSI6MCwic3RhdHVzIjoiYWN0aXZlIn1dfSwiaWF0IjoxNjkwMjg1NzE4LCJleHAiOjE3MDYwOTY5MTh9.eqJ-KD0YA-Cdpz3XHWKgmi66uU6o229K9pyp6BwAAzI""eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",Response samples >: 98,Response samples >: "brandyn.terry@yahoo.com""example@mail.com",Response samples >"email_verified": true"true",Response samples >: "Ashly", -
    - -
  • - -
  • -
  • - -
  • -
  • -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • @@ -61230,23 +60642,6 @@

    Response samples

    >
    -
  • - -
  • @@ -61436,8 +60831,8 @@

    Response samples

    @@ -61445,77 +60840,55 @@

    Response samples

    Logout + >Login

    -

    This API is associated with logout

    +

    This API is associated with logging in a user.

      -
    • Then Endpoint for logout /user/v1/account/logout
    • +
    • Endpoint for logging in a user: /user/v1/account/login
    • - It is mandatory to provide values for parameters marked with - required + It is mandatory to provide values for parameters marked as + required.
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • Mandatory parameters cannot be empty or null.
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    Request Body schema: application/json
    -
    +

    Request body for user login

    + + + + -
    + email +
    required
    +
    +
    +
    + string +
    +
    +
    +

    Email address of the user

    +
    +
    +
    +
    + refresh_token + >password +
    required
    @@ -61525,7 +60898,7 @@
    -

    Refresh token.

    +

    User password

    @@ -61550,7 +60923,9 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >200

    ok

    + >

    OK. User successfully logged in.

    +
    @@ -61568,25 +60943,9 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >400

    Bad Request

    - -
    -
    -
    @@ -61595,7 +60954,7 @@

    Responses

    @@ -61625,7 +60984,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/account/logout + >/user/v1/account/login
    @@ -61638,10 +60997,10 @@

    Request samples

  • "refresh_token": - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyODMyNTMxYTA1Y2JkNTdiMjczYWViYiIsImVtYWlsIjoiYW5raXQuc0BwYWNld2lzZG9tLmNvbSIsIm5hbWUiOiJBbmtpdCIsImlzQU1lbnRvciI6dHJ1ZX0sImlhdCI6MTY1MzAxMDYxNCwiZXhwIjoxNjY4ODIxODE0fQ.hrIiKz3envHDPauVXSmA_BO_KKzWJAePsP3xD8l851s" -
    -
  • - - } - - - - - - - - -
    -

    Response samples

    -
    -
      - - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode""email": "OK""example@mail.com", @@ -61776,23 +61048,10 @@

      Response samples

    • "message""password": "User logged out - successfully.", -
      -
    • -
    • -
      - "result": - [ ]"Password"
    • @@ -61805,179 +61064,6 @@

      Response samples

    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Depreciated APIs -

    -
    -
    -
    -
    -
    -
    -

    - Terms & Condition -

    -
    -
    -

    - This API Requires only X-auth-token and it will set an email to verify true. -

    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - -
    @@ -61987,10 +61073,10 @@

    Response samples

    -
  • -
    - "result": - [ ] -
    -
  • - - }
    -
    -
    -
    -
    - - -
    - - - - - -
    -
    -
    -

    - Users APIs -

    -
    -
    -
    -
    -
    -
    -

    - List user -

    -
    -
    -

    This API is associated with the listing of users based on condition

    -
      -
    • Endpoint for list user /user/v1/account/list
    • -
    • - It is mandatory to provide values for parameters marked with - required -
    • -
    • Mandatory parameter cannot be empty or null
    • -
    -
    -
    -
    -
    - query - Parameters -
    - - - - - - - - - - - - - - - - - - - -
    - userType -
    required
    -
    -
    -
    - string -
    -
    - - Example: - - userType=mentor -
    -
    -
    -

    Type of user

    -
    -
    -
    -
    - page - -
    -
    - number -
    -
    - - Example: - - page=1 -
    -
    -
    -

    Please add page number

    -
    -
    -
    -
    - limit - -
    -
    - number -
    -
    - - Example: - - limit=2 -
    -
    -
    -

    number of record to limit

    -
    -
    -
    -
    - search - -
    -
    - string -
    -
    - - Example: - - search=john -
    -
    -
    -

    Please search for name or title of user etc.

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Mentor list fetched - successfully.""User logged in + successfully.", @@ -62455,7 +61164,39 @@

      Response samples

      > "data""access_token": + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImlkIjo3LCJlbWFpbCI6ImhpbGJlcnQyOUB5YWhvby5jb20iLCJuYW1lIjoiQWRlbGlhIiwicm9sZXMiOlt7ImlkIjoyLCJ0aXRsZSI6Im1lbnRvciIsInVzZXJfdHlwZSI6MCwic3RhdHVzIjoiYWN0aXZlIn1dfSwiaWF0IjoxNjkwMjg2Nzg2LCJleHAiOjE2OTAzNzMxODZ9.0_Yi8yEu_G04VNJvVvafWMvO-Eb9TVsoCnp_pfrFVi8", +
      +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    + } +
    + + + } +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +

    + Generate Access Token +

    +
    +
    +

    + This API is for re-login and generating an access token from a refresh + token. +

    +
      +
    • + Endpoint for generating token + /user/v1/account/generateToken +
    • +
    • + Mandatory parameters marked as required must have valid + values. +
    • +
    • Parameters cannot be empty or null.
    • +
    +
    +
    +
    +
    + header + Parameters +
    + + + + + + + +
    + X-auth-token +
    required
    +
    +
    +
    + string +
    +
    +
    +

    + To use the API, you require X-auth-token, available + in the login API response. +

    +
    +
    +
    +
    +
    +
    + Request Body schema: application/json +
    +
    + + + + + + + +
    + refresh_token +
    required
    +
    +
    +
    + string +
    +
    +
    +

    Refresh token.

    +
    +
    +
    +
    +
    +

    Responses

    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + + +
    +
    +

    Request samples

    +
    +
      + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "refresh_token": + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyODMyNTMxYTA1Y2JkNTdiMjczYWViYiIsImVtYWlsIjoiYW5raXQuc0BwYWNld2lzZG9tLmNvbSIsIm5hbWUiOiJBbmtpdCIsImlzQU1lbnRvciI6dHJ1ZX0sImlhdCI6MTY1MzAxMDYxNCwiZXhwIjoxNjY4ODIxODE0fQ.hrIiKz3envHDPauVXSmA_BO_KKzWJAePsP3xD8l851s" +
      +
    • +
    + }
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Response samples

    +
    +
      + + + + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "responseCode": + "OK", +
      +
    • +
    • +
      + "message": + "Access token generated + successfully", +
      +
    • +
    • +
      + "result": + { +
        +
      • + +
      • +
      + } +
      +
    • +
    + }
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    + Generate OTP +

    +
    +
    +

    This API is for generating OTP.

    +
      +
    • Endpoint: /user/v1/account/generateOtp
    • +
    • + Mandatory parameters marked as required must have valid + values. +
    • +
    • Parameters cannot be empty or null.
    • +
    +
    +
    +
    +
    + header + Parameters +
    + + + + + + + +
    + X-auth-token +
    required
    +
    +
    +
    + string +
    +
    +
    +

    + To make use of the API, you require X-auth-token. + This is Available in login API Response. +

    +
    +
    +
    +
    +
    +
    + Request Body schema: application/json +
    +
    + + + + + + + + + + + +
    + email +
    required
    +
    +
    +
    + string +
    +
    +
    +

    Email address of the user

    +
    +
    +
    +
    + password +
    required
    +
    +
    +
    + string +
    +
    +
    +

    User password

    +
    +
    +
    +
    +
    +

    Responses

    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + + +
    +
    +

    Request samples

    +
    +
      + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "email": + "example@mail.com", +
      +
    • +
    • +
      + "password": + "Password" +
      +
    • +
    + }
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Response samples

    +
    +
      + + + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "responseCode": + "OK", +
      +
    • +
    • +
      + "message": + "OTP has been sent to your + registered email ID. Please enter + the number to update your + password.", +
      +
    • +
    • +
      + "result": + [ ] +
      +
    • +
    + }
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    + Reset Password +

    +
    +
    +

    This API is for resetting the user password.

    +
      +
    • Endpoint: /user/v1/account/resetPassword
    • +
    • + Mandatory parameters marked as required must have valid + values. +
    • +
    • Parameters cannot be empty or null.
    • +
    +
    +
    +
    +
    + header + Parameters +
    + + + + + + + +
    + X-auth-token +
    required
    +
    +
    +
    + string +
    +
    +
    +

    + To make use of the API, you require X-auth-token. + This is Available in login API Response. +

    +
    +
    +
    +
    +
    +
    + Request Body schema: application/json +
    +
    + + + + + + + + + + + + + + + +
    + email +
    required
    +
    +
    +
    + string +
    +
    +
    +

    Email address of the user

    +
    +
    +
    +
    + password +
    required
    +
    +
    +
    + string +
    +
    +
    +

    New password of the user

    +
    +
    +
    +
    + otp +
    required
    +
    +
    +
    + number +
    +
    +
    +

    OTP sent to the user's email

    +
    +
    +
    +
    +
    +

    Responses

    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + + +
    +
    +

    Request samples

    +
    +
      + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "email": + "example@mail.com", +
      +
    • +
    • +
      + "password": + "New password", +
      +
    • +
    • +
      + "otp": + 123456 +
      +
    • +
    + }
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Response samples

    +
    +
      + + + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "responseCode": + "OK", +
      +
    • +
    • +
      + "message": + "Password reset + successfully.", +
      +
    • +
    • +
      + "result": + { +
        +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      + } +
      +
    • +
    + }
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    + Logout +

    +
    +
    +

    This API is for logging out a user.

    +
      +
    • Endpoint: /user/v1/account/logout
    • +
    • + Mandatory parameters marked as required must have valid + values. +
    • +
    • Parameters cannot be empty or null.
    • +
    +
    +
    +
    +
    + header + Parameters +
    + + + + + + + +
    + X-auth-token +
    required
    +
    +
    +
    + string +
    +
    +
    +

    + To make use of the API, you require X-auth-token. + This is Available in login API Response. +

    +
    +
    +
    +
    +
    +
    + Request Body schema: application/json +
    +
    + + + + + + + +
    + refresh_token + +
    +
    + string +
    +
    +
    +

    Refresh token.

    +
    +
    +
    +
    +
    +

    Responses

    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + + +
    +
    +

    Request samples

    +
    +
      + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "refresh_token": + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyODMyNTMxYTA1Y2JkNTdiMjczYWViYiIsImVtYWlsIjoiYW5raXQuc0BwYWNld2lzZG9tLmNvbSIsIm5hbWUiOiJBbmtpdCIsImlzQU1lbnRvciI6dHJ1ZX0sImlhdCI6MTY1MzAxMDYxNCwiZXhwIjoxNjY4ODIxODE0fQ.hrIiKz3envHDPauVXSmA_BO_KKzWJAePsP3xD8l851s" +
      +
    • +
    + }
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Response samples

    +
    +
      + + + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "responseCode": + "OK", +
      +
    • +
    • +
      + "message": + "User logged out + successfully.", +
      +
    • +
    • +
      + "result": + [ ] +
      +
    • +
    + }
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    + Registration OTP +

    +
    +
    +

    This API is for registration OTP.

    +
      +
    • Endpoint: /user/v1/account/registrationOtp
    • +
    • + Mandatory parameters marked as required must have valid + values. +
    • +
    • Parameters cannot be empty or null.
    • +
    +
    +
    +
    +
    + header + Parameters +
    + + + + + + + +
    + X-auth-token +
    required
    +
    +
    +
    + string +
    +
    +
    +

    + To make use of the API, you require X-auth-token. + This is Available in login API Response. +

    +
    +
    +
    +
    +
    +
    + Request Body schema: application/json +
    +
    + + + + + + + + + + + + + + + +
    + name + +
    +
    + string +
    +
    +
    +
    + email + +
    +
    + string +
    +
    +
    +
    + password + +
    +
    + string +
    +
    +
    +
    +
    +

    Responses

    +
    + +
    +
    + +
    +
    + +
    +
    +
    +
    +
    + + +
    +
    +

    Request samples

    +
    +
      + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "name": + "Anu", +
      +
    • +
    • +
      + "email": + "anu@gmail.com", +
      +
    • +
    • +
      + "password": + "password" +
      +
    • +
    + }
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Response samples

    +
    +
      + + + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "responseCode": + "OK", +
      +
    • +
    • +
      + "message": + "OTP has been sent to your + registered email ID. Please enter + the otp to complete the registration + process.", +
      +
    • +
    • +
      + "result": + [ ] +
      +
    • +
    + }
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    + Depreciated APIs +

    +
    +
    +
    +
    +
    +
    +

    + Terms & Condition +

    +
    +
    +

    + This API sets the 'email_verified' field to true using only the + X-auth-token. +

    +
      +
    • Endpoint: /user/v1/account/acceptTermsAndCondition
    • +
    • Requires a valid X-auth-token from the login API response.
    • +
    +
    +
    +
    +
    + header + Parameters +
    + + + + + + + +
    + X-auth-token +
    required
    +
    +
    +
    + string +
    +
    +
    +

    + To make use of the API, you require X-auth-token. + This is Available in login API Response. +

    +
    +
    +
    +
    +
    +
    +

    Responses

    +
    + +
    +
    + +
    +
    +
    +
    +
    + + +
    +
    +

    Response samples

    +
    +
      + + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "responseCode": + "OK", +
      +
    • +
    • +
      + "message": + "User successfully + updated.", +
      +
    • +
    • +
      + "result": + [ ] +
      +
    • +
    + }
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    + Users APIs +

    +
    +
    +
    +
    +
    +
    +

    + List user +

    +
    +
    +

    This API lists users based on specified conditions.

    +
      +
    • Endpoint: /user/v1/account/list
    • +
    • + Mandatory parameters marked as required must have valid + values. +
    • +
    • Parameters cannot be empty or null.
    • +
    +
    +
    +
    +
    + query + Parameters +
    + + + + + + + + + + + + + + + + + + + +
    + userType +
    required
    +
    +
    +
    + string +
    +
    + + Example: + + userType=mentor +
    +
    +
    +

    Type of user

    +
    +
    +
    +
    + page + +
    +
    + number +
    +
    + + Example: + + page=1 +
    +
    +
    +

    Page number for pagination.

    +
    +
    +
    +
    + limit + +
    +
    + number +
    +
    + + Example: + + limit=2 +
    +
    +
    +

    Number of records to limit.

    +
    +
    +
    +
    + search + +
    +
    + string +
    +
    + + Example: + + search=john +
    +
    +
    +

    Search for name or title of user, etc.

    +
    +
    +
    +
    +
    +
    +
    + header + Parameters +
    + + + + + + + +
    + X-auth-token +
    required
    +
    +
    +
    + string +
    +
    +
    +

    + To make use of the API, you require X-auth-token. + This is Available in login API Response. +

    +
    +
    +
    +
    +
    +
    +

    Responses

    +
    + +
    +
    +
    +
    +
    + + +
    +
    +

    Response samples

    +
    +
      + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    + User Details +

    +
    +
    +

    This API retrieves details of a user's profile.

    +
      +
    • Endpoint: /user/v1/user/read/{userId}
    • +
    • + Mandatory parameters marked as required must have valid + values. +
    • +
    • Parameters cannot be empty or null.
    • +
    +
    +
    +
    +
    + path + Parameters +
    + + + + + + + +
    + userId +
    required
    +
    +
    +
    + integer +
    +
    + + Example: + + 1 +
    +
    +
    +

    Please append a valid User ID to the Request URL.

    +
    +
    +
    +
    +
    +
    +
    + header + Parameters +
    + + + + + + + +
    + X-auth-token +
    required
    +
    +
    +
    + string +
    +
    +
    +

    + To make use of the API, you require X-auth-token. + This is Available in login API Response. +

    +
    +
    +
    +
    +
    +
    +

    Responses

    +
    + +
    +
    + +
    +
    +
    +
    +
    + + +
    +
    +

    Response samples

    +
    +
      + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "responseCode": + "OK", +
      +
    • +
    • +
      + "message": + "Profile fetched + successfully.", +
      +
    • +
    • +
      + "result": + { +
        +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • +
      @@ -62668,68 +66391,24 @@

      Response samples

      User details + >Update User Profile

      -

      This API is associated with the user's profile details

      +

      This API updates a user's profile.

        +
      • Endpoint: /user/v1/user/update
      • - Then Endpoint for user profile details /user/v1/user/read/ -
      • -
      • - It is mandatory to provide values for parameters marked with - required + Mandatory parameters marked as required must have valid + values.
      • -
      • Mandatory parameter cannot be empty or null
      • +
      • Parameters cannot be empty or null.
      -
      -
      - path - Parameters -
      - - - - - - - -
      - userId -
      required
      -
      -
      -
      - integer -
      -
      - - Example: - - 1 -
      -
      -
      -

      Please append a valid User Id To the Request URL

      -
      -
      -
      -
      -
      header @@ -62769,6 +66448,131 @@
    +
    + Request Body schema: application/json +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + name + +
    +
    + string +
    +
    +
    +

    The user's name.

    +
    +
    +
    +
    + location + +
    +
    + Array of strings +
    +
    +
    +
    + about + +
    +
    + string +
    +
    +
    +

    A brief description about the user.

    +
    +
    +
    +
    + has_accepted_terms_and_conditions + +
    +
    + boolean +
    +
    +
    +

    + Indicates whether the user has accepted terms and + conditions. +

    +
    +
    +
    +
    + gender + +
    +
    + string +
    +
    +
    +

    The user's gender.

    +
    +
    +
    +
    + image + +
    +
    + string +
    +
    +
    +

    URL of the user's profile image.

    +
    +
    +
    +

    Responses

    @@ -62786,7 +66590,9 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >200

    ok

    + >

    OK. User profile updated successfully.

    +
    @@ -62804,7 +66610,9 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >401

    Unauthorized

    + >

    Unauthorized. X-auth-token is either missing or invalid.

    +
    @@ -62812,8 +66620,8 @@

    Responses

    @@ -62843,7 +66651,152 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/user/read/{userId} + >/user/v1/user/update +
    +
    +
    +
    + +
    +

    Request samples

    +
    +
      + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "name": + "John", +
      +
    • +
    • +
      + "location": + [ +
        +
      • + +
      • +
      + ], +
      +
    • +
    • +
      + "about": + "Experienced + Teacher", +
      +
    • +
    • +
      + "has_accepted_terms_and_conditions": + true, +
      +
    • +
    • +
      + "gender": + "male", +
      +
    • +
    • + +
    • +
    + }
    +
    +
    +
    @@ -62856,10 +66809,10 @@

    Response samples

    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • -
  • + +
  • + "created_at": - "2022-05-18T05:24:52.431Z", -
    - -
  • -
  • @@ -63477,8 +67273,8 @@

    Response samples

    @@ -63486,8 +67282,8 @@

    Response samples

    @@ -63495,26 +67291,69 @@

    Response samples

    Update user + >Share Mentor Profile

    -

    This API is associated with update user profile

    +

    This API is associated with sharing a mentor's profile.

    • - Then Endpoint for update user profile /user/v1/user/update + Endpoint for sharing a mentor's profile: + /user/v1/user/share/{userId}
    • - It is mandatory to provide values for parameters marked with - required + Mandatory parameters marked as required must have valid + values.
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • Parameters cannot be empty or null.
    +
    +
    + path + Parameters +
    + + + + + + + +
    + userId +
    required
    +
    +
    +
    + string +
    +
    + + Example: + + 1 +
    +
    +
    +

    Please append a valid User ID to the Request URL.

    +
    +
    +
    +
    +
    header @@ -63554,108 +67393,6 @@
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - name - -
    -
    - string -
    -
    -
    -
    - location - -
    -
    - Array of strings -
    -
    -
    -
    - about - -
    -
    - string -
    -
    -
    -
    - has_accepted_terms_and_conditions - -
    -
    - boolean -
    -
    -
    -
    - gender - -
    -
    - string -
    -
    -
    -
    - image - -
    -
    - string -
    -
    -
    -

    Responses

    @@ -63673,7 +67410,29 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >200

    ok

    + >

    OK. Mentor profile shared successfully.

    +
    + +
    +
    +
    @@ -63691,7 +67450,9 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >401

    Unauthorized

    + >

    Unauthorized. X-auth-token is either missing or invalid.

    +
    @@ -63699,8 +67460,8 @@

    Responses

    @@ -63730,34 +67491,56 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/user/update + >/user/v1/user/share/{userId}
    -

    Request samples

    +

    Response samples

      + +
    @@ -63783,10 +67566,10 @@

    Request samples

  • "name""responseCode": "Jhon""OK", @@ -63795,79 +67578,43 @@

    Request samples

  • "location""message": + "Profile share link generated + successfully.", +
    +
  • +
  • +
    + "result": [{ -
      +
      - ], -
    -
  • -
  • -
    - "about": - "This is test about of - mentee", -
    -
  • -
  • -
    - "has_accepted_terms_and_conditions": - true, -
    -
  • -
  • -
    - "gender": - "male", -
    -
  • -
  • -
  • @@ -63879,6 +67626,222 @@

    Request samples

    +
    +
    +
    +
    + + + +
    +
    +
    +

    + Cloud Services APIs +

    +
    +
    +
    +
    +
    +
    +

    + Cloud Services - Get Signed URL +

    +
    +
    +

    This API is associated with cloud services for obtaining a signed URL.

    +
      +
    • + Endpoint for cloud services: + /user/v1/cloud-services/file/getSignedUrl +
    • +
    • + Mandatory parameters marked as required must have valid + values. +
    • +
    • Parameters cannot be empty or null.
    • +
    +
    +
    +
    +
    + path + Parameters +
    + + + + + + + +
    + file_name +
    required
    +
    +
    +
    + string +
    +
    + + Example: + + image.jpg +
    +
    +
    +

    + Please append a valid file name to the URL, + indicating the file to be uploaded. +

    +
    +
    +
    +
    +
    +
    +
    + header + Parameters +
    + + + + + + + +
    + X-auth-token +
    required
    +
    +
    +
    + string +
    +
    +
    +

    + To make use of the API, you require X-auth-token. + This is Available in login API Response. +

    +
    +
    +
    +
    +
    +
    +

    Responses

    +
    + +
    +
    +
    +
    +
    + +
    @@ -63888,32 +67851,21 @@

    Response samples

    -
    @@ -63954,385 +67906,72 @@

    Response samples

    >"message": "Profile updated - successfully.""Signed Url Generated + Successfully.", -
    - -
  • -
    - "result": - { -
  • -
    @@ -64370,23 +68003,26 @@

    Response samples

    Share mentor profile + >Cloud Services - Get Downloadable URL

    -

    This API is associated with Sharing mentor profile

    +

    + This API is associated with cloud services for obtaining a downloadable URL. +

    • - The Endpoint for user profile details /user/v1/user/share/ + Endpoint for cloud services: + /user/v1/cloud-services/file/getDownloadableUrl
    • - It is mandatory to provide values for parameters marked with - required + Mandatory parameters marked as required must have valid + values.
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • Parameters cannot be empty or null.
    @@ -64401,10 +68037,10 @@
    userId + >file_path
    required
    @@ -64419,11 +68055,16 @@
    Example: - 1 + users/62832531a05cbd57b273aebb-1654149589875-image.jpg
    -

    Please append a valid User Id To the Request URL

    +

    + Please append a valid file path to the URL, + indicating the file to be downloaded. +

    @@ -64488,43 +68129,9 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >200

    ok

    - - -
    - -
    -
    -
    @@ -64533,7 +68140,8 @@

    Responses

    @@ -64563,7 +68172,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/user/share/{userId} + >/user/v1/cloud-services/file/getDownloadableUrl?file_path={file_path}
    @@ -64576,43 +68185,21 @@

    Response samples

    - -
    @@ -64622,8 +68209,7 @@

    Response samples

    - +
    @@ -64653,8 +68239,8 @@

    Response samples

    >"message": "Profile share link generated - successfully.""Download Url Generated + Successfully.", @@ -64665,28 +68251,13 @@

    Response samples

    "result": - { -
      -
    • - -
    • -
    - } + "https://aws-bucket-storage-name.s3.ap-south-1.amazonaws.com/users/62832531a05cbd57b273aebb-1654149589875-image.jpg"
    @@ -64698,44 +68269,14 @@

    Response samples

    -
    -
    -
    -
    -

    - Cloud services APIs -

    -
    -
    -
    -
    @@ -64743,30 +68284,33 @@

    Cloud services get signed url + >Cloud Services - Get Sample CSV

    -

    This API is associated with the cloud services for getting signed URL

    +

    + This API is associated with cloud services for obtaining a sample CSV file + for bulk user create. +

    • - Then Endpoint for cloud services - /user/v1/cloud-services/file/getSignedUrl + Endpoint for cloud services: + /user/v1/cloud-services/file/getSampleCSV
    • - It is mandatory to provide values for parameters marked with - required + Mandatory parameters marked as required must have valid + values.
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • Parameters cannot be empty or null.
    - path + header Parameters
    @@ -64775,10 +68319,10 @@
    file_name + >X-auth-token
    required
    @@ -64789,19 +68333,11 @@
    >string -
    - - Example: - - image.jpg -

    - Please append a valid file name to url which has to - be uploaded + To make use of the API, you require X-auth-token. + This is Available in login API Response.

    @@ -64811,6 +68347,205 @@
    +
    +

    Responses

    +
    + +
    +
    +
    +
    +
    + + +
    +
    +

    Response samples

    +
    +
      + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { + + } +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +

    + Form APIs +

    +
    +
    +
    +
    +
    +
    +

    + Create Form +

    +
    +
    +

    This API is associated with creating a form.

    +
      +
    • Endpoint for creating a form: /user/v1/form/create
    • +
    • + Mandatory parameters marked as required must have valid + values. +
    • +
    • Parameters cannot be empty or null.
    • +
    +
    +
    header @@ -64850,6 +68585,93 @@
    +
    + Request Body schema: application/json +
    +
    + + + + + + + + + + + + + + + +
    + type +
    required
    +
    +
    +
    + string +
    +
    +
    +

    The type of the form.

    +
    +
    +
    +
    + sub_type +
    required
    +
    +
    +
    + string +
    +
    +
    +

    The sub-type or category of the form.

    +
    +
    +
    +
    + +
    required
    +
    +
    +
    + object +
    +
    +
    +

    The main data structure for the form.

    +
    +
    +
    +

    Responses

    @@ -64867,7 +68689,29 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >200

    ok

    + >

    OK. Form created successfully.

    +
    + +
    +
    +
    @@ -64875,9 +68719,8 @@

    Responses

    @@ -64908,34 +68750,34 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/cloud-services/file/getSignedUrl?fileName={file_name} + >/user/v1/form/create
    -

    Response samples

    +

    Request samples

    @@ -64961,10 +68803,10 @@

    Response samples

  • "responseCode""type": "OK""profile", @@ -64973,11 +68815,10 @@

    Response samples

  • "message""sub_type": "Signed Url Generated - Successfully.""profileForm", @@ -64986,7 +68827,7 @@

    Response samples

  • -
  • -
  • -
  • @@ -65060,192 +69106,6 @@

    Response samples

    -
    -
    -
    -
    -
    -
    -

    - Cloud services get download url -

    -
    -
    -

    - This API is associated with the cloud services for getting downloadable URL -

    -
      -
    • - Then Endpoint for cloud services - /user/v1/cloud-services/file/getDownloadableUrl -
    • -
    • - It is mandatory to provide values for parameters marked with - required -
    • -
    • Mandatory parameter cannot be empty or null
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - file_path -
    required
    -
    -
    -
    - string -
    -
    - - Example: - - users/62832531a05cbd57b273aebb-1654149589875-image.jpg -
    -
    -
    -

    - Please append a valid file path to url which has to - be downloaded -

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -

    Response samples

    @@ -65253,21 +69113,32 @@

    Response samples

    +
    @@ -65277,7 +69148,8 @@

    Response samples

    - +
    @@ -65307,8 +69179,8 @@

    Response samples

    >"message": "Download Url Generated - Successfully.""Form created + successfully", @@ -65319,12 +69191,8 @@

    Response samples

    "result": - "https://aws-bucket-storage-name.s3.ap-south-1.amazonaws.com/users/62832531a05cbd57b273aebb-1654149589875-image.jpg"[ ]
    @@ -65337,24 +69205,20 @@

    Response samples

    +
    -
    -
    -
    -

    - Form APIs -

    -
    -
    -
    @@ -65362,24 +69226,68 @@

    Create form + >Update Form

    -

    This API is associated with create form

    +

    This API is associated with updating a form.

      -
    • Then Endpoint for create form /user/v1/form/create
    • - It is mandatory to provide values for parameters marked with - required + Endpoint for updating a form: /user/v1/form/update/{formId}
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • + Mandatory parameters marked as required must have valid + values. +
    • +
    • Parameters cannot be empty or null.
    +
    +
    + path + Parameters +
    + + + + + + + +
    + formId +
    required
    +
    +
    +
    + string +
    +
    + + Example: + + 1 +
    +
    +
    +

    Please append a valid form ID to the request URL.

    +
    +
    +
    +
    +
    header @@ -65437,7 +69345,11 @@
    string
    -
    +
    +
    +

    The type of the form.

    +
    +
    @@ -65453,7 +69365,11 @@
    string
    -
    +
    +
    +

    The sub-type or category of the form.

    +
    +
    @@ -65488,7 +69404,11 @@
    object
    -
    +
    +
    +

    The main data structure for the form.

    +
    +
    @@ -65511,7 +69431,9 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >200

    ok

    + >

    OK. Form updated successfully.

    +
    @@ -65529,7 +69451,9 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >400

    Bad Request

    + >

    Bad Request. Invalid input or missing required parameters.

    +
    @@ -65537,8 +69461,8 @@

    Responses

    @@ -65568,7 +69492,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/form/create + >/user/v1/form/update/{formId}
    @@ -65581,10 +69505,10 @@

    Request samples

    + +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "type": + "profile", +
      +
    • +
    • +
      + "sub_type": + "profileForm" +
      +
    • +
    + }
    +
    +
    +
    +
    +
    +
    + + +
    +

    Response samples

    +
    +
      + +
    @@ -66347,10 +70334,10 @@

    Request samples

  • "type""responseCode": "profile""OK", @@ -66359,10 +70346,11 @@

    Request samples

  • "sub_type""message": "profileForm""Form fetched + successfully", @@ -66371,7 +70359,7 @@

    Request samples

  • "data""result":
    +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • +
  • @@ -66648,6 +70745,334 @@

    Request samples

    +
    +
    +
    + + + +
    +
    +
    +

    + Admin APIs +

    +
    +
    +
    +
    +
    +
    +

    + Create Admin User +

    +
    +
    +

    API associated with creating a new admin user.

    +
      +
    • + Endpoint for creating a system user: /user/v1/admin/create +
    • +
    • + Mandatory parameters marked as required must have valid + values. +
    • +
    • Parameters cannot be empty or null.
    • +
    +
    +
    +
    + Request Body schema: application/json +
    +
    + + + + + + + + + + + + + + + + + + + +
    + name +
    required
    +
    +
    +
    + string +
    +
    +
    +

    Name of the system user.

    +
    +
    +
    +
    + email +
    required
    +
    +
    +
    + string +
    +
    +
    +

    Email of the system user.

    +
    +
    +
    +
    + password +
    required
    +
    +
    +
    + string + <password> + +
    +
    +
    +

    Password for the system user.

    +
    +
    +
    +
    + secret_code +
    required
    +
    +
    +
    + string +
    +
    +
    +

    Secret code for system user creation.

    +
    +
    +
    +
    +
    +

    Responses

    +
    + +
    +
    + +
    +
    +
    +
    +
    + + +
    +
    +

    Request samples

    +
    +
      + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "name": + "John Deo", +
      +
    • +
    • +
      + "email": + "systemuser@mail.com", +
      +
    • +
    • +
      + "password": + "password", +
      +
    • +
    • +
      + "secret_code": + "secret_code" +
      +
    • +
    + }
    +
    +
    +
    +
    +
    +
    @@ -66657,32 +71082,32 @@

    Response samples

    @@ -66723,8 +71148,8 @@

    Response samples

    >"message": "Form updated - successfully""Sign-up successful, Please + wait while logging in.", @@ -66752,8 +71177,8 @@

    Response samples

    @@ -66761,8 +71186,8 @@

    Response samples

    @@ -66770,109 +71195,24 @@

    Response samples

    Get form details + >Admin Login

    -

    This API is associated with update form

    +

    This API is associated with the login of the system user.

      +
    • Endpoint for login system user: /user/v1/admin/login
    • - Then Endpoint for update form /user/v1/form/update/{formId} -
    • -
    • - It is mandatory to provide values for parameters marked with - required + Mandatory parameters marked as required must have valid + values.
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • Parameters cannot be empty or null.
    -
    -
    - path - Parameters -
    - - - - - - - -
    - formId -
    required
    -
    -
    -
    - string -
    -
    - - Example: - - 62832531a05cbd57b273aebb -
    -
    -
    -

    Please append a valid form Id to the Request URL.

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    Request Body schema: application/json
    @@ -66880,9 +71220,10 @@
    - - @@ -66928,7 +71281,7 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >200

    ok

    + >

    OK. Successful login.

    @@ -66946,7 +71299,9 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >400

    Bad Request

    + >

    Bad Request. System User doesn't exist.

    +
    @@ -66955,7 +71310,7 @@

    Responses

    @@ -66985,7 +71340,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/form/read/{formId} + >/user/v1/admin/login
    @@ -66998,10 +71353,10 @@

    Request samples

  • "type""email": "profile""systemuser@mail.com", @@ -67049,10 +71404,10 @@

    Request samples

  • "sub_type""password": "profileForm""password"
  • @@ -67074,10 +71429,10 @@

    Response samples

    -
  • - -
  • -
  • - -
  • -
  • - +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • + + }, + + +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • +
  • @@ -67539,27 +72131,17 @@

    Response samples

    -
    -
    -
    -

    - Admin APIs -

    -
    -
    -
    @@ -67567,105 +72149,104 @@

    Create admin user + >Delete User

    -

    API associated with creating new admin user

    +

    Delete a user.

      +
    • Endpoint: /user/v1/admin/deleteUser
    • - Then Endpoint for create system user /user/v1/admin/create -
    • -
    • - It is mandatory to provide values for parameters marked with - required + Mandatory parameters marked as required must have valid + values.
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • Parameters cannot be empty or null.
    -
    - Request Body schema: application/json -
    -
    -
    + type + >email +
    required
    @@ -66890,22 +71231,34 @@
    string
    -
    +
    +
    +

    Email of the system user.

    +
    +
    + sub_type + >password +
    required
    string + >string + <password> + +
    +
    +
    +

    Password of the system user.

    +
    -
    - - - - - - - - - - - - + + +
    - name -
    required
    -
    -
    -
    - string -
    -
    -
    -
    - email -
    required
    -
    -
    -
    - string -
    -
    -
    -
    - password -
    required
    -
    -
    +
    +
    + path + Parameters +
    + + + + + - - - - + + +
    + id +
    required
    +
    - string - <password> - +
    + string +
    +
    + + Example: + + 1 +
    +
    +
    +

    + User ID to be deleted. Please append a valid user ID + to the request URL. +

    +
    +
    -
    - -
    - secret_code -
    required
    -
    -
    +
    +
    +
    +
    + header + Parameters +
    + + + + + - - -
    + X-auth-token +
    required
    +
    - string +
    + string +
    +
    +
    +

    + X-auth-token required for API access. Available in + login API Response. +

    +
    +
    -
    - -
    +
    +

    Responses

    @@ -67682,8 +72263,10 @@

    Responses

    201

    ok

    + >202

    Accepted. User deletion request received.

    +
    @@ -67700,9 +72283,9 @@

    Responses

    406 400

    Bad Request. System User alrady exist

    + >

    Bad Request. User Already Deleted.

    @@ -67711,8 +72294,8 @@

    Responses

    @@ -67742,107 +72325,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/admin/create -
    -
    -
    -
    -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "name": - "John Deo", -
      -
    • -
    • -
      - "email": - "systemuser@mail.com", -
      -
    • -
    • -
      - "password": - "password", -
      -
    • -
    • -
      - "secret_code": - "secret_code" -
      -
    • -
    - }
    -
    -
    -
    + >/user/v1/admin/deleteUser/{id}
    @@ -67855,32 +72338,32 @@

    Response samples

    @@ -67921,8 +72404,8 @@

    Response samples

    >"message": "Sign-up successful, Please - wait while logging in.""User deleted + successfully", @@ -67992,8 +72475,8 @@

    Response samples

    @@ -68001,8 +72484,8 @@

    Response samples

    @@ -68010,27 +72493,63 @@

    Response samples

    Login admin user + >Add Organization Admin

    -

    This API is associated with login system user

    +

    Assigns a user as the Org-Admin.

      +
    • Endpoint: /user/v1/admin/addOrgAdmin
    • - Then Endpoint for login system user - /user/v1/systemUsers/login -
    • -
    • - It is mandatory to provide values for parameters marked with - required + Mandatory parameters marked as required must have valid + values.
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • Parameters cannot be empty or null.
    +
    +
    + header + Parameters +
    + + + + + + + +
    + X-auth-token +
    required
    +
    +
    +
    + string +
    +
    +
    +

    + X-auth-token required for API access. Available in + login API Response. +

    +
    +
    +
    +
    +
    Request Body schema: application/json
    @@ -68038,37 +72557,47 @@
    - - @@ -68091,26 +72620,8 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >200

    ok

    - - -
    -
    @@ -68120,7 +72631,7 @@

    Responses

    @@ -68150,7 +72661,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/admin/login + >/user/admin/addOrgAdmin
    @@ -68163,10 +72674,10 @@

    Request samples

  • "email": - "systemuser@mail.com""user_id": 12, @@ -68214,11 +72723,8 @@

    Request samples

  • "password": - "password" + >"organization_id": 55
  • @@ -68239,32 +72745,21 @@

    Response samples

    -
    @@ -68305,8 +72800,8 @@

    Response samples

    >"message": "User logged in - successfully.""User Assigned As The + Org-Admin Successfully", @@ -68330,10 +72825,10 @@

    Response samples

    > "access_token""user_id": - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyOGQ4YjljNGRmOGFkM2ExM2QyODNlNyIsImVtYWlsIjoic3lzdGVtQGFkbWluLmNvbSIsInJvbGUiOiJhZG1pbiJ9LCJpYXQiOjE2NTM0NDQ2MDQsImV4cCI6MTY1MzUzMTAwNH0.l6I0MC16FegRLDym_VwgxFsa97ApUuOKohj2k49cV0I"12,Response samples > "refresh_token""org_id": - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyOGQ4YjljNGRmOGFkM2ExM2QyODNlNyIsImVtYWlsIjoic3lzdGVtQGFkbWluLmNvbSIsInJvbGUiOiJhZG1pbiJ9LCJpYXQiOjE2NTM0NDQ2MDQsImV4cCI6MTY2OTI1NTgwNH0.TGDhpCVa0hTAbki8Dp5XGtQyqCMXu4Xu9L_72Yr4G1A"55,Response samples > "user""user_roles": {[ -
      -
    • - -
    • -
    • - -
    • -
    • - -
    • +
      • -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - +
      }]
    @@ -68938,20 +73094,14 @@

    Response samples

    -
    @@ -68959,23 +73109,21 @@

    Response samples

    Delete user + >Deactivate Organization

    -

    This API is associated with delete user

    +

    Deactivates an organization.

      +
    • Endpoint: /user/v1/admin/deactivateOrg
    • - Then Endpoint for delete user /user/v1/admin/deleteUser -
    • -
    • - It is mandatory to provide values for parameters marked with - required + Mandatory parameters marked as required must have valid + values.
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • Parameters cannot be empty or null.
    @@ -69008,7 +73156,10 @@
    -

    Please append a valid user id to the request url

    +

    + Please append a valid organization ID to the request + URL. +

    @@ -69045,8 +73196,8 @@

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. + X-auth-token required for API access. Available in + login API Response.

    @@ -69073,7 +73224,9 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >202

    Accepted

    + >

    Accepted. Organization deactivated successfully.

    +
    @@ -69092,7 +73245,7 @@

    Responses

    >400

    Bad Request. User Entity Already Deleted

    + >

    Bad Request. Organization Entity Already Deleted.

    @@ -69101,8 +73254,8 @@

    Responses

    @@ -69132,7 +73285,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/admin/deleteUser/{id} + >/user/v1/admin/deactivateOrg/{id}
    @@ -69145,10 +73298,10 @@

    Response samples

    @@ -69282,8 +73435,8 @@

    Response samples

    @@ -69291,8 +73444,8 @@

    Response samples

    @@ -69300,23 +73453,21 @@

    Response samples

    Add Organization Admin + >Deactivate User

    -

    This API is used to assign a user as the Org-Admin

    +

    Deactivates one or more users.

      +
    • Endpoint: /user/v1/admin/deactivateUser
    • - Then Endpoint for delete user /user/v1/admin/addOrgAdmin -
    • -
    • - It is mandatory to provide values for parameters marked with - required + Mandatory parameters marked as required must have valid + values.
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • Parameters cannot be empty or null.
    @@ -69348,8 +73499,8 @@

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. + X-auth-token required for API access. Available in + login API Response.

    @@ -69365,31 +73516,16 @@
    + email -
    required
    + >user_id
    string + >integer +
    +
    +
    +

    The ID of the user to be assigned as Org-Admin.

    +
    -
    + password -
    required
    + >organization_id
    string - <password> - + >integer +
    +
    +
    +

    + The ID of the organization to which the user will be + assigned as Org-Admin. +

    +
    -
    - - - - - @@ -70013,7 +73939,11 @@
    string -
    +
    +
    +

    A unique code representing the organization.

    +
    +
    @@ -70033,7 +73963,11 @@
    string -
    +
    +
    +

    A brief description of the organization.

    +
    +
    @@ -70056,7 +73990,9 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >200

    ok

    + >

    OK. Organization created successfully.

    +
    @@ -70075,7 +74011,7 @@

    Responses

    >400

    Bad Request. System User doesn't exist

    + >

    Bad Request. Organization already exists

    @@ -70128,10 +74064,10 @@

    Request samples

    - user_id - -
    -
    - integer -
    -
    -
    -
    + org_id + >id
    - integer + Array of integers
    @@ -69413,8 +73549,30 @@

    Responses

    200

    OK

    + >202

    Accepted. Users deactivated successfully.

    +
    + + +
    +
    @@ -69423,7 +73581,7 @@

    Responses

    @@ -69453,7 +73611,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/admin/addOrgAdmin + >/user/v1/admin/deactivateUser
    @@ -69466,10 +73624,10 @@

    Request samples

  • "user_id": 12, -
    -
  • -
  • -
    - "org_id": 55 + >"id": + [ +
      +
    • + +
    • +
    • + +
    • +
    + ]
  • @@ -69537,21 +73713,32 @@

    Response samples

    +
    @@ -69592,8 +73779,8 @@

    Response samples

    >"message": "User Assigned As The - Org-Admin Successfully""User deactivated + Successfully.", @@ -69604,277 +73791,9 @@

    Response samples

    "result": - { -
      -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    - } + [ ]
    @@ -69886,6 +73805,12 @@

    Response samples

    +
    @@ -69926,17 +73851,14 @@

    -

    This API is associated with organization

    +

    Creates a new organization.

      +
    • Endpoint: /user/v1/organization/create
    • - The Endpoint for create organization - /user/v1/organization/create -
    • -
    • - It is mandatory to provide values for parameters marked with - required + Mandatory parameters marked as required must have valid + values.
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • Parameters cannot be empty or null.
    @@ -69968,8 +73890,8 @@

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. + X-auth-token required for API access. Available in + the login API Response.

    @@ -69997,7 +73919,11 @@
    string -
    +
    +
    +

    The name of the organization.

    +
    +
    @@ -70827,11 +74782,13 @@
    Example: - 1 + page=1
    -

    Please add page number

    +

    Please specify the page number.

    @@ -70858,11 +74815,13 @@
    Example: - 2 + limit=2
    -

    number of record to limit

    +

    Specify the number of records to limit.

    @@ -70889,11 +74848,13 @@
    Example: - jhon + search=john
    -

    Please search for name or title of user etc.

    +

    Search for organizations based on name or title.

    @@ -70931,7 +74892,7 @@

    To make use of the API, you require X-auth-token. - This is Available in login API Response. + This is available in the login API response.

    @@ -70958,7 +74919,9 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >200

    ok

    + >

    OK. Organizations listed successfully.

    +
    @@ -70967,8 +74930,7 @@

    Responses

    @@ -70999,7 +74960,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/organization/list?page={page}&limit={limit}&search={search} + >/user/v1/organization/list
    @@ -71012,10 +74973,10 @@

    Response samples

    @@ -71325,9 +75299,13 @@
    string + >integer +
    +
    +
    +

    The specific role being requested.

    +
    -
    @@ -71361,7 +75339,14 @@
    object -
    +
    +
    +

    + Additional data related to the organization-specific + fields. +

    +
    +
    @@ -71370,8 +75355,20 @@

    Responses

    -
    - - - - - - - - - - - - - - -
    - page -
    required
    -
    -
    -
    - integer -
    -
    -
    -

    Page number for pagination.

    -
    -
    -
    -
    - limit -
    required
    -
    -
    -
    - integer -
    -
    -
    -

    Number of items per page.

    -
    -
    -
    -
    - role -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - The specific role for which requests are being - fetched. -

    -
    -
    -
    -
    +

    + EntityType APIs +

    +
    +
    +
    +
    +
    +
    +

    + Create Entity Type +

    +
    +
    +

    Use this API to create a user entity.

    +
      +
    • Endpoint: /mentoring/v1/entity-type/create
    • +
    • Provide values for parameters marked as required.
    • +
    • The X-auth-token is mandatory and cannot be empty or null.
    • +
    +
    @@ -71822,13 +75750,185 @@
    +
    + Request Body schema: application/json +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + value + +
    +
    + string +
    +
    +
    +

    Unique identifier for the entity type.

    +
    +
    +
    +
    + label + +
    +
    + string +
    +
    +
    +

    Descriptive label for the entity type.

    +
    +
    +
    +
    + type + +
    +
    + string +
    +
    +
    +

    Type of the entity (e.g., SYSTEM, USER).

    +
    +
    +
    +
    + allow_filtering + +
    +
    + boolean +
    +
    +
    +

    + Indicates whether filtering is allowed for this entity + type. +

    +
    +
    +
    +
    + data_type + +
    +
    + string +
    +
    +
    +

    Data type of the entity.

    +
    +
    +
    +
    + has_entities + +
    +
    + boolean +
    +
    +
    +

    + Indicates whether the entity type has associated + entities. +

    +
    +
    +
    +

    Responses

    - +
    +
    +
    @@ -71837,8 +75937,8 @@

    Responses

    @@ -71869,34 +75968,34 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/organization/getOrgRoleRequests + >/user/v1/entity-type/create
    -

    Response samples

    +

    Request samples

    @@ -71906,8 +76005,7 @@

    Response samples

    - +
    @@ -71922,10 +76020,10 @@

    Response samples

  • "responseCode""value": "OK""ln", @@ -71934,11 +76032,10 @@

    Response samples

  • "message""label": "Org Role Requests Fetched - Successfully""Languages", @@ -71947,359 +76044,54 @@

    Response samples

  • "result""type": - { -
      -
    • - -
    • -
    • - -
    • -
    - } + "SYSTEM",
  • - - } -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - UserRole APIs -

    -
    -
    -
    -
    -
    -
    -

    - UserRole List -

    -
    -
    -

    This API is associated with the user's role details

    -
      -
    • - Then Endpoint for user profile details - /user/v1/userRole/list -
    • -
    • - It is mandatory to provide values for parameters marked with - required -
    • -
    • Mandatory parameter cannot be empty or null
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    +
  • +
    + "allow_filtering": + true, +
    +
  • +
  • +
    + "data_type": + "string", +
    +
  • +
  • +
    + "has_entities": + "STRING" +
    +
  • + + }
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -

    - EntityType APIs -

    -
    -
    -
    @@ -72583,24 +76396,18 @@

    Create entity type + >Read Entity Type

    -

    You can use this API to create a user entity

    +

    Use this API to retrieve a list of entity types.

      -
    • - The API Endpoint for creating a user entity is - /mentoring/v1/entity-type/create -
    • -
    • - It is mandatory to provide values for parameters which are marked as - required -
    • -
    • This is a mandatory parameter and cannot be empty or null.
    • +
    • Endpoint: /user/v1/entity-type/read
    • +
    • Provide values for parameters marked as required.
    • +
    • The X-auth-token is mandatory and cannot be empty or null.
    @@ -72612,121 +76419,53 @@
    - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - Access token of the user who is already a mentee of - the organization. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - - - + - + + + +
    - value - -
    -
    - string -
    -
    -
    -
    - label - -
    -
    - string -
    -
    -
    -
    - type - -
    -
    - string -
    -
    -
    -
    - allow_filtering - -
    +
    + X-auth-token +
    required
    +
    - boolean +
    + string +
    +
    +
    +

    + To make use of the API, you require X-auth-token. + This is Available in login API Response. +

    +
    +
    -
    - -
    +
    +
    + Request Body schema: application/json +
    +
    + + -
    + data_type + >value
    - string + Array of strings
    @@ -72736,10 +76475,10 @@
    has_entities + >read_user_entity
    @@ -72770,7 +76509,9 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >201

    Created

    + >

    OK Entity Type Fetched Successfully

    +
    @@ -72789,7 +76530,7 @@

    Responses

    >400

    Bad Request. Entity type alrady exist

    + >

    Bad Request. Entity type already exists

    @@ -72799,7 +76540,7 @@

    Responses

    @@ -72829,7 +76570,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/entity-type/create + >/user/v1/entity-type/read
    @@ -72842,10 +76583,10 @@

    Request samples

    -
  • -
    - "label": - "Languages", -
    -
  • -
  • -
    - "type": - "SYSTEM", -
    -
  • -
  • -
    - "allow_filtering": - true, -
    -
  • -
  • -
    - "data_type": - "string"[ +
      +
    • + +
    • +
    + ], @@ -72940,11 +76651,9 @@

    Request samples

  • "has_entities""read_user_entity": - "STRING" + false
  • @@ -72965,10 +76674,10 @@

    Response samples

    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - value - -
    -
    - string -
    -
    -
    -
    - label - -
    -
    - string -
    -
    -
    -
    - status - -
    -
    - string -
    -
    -
    -
    - type - -
    -
    - string -
    -
    -
    -
    - allow_filtering - -
    -
    - boolean -
    -
    -
    -
    - data_type - -
    -
    - string -
    -
    -
    -

    Responses

    @@ -73524,8 +77380,8 @@

    Responses

    201

    ok

    + >202

    Accepted

    @@ -73543,9 +77399,7 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >400

    Bad Request. Entity type alrady exist

    -
    + >

    Bad Request. Entity Not Found

    @@ -73553,161 +77407,38 @@

    Responses

    - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "value": - "roles", -
      -
    • -
    • -
      - "label": - "Roles", -
      -
    • -
    • -
      - "status": - "ACTIVE", -
      -
    • -
    • -
      - "type": - "SYSTEM", -
      -
    • -
    • -
      - "allow_filtering": - true, -
      -
    • -
    • -
      - "data_type": - "string" -
      -
    • -
    - }
    -
    -
    -
    + xmlns="http://www.w3.org/2000/svg" + y="0" + aria-hidden="true" + > + + + +
    @@ -74034,8 +77555,8 @@

    Response samples

    @@ -74043,26 +77564,59 @@

    Response samples

    Read entity type + >Update Entity Type

    -

    This API is associated with entity type list

    +

    Use this API to update an entity type.

      -
    • - Then Endpoint for create entity /user/v1/entity-type/read -
    • -
    • - It is mandatory to provide values for parameters marked with - required -
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • Endpoint: /user/v1/entity-type/update/{id}
    • +
    • Provide values for parameters marked as required.
    • +
    • The X-auth-token is mandatory and cannot be empty or null.
    +
    +
    + path + Parameters +
    + + + + + + + +
    + id +
    required
    +
    +
    +
    + integer +
    +
    + + Example: + + 1 +
    +
    +
    +

    Please append a valid user ID to the request URL.

    +
    +
    +
    +
    +
    header @@ -74091,8 +77645,7 @@

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. + Access token obtained from the login API response.

    @@ -74116,10 +77669,101 @@
    - Array of strings + string +
    +
    +
    +

    Unique identifier for the entity type.

    +
    +
    +
    + + + + + label + + +
    +
    + string +
    +
    +
    +

    Descriptive label for the entity type.

    +
    +
    +
    + + + + + type + + +
    +
    + string +
    +
    +
    +

    Type of the entity (e.g., SYSTEM, USER).

    +
    +
    +
    + + + + + allow_filtering + + +
    +
    + boolean +
    +
    +
    +

    + Indicates whether filtering is allowed for this entity + type. +

    +
    +
    +
    + + + + + data_type + + +
    +
    + string +
    +
    +
    +

    Data type of the entity.

    +
    -
    @@ -74127,10 +77771,10 @@
    read_user_entity + >has_entities
    @@ -74138,7 +77782,14 @@
    boolean
    -
    +
    +
    +

    + Indicates whether the entity type has associated + entities. +

    +
    +
    @@ -74161,7 +77812,9 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >201

    Created

    + >

    OK. Entity Type Updated Successfully

    +
    @@ -74180,7 +77833,7 @@

    Responses

    >400

    Bad Request. Entity type alrady exist

    + >

    Bad Request. Entity type already exists

    @@ -74190,7 +77843,7 @@

    Responses

    @@ -74220,147 +77873,44 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/entity-type/read -
    -
    -
    -
    -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "value": - [ -
        -
      • - -
      • -
      - ], -
      -
    • -
    • -
      - "read_user_entity": - false -
      -
    • -
    - }
    -
    -
    -
    + >/user/v1/entity-type/update/{id}
    -

    Response samples

    +

    Request samples

      -
    Content type -
    application.json
    +
    application/json
    - +
    @@ -74375,10 +77925,10 @@

    Response samples

  • "responseCode""value": "OK""ln", @@ -74387,11 +77937,10 @@

    Response samples

  • "message""label": "Entity type fetched - successfully""Languages", @@ -74400,445 +77949,309 @@

    Response samples

  • "result""type": - [ -
      -
    • - +
    • +
    • +
      + "allow_filtering": + true, +
      +
    • +
    • +
      + "data_type": + "string", +
      +
    • +
    • +
      + "has_entities": + "STRING" +
      +
    • +
    + } +
    +
  • +
    +
    +
    +
    +
    +
    +
    +

    Response samples

    +
    +
      + + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "responseCode": + "string", +
      +
    • +
    • +
      + "message": + "string", +
      +
    • +
    • +
      + "result": + { +
        +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • +
      - ]}, @@ -74865,7 +78278,7 @@

      Response samples

      >"correlation": "64cd08ba-cc87-4172-9633-2146dabe0b78""5f384234-cd5a-467e-a5ac-b43365d2a7a3",Response samples
    @@ -74910,8 +78323,8 @@

    Response samples

    @@ -74919,24 +78332,24 @@

    Response samples

    Delete entity type + >Delete Entity

    -

    This API is associated with delete entity

    +

    This API is associated with deleting an entity.

    • - Then Endpoint for delete user entity - /user/v1/entity-type/delete + Endpoint for deleting a user entity: + /user/v1/entity/delete.
    • It is mandatory to provide values for parameters marked with - required + required.
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • Mandatory parameters cannot be empty or null.
    @@ -74970,8 +78383,47 @@

    - Please append a valid user entity id to the request - url + Please append a valid user entity ID to the request + URL. +

    +
    +
    +
    + + + + +
    +
    +
    + header + Parameters +
    + + + + +
    + X-auth-token +
    required
    +
    +
    +
    + string +
    +
    +
    +

    + To use the API, include X-auth-token. This is + available in the login API response.

    @@ -74981,6 +78433,226 @@
    +
    +

    Responses

    +
    + +
    +
    + +
    +
    +
    +
    +
    + + +
    +
    +

    Response samples

    +
    +
      + + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "responseCode": + "OK", +
      +
    • +
    • +
      + "message": + "Entity deleted + successfully", +
      +
    • +
    • +
      + "result": + [ ] +
      +
    • +
    + }
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    + Bulk User Create +

    +
    +
    +

    Create multiple users in bulk using a CSV file.

    +
      +
    • Endpoint: /user/v1/org-admin/bulkUserCreate.
    • +
    • + It is mandatory to provide values for parameters marked with + required. +
    • +
    • Mandatory parameters cannot be empty or null.
    • +
    +
    +
    header @@ -75008,10 +78680,7 @@
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    +

    Access token of the org admin.

    @@ -75020,43 +78689,46 @@
    +
    + Request Body schema: application/json +
    +
    + + + + + + + +
    + file_path + +
    +
    + string +
    +
    +
    +

    + The path to the uploaded CSV file containing user data. +

    +
    +
    +
    +

    Responses

    - -
    -
    -
    @@ -75066,7 +78738,7 @@

    Responses

    @@ -75096,45 +78768,98 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/entity-type/delete/{id} + >/user/v1/org-admin/bulkUserCreate
    -

    Response samples

    +

    Request samples

      +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "file_path": + "path/to/uploaded-csv-file" +
      +
    • +
    + }
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +

    Response samples

    +
    +
    @@ -75175,8 +78900,8 @@

    Response samples

    >"message": "Entity deleted - successfully""Bulk User Invites CSV + Uploaded Successfully", @@ -75187,9 +78912,124 @@

    Response samples

    "result": - [ ] + { +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    • + +
    • +
    + }
    @@ -75201,12 +79041,6 @@

    Response samples

    -
    @@ -75235,18 +79069,20 @@

    href="#tag/Entity-APIs/paths/~1user~1v1~1entity~1create/post" aria-label="tag/Entity-APIs/paths/~1user~1v1~1entity~1create/post" >Create entity + >Create Entity

    -

    This API is associated with entity creation

    +

    This API is associated with entity creation.

      -
    • Then Endpoint for create entity /user/v1/entity/create
    • +
    • + Endpoint for creating an entity: /user/v1/entity/create. +
    • It is mandatory to provide values for parameters marked with - required + required.
    • -
    • Mandatory parameter cannot be empty or null
    • +
    • Mandatory parameters cannot be empty or null.
    @@ -75382,7 +79218,7 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >201

    Created

    + >

    OK. Created

    @@ -75401,7 +79237,7 @@

    Responses

    >400

    Bad Request. User Entity alrady exist

    + >

    Bad Request. User Entity already exists

    @@ -75454,10 +79290,10 @@

    Request samples

    @@ -76038,7 +79880,11 @@
    string
    -
    +
    +
    +

    The label of the entity.

    +
    +
    @@ -76053,7 +79899,11 @@
    string
    -
    +
    +
    +

    The status of the entity.

    +
    +
    @@ -76072,7 +79922,11 @@
    number -
    +
    +
    +

    The ID of the entity type.

    +
    +
    @@ -76095,7 +79949,7 @@

    Responses

    points="17.3 8.3 12 13.6 6.7 8.3 5.3 9.7 12 16.4 18.7 9.7 " >202

    Accepted

    + >

    OK. Accepted

    @@ -76167,10 +80021,10 @@

    Request samples

    @@ -76854,8 +80711,8 @@

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. + To use the API, include X-auth-token. This is + available in the login API response.

    @@ -76934,10 +80791,10 @@

    Response samples

  • "request_id": 12"responseCode": + "OK", @@ -78730,41 +82825,314 @@

    Request samples

  • "comments""message": + "Organisation request details + fetched successfully", +
    +
  • +
  • +
    + "result": [{ -
      +
        +
      • + +
      • +
      • + +
      • +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • + +
      • +
      • +
      - ], -
    -
  • -
  • -
    - "status": - "APPROVED" + }
  • @@ -78778,6 +83146,233 @@

    Request samples

    + + + +
    +
    +
    +

    + Get Bulk Invite Files List +

    +
    +
    +

    Get a list of uploaded bulk invite CSV files.

    +
      +
    • Endpoint: /user/v1/org-admin/getBulkInvitesFilesList.
    • +
    • + It is mandatory to provide values for parameters marked with + required. +
    • +
    • Mandatory parameters cannot be empty or null.
    • +
    +
    +
    +
    +
    + query + Parameters +
    + + + + + + + + + + + + + + + +
    + page +
    required
    +
    +
    +
    + integer +
    +
    +
    +

    Page number for pagination.

    +
    +
    +
    +
    + limit +
    required
    +
    +
    +
    + integer +
    +
    +
    +

    Number of items per page.

    +
    +
    +
    +
    + status +
    required
    +
    +
    +
    + string +
    +
    + Enum: + "uploaded" + "processed" + "failed" +
    +
    + + Example: + + status=uploaded +
    +
    +
    +

    + Status of the bulk invite files + (uploaded/processed/failed). +

    +
    +
    +
    +
    +
    +
    +
    + header + Parameters +
    + + + + + + + +
    + X-auth-token +
    required
    +
    +
    +
    + string +
    +
    +
    +

    Access token of the org admin.

    +
    +
    +
    +
    +
    +
    +

    Responses

    +
    + +
    +
    +
    +
    +
    + + +

    Response samples

    @@ -78785,10 +83380,10 @@

    Response samples

    -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - -
  • -
  • - +
  • +
  • +
  • @@ -79016,8 +83797,8 @@

    Response samples

    @@ -79025,31 +83806,35 @@

    Response samples

    Get Request Details + >Deactivate User

    -

    Get details of a specific organization request.

    +

    Deactivate a user

    +
      +
    • Endpoint: /user/v1/org-admin/deactivateUser.
    • +
    • + It is mandatory to provide values for parameters marked with + required. +
    • +
    • Mandatory parameters cannot be empty or null.
    • +
    - query + path Parameters
    -
    + request_id + >id
    required
    @@ -79064,13 +83849,11 @@
    Example: - request_id=12 + 12
    -

    ID of the request to get details for.

    +

    ID of the user.

    @@ -79118,10 +83901,40 @@

    Responses

    - +
    +
    +
    @@ -79130,8 +83943,8 @@

    Responses

    http://localhost:3002/user/v1/org-admin/getRequestDetails + >/user/v1/org-admin/deactivateUser/{id}
    @@ -79162,7 +83975,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/org-admin/getRequestDetails + >/user/v1/org-admin/deactivateUser/{id}
    @@ -79175,21 +83988,32 @@

    Response samples

    +
    @@ -79230,8 +84054,8 @@

    Response samples

    >"message": "Organisation request details - fetched successfully""User deactivated + Successfully.", @@ -79242,299 +84066,9 @@

    Response samples

    "result": - { -
      -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    • - -
    • -
    - } + [ ]
    @@ -79546,14 +84080,20 @@

    Response samples

    +
    @@ -79561,14 +84101,22 @@

    Response samples

    Bulk User Create + >Inherit Entity Type

    -

    Create multiple users in bulk using a CSV file.

    +

    Inherit entity type.

    +
      +
    • Endpoint: /user/v1/org-admin/inheritEntityType.
    • +
    • + It is mandatory to provide values for parameters marked with + required. +
    • +
    • Mandatory parameters cannot be empty or null.
    • +
    @@ -79613,14 +84161,33 @@
    + + + +
    + entity_type_value + +
    +
    + string +
    +
    +
    +
    file_path + >target_entity_type_label
    @@ -79637,10 +84204,40 @@

    Responses

    - +
    +
    +
    @@ -79650,7 +84247,7 @@

    Responses

    local dev

    - http://localhost:3002/user/v1/org-admin/bulkUserCreate + http://localhost:3002/user/v1/org-admin/inheritEntityType
    @@ -79680,7 +84278,7 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/org-admin/bulkUserCreate + >/user/v1/org-admin/inheritEntityType
    @@ -79693,10 +84291,10 @@

    Request samples

  • "file_path""entity_type_value": "path/to/uploaded-csv-file""categories", +
    +
  • +
  • +
    + "target_entity_type_label": + "training"
  • @@ -79757,21 +84367,32 @@

    Response samples

    +
    @@ -79812,8 +84433,8 @@

    Response samples

    >"message": "Bulk User Invites CSV - Uploaded Successfully""Entity type created + successfully", @@ -79837,10 +84458,74 @@

    Response samples

    > "id""id": + 6, +
    + +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • +
  • @@ -79953,14 +84743,34 @@

    Response samples

    +
    +
    +
    +
    +

    + Notification APIs +

    +
    +
    +
    @@ -79968,79 +84778,39 @@

    Response samples

    Get Bulk Invite Files List + >Create, Update, and Delete Notification

    -

    Get a list of uploaded bulk invite CSV files.

    +

    This API is associated with notification create or update.

    +
      +
    • Endpoint: /user/v1/notification/template.
    • +
    • + It is mandatory to provide values for parameters marked with + required. +
    • +
    • Mandatory parameters cannot be empty or null.
    • +
    - query + header Parameters
    - - - - - - - -
    - page -
    required
    -
    -
    -
    - integer -
    -
    -
    -

    Page number for pagination.

    -
    -
    -
    -
    - limit -
    required
    -
    -
    -
    - integer -
    -
    -
    -

    Number of items per page.

    -
    -
    -
    -
    status + >X-auth-token
    required
    @@ -80051,31 +84821,11 @@
    >string -
    - Enum: - "uploaded" - "processed" - "failed" -
    -
    - - Example: - - status=uploaded -

    - Status of the bulk invite files - (uploaded/processed/failed). + Access token required to use the API. Available in + the login API response.

    @@ -80085,50 +84835,172 @@
    -
    -
    - header - Parameters -
    - - - - - + + + + + + + + + + + + + + + + + + +
    - X-auth-token -
    required
    -
    +
    + Request Body schema: application/json +
    +
    + + + + + + + + + - - -
    + type + +
    -
    - string + string +
    +
    +
    +

    Type of email

    -
    -
    -

    Access token of the org admin.

    -
    +
    +
    +
    + code + +
    +
    + string +
    +
    +
    +

    Unique code for the email configuration

    -
    - + +
    + subject + +
    +
    + string +
    +
    +
    +

    Subject of the email

    +
    +
    +
    +
    + body + +
    +
    + string +
    +
    +
    +

    Body of the email

    +
    +
    +
    +
    + email_header + +
    +
    + string +
    +
    +
    +

    Email header content

    +
    +
    +
    +
    + email_footer + +
    +
    + string +
    +
    +
    +

    Email footer content

    +
    +
    +
    +

    Responses

    - +
    +
    +
    @@ -80136,8 +85008,8 @@

    Responses

    @@ -80168,7 +85039,132 @@

    Responses

    https://dev.elevate-apis.shikshalokam.org/user/v1/org-admin/getBulkInvitesFilesList + >/user/v1/notification/template +
    +
    +
    +
    +
    +
    +

    Request samples

    +
    +
      + +
    +
    +
    +
    + Content type +
    application/json
    +
    +
    +
    +
    + +
    +
    +
    + { +
      +
    • +
      + "type": + "email", +
      +
    • +
    • +
      + "code": + "tl-email-invite", +
      +
    • +
    • +
      + "subject": + "Hi Welcome Back", +
      +
    • +
    • +
      + "body": + "<p>Dear User,</p> + Welcome back to mentorEd", +
      +
    • +
    • +
      + "email_header": + "email_header", +
      +
    • +
    • +
      + "email_footer": + "email_footer" +
      +
    • +
    + }
    +
    +
    +
    @@ -80181,21 +85177,32 @@

    Response samples

    +
    @@ -80236,8 +85243,8 @@

    Response samples

    >"message": "Bulk Invites CSV List Fetched - Successfully""Notification template created + successfully", @@ -80261,305 +85268,75 @@

    Response samples

    > "data""status": - "ACTIVE"[, +
    + +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • + +
  • +
  • +
  • @@ -80592,6 +85500,12 @@

    Response samples

    +
    @@ -80625,7 +85539,7 @@

    Response samples

    summary: 'Create user', tags: ['User APIs'], description: - 'This Api is associated with Create User on mentoring \n - Then Endpoint for creating user `/user/v1/account/create` \n - It is mandatory to provide values for parameter marked with `required` \n - Mandatory parameter cannot be empty or null \n - secretCode is required only for mentor', + 'This Api is associated with Create User on mentoring \n - Then Endpoint for creating user `/user/v1/account/create` \n - It is mandatory to provide values for parameter marked with `required` \n - Mandatory parameter cannot be empty or null \n ', requestBody: { required: true, description: 'Request body consist of metadata and accepts payload as JSON', @@ -80647,7 +85561,7 @@

    Response samples

    }, }, 400: { - description: 'Bad Request. Refrral code is invalid', + description: 'Bad Request. OTP is invalid', content: { 'application/json': { schema: { @@ -80674,8 +85588,9 @@

    Response samples

    summary: 'Login', tags: ['User APIs'], description: - 'This Api is associated with login user \n - Then Endpoint for login user `/user/v1/account/login` \n - It is mandatory to provide values for parameter marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is associated with logging in a user.\n- Endpoint for logging in a user: `/user/v1/account/login`\n- It is mandatory to provide values for parameters marked as `required`.\n- Mandatory parameters cannot be empty or null.\n', requestBody: { + description: 'Request body for user login', content: { 'application/json': { schema: { $ref: '#/components/schemas/user/userLoginRequest' }, @@ -80684,7 +85599,7 @@

    Response samples

    }, responses: { 200: { - description: 'ok', + description: 'OK. User successfully logged in.', content: { 'application/json': { schema: { $ref: '#/components/schemas/user/userLoginResponse' }, @@ -80692,7 +85607,7 @@

    Response samples

    }, }, 400: { - description: 'Bad Request. Invalid Email or Password', + description: 'Bad Request. Invalid email or password.', content: { 'application/json': { schema: { $ref: '#/components/schemas/user/userLoginResponse400' }, @@ -80707,7 +85622,7 @@

    Response samples

    summary: 'Terms & Condition', tags: ['Depreciated APIs'], description: - 'This API Requires only X-auth-token and it will set an email to verify true.', + "This API sets the 'email_verified' field to true using only the X-auth-token.\n- Endpoint: `/user/v1/account/acceptTermsAndCondition`\n- Requires a valid X-auth-token from the login API response.\n", parameters: [ { name: 'X-auth-token', @@ -80720,7 +85635,7 @@

    Response samples

    ], responses: { 200: { - description: 'ok', + description: 'OK. Terms and conditions accepted successfully.', content: { 'application/json': { schema: { @@ -80730,7 +85645,7 @@

    Response samples

    }, }, 400: { - description: 'Bad Request. User Does not exist.', + description: 'Bad Request. User does not exist or invalid input.', content: { 'application/json': { schema: { @@ -80744,16 +85659,16 @@

    Response samples

    }, '/user/v1/account/generateToken': { post: { - summary: 'Generates access token.', + summary: 'Generate Access Token', tags: ['User APIs'], description: - 'This API is associated with re-login and generating access token from refresh token \n - Then Endpoint for generating access token `/user/v1/account/generateToken` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is for re-login and generating an access token from a refresh token.\n- Endpoint for generating token `/user/v1/account/generateToken`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', in: 'header', description: - 'To make use of the API, you require X-auth-token. This is Available in login API Response.', + 'To use the API, you require X-auth-token, available in the login API response.', required: true, schema: { type: 'string' }, }, @@ -80767,7 +85682,7 @@

    Response samples

    }, responses: { 200: { - description: 'ok', + description: 'OK. Access token generated successfully.', content: { 'application/json': { schema: { @@ -80777,7 +85692,7 @@

    Response samples

    }, }, 400: { - description: 'Bad Request', + description: 'Bad Request. Invalid input or missing required parameters.', content: { 'application/json': { schema: { @@ -80787,7 +85702,7 @@

    Response samples

    }, }, 401: { - description: 'Unauthorized', + description: 'Unauthorized. X-auth-token is either missing or invalid.', content: { 'application/json': { schema: { @@ -80797,7 +85712,7 @@

    Response samples

    }, }, 500: { - description: 'Internal Server Error', + description: 'Internal Server Error. Something went wrong on the server.', content: { 'application/json': { schema: { @@ -80814,7 +85729,7 @@

    Response samples

    summary: 'Generate OTP', tags: ['User APIs'], description: - 'This API is associated with generating OTP \n - Then Endpoint for generating OTP `user/v1/account/generateOtp` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is for generating OTP.\n- Endpoint: `/user/v1/account/generateOtp`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', @@ -80834,7 +85749,7 @@

    Response samples

    }, responses: { 200: { - description: 'ok', + description: 'OK. OTP generated successfully.', content: { 'application/json': { schema: { @@ -80844,7 +85759,7 @@

    Response samples

    }, }, 400: { - description: 'Bad Request', + description: 'Bad Request. Invalid input or missing required parameters.', content: { 'application/json': { schema: { @@ -80854,7 +85769,7 @@

    Response samples

    }, }, 500: { - description: 'Internal Server Error', + description: 'Internal Server Error. Something went wrong on the server.', content: { 'application/json': { schema: { @@ -80868,10 +85783,10 @@

    Response samples

    }, '/user/v1/account/resetPassword': { post: { - summary: 'Reset password', + summary: 'Reset Password', tags: ['User APIs'], description: - 'This API is associated with reset password \n - Then Endpoint for reset password `user/v1/account/resetPassword` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is for resetting the user password.\n- Endpoint: `/user/v1/account/resetPassword`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', @@ -80891,7 +85806,7 @@

    Response samples

    }, responses: { 200: { - description: 'ok', + description: 'OK. Password reset successfully.', content: { 'application/json': { schema: { @@ -80901,7 +85816,7 @@

    Response samples

    }, }, 400: { - description: 'Bad Request', + description: 'Bad Request. Invalid input or missing required parameters.', content: { 'application/json': { schema: { @@ -80911,7 +85826,7 @@

    Response samples

    }, }, 401: { - description: 'Bad Request', + description: 'Unauthorized. X-auth-token is either missing or invalid.', content: { 'application/json': { schema: { @@ -80928,7 +85843,7 @@

    Response samples

    summary: 'Logout', tags: ['User APIs'], description: - 'This API is associated with logout \n - Then Endpoint for logout `/user/v1/account/logout` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is for logging out a user.\n- Endpoint: `/user/v1/account/logout`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', @@ -80948,7 +85863,7 @@

    Response samples

    }, responses: { 200: { - description: 'ok', + description: 'OK. Logout successful.', content: { 'application/json': { schema: { $ref: '#/components/schemas/user/logoutResponse200' }, @@ -80956,7 +85871,7 @@

    Response samples

    }, }, 400: { - description: 'Bad Request', + description: 'Bad Request. Invalid input or missing required parameters.', content: { 'application/json': { schema: { $ref: '#/components/schemas/user/logoutResponse400' }, @@ -80964,7 +85879,7 @@

    Response samples

    }, }, 401: { - description: 'Unauthorized', + description: 'Unauthorized. X-auth-token is either missing or invalid.', content: { 'application/json': { schema: { $ref: '#/components/schemas/user/logoutResponse401' }, @@ -80974,12 +85889,69 @@

    Response samples

    }, }, }, + '/user/v1/account/registrationOtp': { + post: { + summary: 'Registration OTP', + tags: ['User APIs'], + description: + 'This API is for registration OTP.\n- Endpoint: `/user/v1/account/registrationOtp`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', + parameters: [ + { + name: 'X-auth-token', + in: 'header', + description: + 'To make use of the API, you require X-auth-token. This is Available in login API Response.', + required: true, + schema: { type: 'string' }, + }, + ], + requestBody: { + content: { + 'application/json': { + schema: { $ref: '#/components/schemas/user/registrationOtpRequest' }, + }, + }, + }, + responses: { + 200: { + description: 'OK. Registration OTP sent successfully.', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/user/registrationOtpResponse200', + }, + }, + }, + }, + 400: { + description: 'Bad Request. Invalid input or missing required parameters.', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/user/registrationOtp400Response', + }, + }, + }, + }, + 406: { + description: 'Not Acceptable. User already exists.', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/user/userCreateUser406Exist', + }, + }, + }, + }, + }, + }, + }, '/user/v1/account/list': { get: { summary: 'List user', tags: ['Users APIs'], description: - 'This API is associated with the listing of users based on condition \n - Endpoint for list user `/user/v1/account/list` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API lists users based on specified conditions.\n- Endpoint: `/user/v1/account/list`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', @@ -81000,7 +85972,7 @@

    Response samples

    { in: 'query', name: 'page', - description: 'Please add page number', + description: 'Page number for pagination.', required: false, schema: { type: 'number' }, example: 1, @@ -81008,7 +85980,7 @@

    Response samples

    { in: 'query', name: 'limit', - description: 'number of record to limit', + description: 'Number of records to limit.', required: false, schema: { type: 'number' }, example: 2, @@ -81016,7 +85988,7 @@

    Response samples

    { in: 'query', name: 'search', - description: 'Please search for name or title of user etc.', + description: 'Search for name or title of user, etc.', required: false, schema: { type: 'string' }, example: 'john', @@ -81036,10 +86008,10 @@

    Response samples

    }, '/user/v1/user/read/{userId}': { get: { - summary: 'User details', + summary: 'User Details', tags: ['Users APIs'], description: - "This API is associated with the user's profile details \n - Then Endpoint for user profile details `/user/v1/user/read/` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null", + "This API retrieves details of a user's profile.\n- Endpoint: `/user/v1/user/read/{userId}`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n", parameters: [ { name: 'X-auth-token', @@ -81053,14 +86025,14 @@

    Response samples

    in: 'path', name: 'userId', required: true, - description: 'Please append a valid User Id To the Request URL', + description: 'Please append a valid User ID to the Request URL.', schema: { type: 'integer' }, example: 1, }, ], responses: { 200: { - description: 'ok', + description: 'OK. User details retrieved successfully.', content: { 'application/json': { schema: { @@ -81070,7 +86042,9 @@

    Response samples

    }, }, 401: { - description: 'Unauthorized', + description: 'Unauthorized. X-auth-token is either missing or invalid.', + }, + content: { content: { 'application/json': { schema: { @@ -81084,10 +86058,10 @@

    Response samples

    }, '/user/v1/user/update': { patch: { - summary: 'Update user', + summary: 'Update User Profile', tags: ['Users APIs'], description: - 'This API is associated with update user profile \n - Then Endpoint for update user profile `/user/v1/user/update` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + "This API updates a user's profile.\n- Endpoint: `/user/v1/user/update`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n", parameters: [ { name: 'X-auth-token', @@ -81107,7 +86081,7 @@

    Response samples

    }, responses: { 200: { - description: 'ok', + description: 'OK. User profile updated successfully.', content: { 'application/json': { schema: { @@ -81117,7 +86091,7 @@

    Response samples

    }, }, 401: { - description: 'Unauthorized', + description: 'Unauthorized. X-auth-token is either missing or invalid.', content: { 'application/json': { schema: { @@ -81131,10 +86105,10 @@

    Response samples

    }, '/user/v1/user/share/{userId}': { get: { - summary: 'Share mentor profile', + summary: 'Share Mentor Profile', tags: ['Users APIs'], description: - 'This API is associated with Sharing mentor profile \n - The Endpoint for user profile details `/user/v1/user/share/` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + "This API is associated with sharing a mentor's profile.\n- Endpoint for sharing a mentor's profile: `/user/v1/user/share/{userId}`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n", parameters: [ { name: 'X-auth-token', @@ -81148,14 +86122,14 @@

    Response samples

    in: 'path', name: 'userId', required: true, - description: 'Please append a valid User Id To the Request URL', + description: 'Please append a valid User ID to the Request URL.', schema: { type: 'string' }, example: 1, }, ], responses: { 200: { - description: 'ok', + description: 'OK. Mentor profile shared successfully.', content: { 'application/json': { schema: { @@ -81165,7 +86139,7 @@

    Response samples

    }, }, 400: { - description: 'Bad Request', + description: 'Bad Request. Invalid parameters in the request.', content: { 'application/json': { schema: { @@ -81175,7 +86149,7 @@

    Response samples

    }, }, 401: { - description: 'Unauthorized', + description: 'Unauthorized. X-auth-token is either missing or invalid.', content: { 'application/json': { schema: { @@ -81189,10 +86163,10 @@

    Response samples

    }, '/user/v1/cloud-services/file/getSignedUrl?fileName={file_name}': { get: { - summary: 'Cloud services get signed url', - tags: ['Cloud services APIs'], + summary: 'Cloud Services - Get Signed URL', + tags: ['Cloud Services APIs'], description: - 'This API is associated with the cloud services for getting signed URL \n - Then Endpoint for cloud services `/user/v1/cloud-services/file/getSignedUrl` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is associated with cloud services for obtaining a signed URL.\n- Endpoint for cloud services: `/user/v1/cloud-services/file/getSignedUrl`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', @@ -81207,14 +86181,14 @@

    Response samples

    name: 'file_name', required: true, description: - 'Please append a valid file name to url which has to be uploaded', + 'Please append a valid file name to the URL, indicating the file to be uploaded.', schema: { type: 'string' }, example: 'image.jpg', }, ], responses: { 200: { - description: 'ok', + description: 'OK. Signed URL obtained successfully.', content: { 'application/json': { schema: { @@ -81228,10 +86202,10 @@

    Response samples

    }, '/user/v1/cloud-services/file/getDownloadableUrl?file_path={file_path}': { get: { - summary: 'Cloud services get download url', - tags: ['Cloud services APIs'], + summary: 'Cloud Services - Get Downloadable URL', + tags: ['Cloud Services APIs'], description: - 'This API is associated with the cloud services for getting downloadable URL \n - Then Endpoint for cloud services `/user/v1/cloud-services/file/getDownloadableUrl` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is associated with cloud services for obtaining a downloadable URL.\n- Endpoint for cloud services: `/user/v1/cloud-services/file/getDownloadableUrl`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', @@ -81246,14 +86220,14 @@

    Response samples

    name: 'file_path', required: true, description: - 'Please append a valid file path to url which has to be downloaded', + 'Please append a valid file path to the URL, indicating the file to be downloaded.', schema: { type: 'string' }, example: 'users/62832531a05cbd57b273aebb-1654149589875-image.jpg', }, ], responses: { 200: { - description: 'ok', + description: 'OK. Downloadable URL obtained successfully.', content: { 'application/json': { schema: { @@ -81265,12 +86239,42 @@

    Response samples

    }, }, }, + '/user/v1/cloud-services/file/getSampleCSV': { + get: { + summary: 'Cloud Services - Get Sample CSV', + tags: ['Cloud Services APIs'], + description: + 'This API is associated with cloud services for obtaining a sample CSV file for bulk user create.\n- Endpoint for cloud services: `/user/v1/cloud-services/file/getSampleCSV`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', + parameters: [ + { + name: 'X-auth-token', + in: 'header', + description: + 'To make use of the API, you require X-auth-token. This is Available in login API Response.', + required: true, + schema: { type: 'string' }, + }, + ], + responses: { + 200: { + description: 'OK. Sample CSV obtained successfully.', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/cloudServices/getSampleCSVResponse200', + }, + }, + }, + }, + }, + }, + }, '/user/v1/form/create': { post: { - summary: 'Create form', + summary: 'Create Form', tags: ['Form APIs'], description: - 'This API is associated with create form \n - Then Endpoint for create form `/user/v1/form/create` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is associated with creating a form.\n- Endpoint for creating a form: `/user/v1/form/create`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', @@ -81290,7 +86294,7 @@

    Response samples

    }, responses: { 200: { - description: 'ok', + description: 'OK. Form created successfully.', content: { 'application/json': { schema: { $ref: '#/components/schemas/form/createForm200Response' }, @@ -81298,7 +86302,7 @@

    Response samples

    }, }, 400: { - description: 'Bad Request', + description: 'Bad Request. Invalid input data.', content: { 'application/json': { schema: { $ref: '#/components/schemas/form/createForm400Response' }, @@ -81310,10 +86314,10 @@

    Response samples

    }, '/user/v1/form/update/{formId}': { patch: { - summary: 'Update form', + summary: 'Update Form', tags: ['Form APIs'], description: - 'This API is associated with update form \n - Then Endpoint for update form `/user/v1/form/update/{formId}` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is associated with updating a form.\n- Endpoint for updating a form: `/user/v1/form/update/{formId}`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', @@ -81327,7 +86331,7 @@

    Response samples

    in: 'path', name: 'formId', required: true, - description: 'Please append a valid form Id to the Request URL.', + description: 'Please append a valid form ID to the request URL.', schema: { type: 'string' }, example: 1, }, @@ -81341,7 +86345,7 @@

    Response samples

    }, responses: { 200: { - description: 'ok', + description: 'OK. Form updated successfully.', content: { 'application/json': { schema: { $ref: '#/components/schemas/form/updateForm200Response' }, @@ -81349,7 +86353,7 @@

    Response samples

    }, }, 400: { - description: 'Bad Request', + description: 'Bad Request. Invalid input or missing required parameters.', content: { 'application/json': { schema: { $ref: '#/components/schemas/form/updateForm400Response' }, @@ -81361,10 +86365,10 @@

    Response samples

    }, '/user/v1/form/read/{formId}': { post: { - summary: 'Get form details', + summary: 'Get Form Details', tags: ['Form APIs'], description: - 'This API is associated with update form \n - Then Endpoint for update form `/user/v1/form/update/{formId}` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is associated with retrieving form details.\n- Endpoint for retrieving form details: `/user/v1/form/read/{formId}`\n- It is mandatory to provide values for parameters marked with `required`.\n- Mandatory parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', @@ -81379,8 +86383,8 @@

    Response samples

    name: 'formId', required: true, description: 'Please append a valid form Id to the Request URL.', - schema: { type: 'string' }, - example: '62832531a05cbd57b273aebb', + schema: { type: 'integer' }, + example: 2, }, ], requestBody: { @@ -81392,7 +86396,7 @@

    Response samples

    }, responses: { 200: { - description: 'ok', + description: 'OK. Form details retrieved successfully.', content: { 'application/json': { schema: { $ref: '#/components/schemas/form/readForm200Response' }, @@ -81400,7 +86404,7 @@

    Response samples

    }, }, 400: { - description: 'Bad Request', + description: 'Bad Request. Invalid or missing parameters.', content: { 'application/json': { schema: { $ref: '#/components/schemas/form/readForm400Response' }, @@ -81412,10 +86416,10 @@

    Response samples

    }, '/user/v1/admin/create': { post: { - summary: 'Create admin user', + summary: 'Create Admin User', tags: ['Admin APIs'], description: - 'API associated with creating new admin user \n - Then Endpoint for create system user `/user/v1/admin/create` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'API associated with creating a new admin user.\n- Endpoint for creating a system user: `/user/v1/admin/create`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', requestBody: { content: { 'application/json': { @@ -81425,7 +86429,7 @@

    Response samples

    }, responses: { 201: { - description: 'ok', + description: 'OK. Admin user created successfully.', content: { 'application/json': { schema: { @@ -81435,7 +86439,7 @@

    Response samples

    }, }, 406: { - description: 'Bad Request. System User alrady exist', + description: 'Bad Request. System User already exists.', content: { 'application/json': { schema: { @@ -81449,10 +86453,10 @@

    Response samples

    }, '/user/v1/admin/login': { post: { - summary: 'Login admin user', + summary: 'Admin Login', tags: ['Admin APIs'], description: - 'This API is associated with login system user \n - Then Endpoint for login system user `/user/v1/systemUsers/login` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is associated with the login of the system user.\n- Endpoint for login system user: `/user/v1/admin/login`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', requestBody: { content: { 'application/json': { @@ -81462,7 +86466,7 @@

    Response samples

    }, responses: { 200: { - description: 'ok', + description: 'OK. Successful login.', content: { 'application/json': { schema: { @@ -81472,7 +86476,7 @@

    Response samples

    }, }, 400: { - description: "Bad Request. System User doesn't exist", + description: "Bad Request. System User doesn't exist.", content: { 'application/json': { schema: { @@ -81485,17 +86489,17 @@

    Response samples

    }, }, '/user/v1/admin/deleteUser/{id}': { - patch: { - summary: 'Delete user', + delete: { + summary: 'Delete User', tags: ['Admin APIs'], description: - 'This API is associated with delete user \n - Then Endpoint for delete user `/user/v1/admin/deleteUser` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'Delete a user.\n- Endpoint: `/user/v1/admin/deleteUser`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', in: 'header', description: - 'To make use of the API, you require X-auth-token. This is Available in login API Response.', + 'X-auth-token required for API access. Available in login API Response.', required: true, schema: { type: 'string' }, }, @@ -81503,14 +86507,15 @@

    Response samples

    in: 'path', name: 'id', required: true, - description: 'Please append a valid user id to the request url', + description: + 'User ID to be deleted. Please append a valid user ID to the request URL.', schema: { type: 'string' }, example: 1, }, ], responses: { 202: { - description: 'Accepted', + description: 'Accepted. User deletion request received.', content: { 'application/json': { schema: { @@ -81520,7 +86525,7 @@

    Response samples

    }, }, 400: { - description: 'Bad Request. User Entity Already Deleted', + description: 'Bad Request. User Already Deleted.', content: { 'application/json': { schema: { @@ -81536,14 +86541,14 @@

    Response samples

    post: { summary: 'Add Organization Admin', description: - 'This API is used to assign a user as the Org-Admin \n - Then Endpoint for delete user `/user/v1/admin/addOrgAdmin` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'Assigns a user as the Org-Admin.\n- Endpoint: `/user/v1/admin/addOrgAdmin`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', tags: ['Admin APIs'], parameters: [ { name: 'X-auth-token', in: 'header', description: - 'To make use of the API, you require X-auth-token. This is Available in login API Response.', + 'X-auth-token required for API access. Available in login API Response.', required: true, schema: { type: 'string' }, }, @@ -81555,8 +86560,18 @@

    Response samples

    schema: { type: 'object', properties: { - user_id: { type: 'integer', example: 12 }, - org_id: { type: 'integer', example: 55 }, + user_id: { + type: 'integer', + example: 12, + description: + 'The ID of the user to be assigned as Org-Admin.', + }, + organization_id: { + type: 'integer', + example: 55, + description: + 'The ID of the organization to which the user will be assigned as Org-Admin.', + }, }, }, }, @@ -81564,7 +86579,7 @@

    Response samples

    }, responses: { 200: { - description: 'OK', + description: 'OK. User assigned as the Org-Admin successfully.', content: { 'application/json': { schema: { @@ -81625,19 +86640,122 @@

    Response samples

    }, }, }, + '/user/v1/admin/deactivateOrg/{id}': { + post: { + summary: 'Deactivate Organization', + tags: ['Admin APIs'], + description: + 'Deactivates an organization.\n- Endpoint: `/user/v1/admin/deactivateOrg`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', + parameters: [ + { + name: 'X-auth-token', + in: 'header', + description: + 'X-auth-token required for API access. Available in login API Response.', + required: true, + schema: { type: 'string' }, + }, + { + in: 'path', + name: 'id', + required: true, + description: 'Please append a valid organization ID to the request URL.', + schema: { type: 'string' }, + example: 1, + }, + ], + responses: { + 202: { + description: 'Accepted. Organization deactivated successfully.', + content: { + 'application/json': { + schema: { $ref: '#/components/schemas/admin/deleteOrg202Response' }, + }, + }, + }, + 400: { + description: 'Bad Request. Organization Entity Already Deleted.', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/admin/deleteUser400Response', + }, + }, + }, + }, + }, + }, + }, + '/user/v1/admin/deactivateUser': { + post: { + summary: 'Deactivate User', + tags: ['Admin APIs'], + description: + 'Deactivates one or more users.\n- Endpoint: `/user/v1/admin/deactivateUser`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', + parameters: [ + { + name: 'X-auth-token', + in: 'header', + description: + 'X-auth-token required for API access. Available in login API Response.', + required: true, + schema: { type: 'string' }, + }, + ], + requestBody: { + required: true, + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + id: { + type: 'array', + items: { type: 'integer' }, + example: [1, 3], + }, + }, + }, + }, + }, + }, + responses: { + 202: { + description: 'Accepted. Users deactivated successfully.', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/admin/deactivateUser202Response', + }, + }, + }, + }, + 400: { + description: 'Bad Request. User Entity Already Deleted.', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/admin/deactivateUser400Response', + }, + }, + }, + }, + }, + }, + }, '/user/v1/organization/create': { post: { summary: 'Create Organization', tags: ['Organization'], description: - 'This API is associated with organization \n - The Endpoint for create organization `/user/v1/organization/create` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'Creates a new organization.\n- Endpoint: `/user/v1/organization/create`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', operationId: 'createOrganization', parameters: [ { name: 'X-auth-token', in: 'header', description: - 'To make use of the API, you require X-auth-token. This is Available in login API Response.', + 'X-auth-token required for API access. Available in the login API Response.', required: true, schema: { type: 'string' }, }, @@ -81653,7 +86771,7 @@

    Response samples

    }, responses: { 200: { - description: 'ok', + description: 'OK. Organization created successfully.', content: { 'application/json': { schema: { @@ -81663,7 +86781,7 @@

    Response samples

    }, }, 400: { - description: "Bad Request. System User doesn't exist", + description: 'Bad Request. Organization already exists', content: { 'application/json': { schema: { @@ -81680,14 +86798,14 @@

    Response samples

    summary: 'Update Organization', tags: ['Organization'], description: - 'This API is associated with organization \n - The Endpoint for update organization `/user/v1/organization/update` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', - operationId: 'createOrganization', + 'This API is associated with updating an organization.\n- Endpoint for updating organization: `/user/v1/organization/update`\n- It is mandatory to provide values for parameters marked with `required`.\n- Mandatory parameters cannot be empty or null.\n', + operationId: 'updateOrganization', parameters: [ { name: 'X-auth-token', in: 'header', description: - 'To make use of the API, you require X-auth-token. This is Available in login API Response.', + 'To make use of the API, you require X-auth-token. This is available in the login API response.', required: true, schema: { type: 'string' }, }, @@ -81695,7 +86813,7 @@

    Response samples

    name: 'id', in: 'path', required: true, - description: 'Please append a valid user id to the request url', + description: 'Please append a valid organization ID to the request URL.', schema: { type: 'integer' }, example: 1, }, @@ -81711,7 +86829,7 @@

    Response samples

    }, responses: { 200: { - description: 'ok', + description: 'OK. Organization updated successfully.', content: { 'application/json': { schema: { @@ -81721,7 +86839,7 @@

    Response samples

    }, }, 400: { - description: "Bad Request. System User doesn't exist", + description: "Bad Request. Organization doesn't exist.", content: { 'application/json': { schema: { @@ -81733,49 +86851,49 @@

    Response samples

    }, }, }, - '/user/v1/organization/list?page={page}&limit={limit}&search={search}': { + '/user/v1/organization/list': { get: { summary: 'List Organization', tags: ['Organization'], description: - 'This API is associated with the listing of organization based on condition \n - Endpoint for list organization `/user/v1/organization/list` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is associated with listing organizations based on specified conditions.\n- Endpoint for listing organizations: `/user/v1/organization/list`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', in: 'header', description: - 'To make use of the API, you require X-auth-token. This is Available in login API Response.', + 'To make use of the API, you require X-auth-token. This is available in the login API response.', required: true, schema: { type: 'string' }, }, { - in: 'path', + in: 'query', name: 'page', - description: 'Please add page number', + description: 'Please specify the page number.', required: false, schema: { type: 'number' }, example: 1, }, { - in: 'path', + in: 'query', name: 'limit', - description: 'number of record to limit', + description: 'Specify the number of records to limit.', required: false, schema: { type: 'number' }, example: 2, }, { - in: 'path', + in: 'query', name: 'search', - description: 'Please search for name or title of user etc.', + description: 'Search for organizations based on name or title.', required: false, schema: { type: 'string' }, - example: 'jhon', + example: 'john', }, ], responses: { 200: { - description: 'ok', + description: 'OK. Organizations listed successfully.', content: { 'application/json': { schema: { @@ -81790,32 +86908,42 @@

    Response samples

    '/user/v1/organization/requestOrgRole': { post: { summary: 'Request Org Role', - description: 'Request a specific role within an organization.', + description: + 'This API is associated with requesting a specific role within an organization.\n- Endpoint: `/user/v1/organization/requestOrgRole`\n- Mandatory parameters marked as `required` must have valid values.\n- Parameters cannot be empty or null.\n', tags: ['Organization'], parameters: [ { name: 'X-auth-token', in: 'header', description: - "User's access token which already recognizes the user as the organization's mentee.", + "User's access token, which already recognizes the user as the organization's mentee.", required: true, schema: { type: 'string' }, }, ], requestBody: { + description: 'Request body containing role information.', required: true, content: { 'application/json': { schema: { type: 'object', properties: { - role: { type: 'string', example: 'mentor' }, + role: { + type: 'integer', + example: 2, + description: 'The specific role being requested.', + }, form_data: { type: 'object', + description: + 'Additional data related to the organization-specific fields.', properties: { org_specific_fields: { type: 'string', example: 'answer', + description: + 'Data related to the organization-specific fields.', }, }, }, @@ -81826,83 +86954,11 @@

    Response samples

    }, responses: { 200: { - description: 'Successful request for organization role.', - content: { - 'application/json': { - example: { - responseCode: 'OK', - message: 'Mentor role requested successfully', - result: { - request_id: 12, - org_id: 10, - status: 'REQUESTED', - meta: {}, - }, - }, - }, - }, - }, - }, - }, - }, - '/user/v1/organization/getOrgRoleRequests': { - get: { - summary: 'Get User Org Role Requests', - description: - 'Get a list of organization role requests for a specific role. This api is used by the user to get the request for role change', - tags: ['Organization'], - parameters: [ - { - name: 'X-auth-token', - in: 'header', - description: - 'Access token of the user who is already a mentee of the organization.', - required: true, - schema: { type: 'string' }, - }, - { - name: 'page', - in: 'query', - description: 'Page number for pagination.', - required: true, - schema: { type: 'integer' }, - }, - { - name: 'limit', - in: 'query', - description: 'Number of items per page.', - required: true, - schema: { type: 'integer' }, - }, - { - name: 'role', - in: 'query', - description: 'The specific role for which requests are being fetched.', - required: true, - schema: { type: 'string' }, - }, - ], - responses: { - 200: { - description: 'Successfully fetched organization role requests.', + description: 'Successful request for organization role.', content: { 'application/json': { - example: { - responseCode: 'OK', - message: 'Org Role Requests Fetched Successfully', - result: { - data: [ - { - id: 12, - requester_id: 23, - role: 'mentor', - status: 'under_review', - org_id: 43, - handled_by: 22, - }, - ], - count: 1, - }, + schema: { + $ref: '#/components/schemas/organization/requestOrgRole200Response', }, }, }, @@ -81912,27 +86968,105 @@

    Response samples

    }, '/user/v1/userRole/list': { get: { - summary: 'UserRole List', - tags: ['UserRole APIs'], + summary: 'Get User Roles', + tags: ['User Roles APIs'], description: - "This API is associated with the user's role details \n - Then Endpoint for user profile details `/user/v1/userRole/list` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null", + 'Retrieve the list of user roles.\n\n- Endpoint: `/user/v1/userRole/list`\n- It is mandatory to provide values for parameters marked as `required`.\n- The X-auth-token obtained from the login API is required in the header.\n', parameters: [ { name: 'X-auth-token', in: 'header', - description: - 'To make use of the API, you require X-auth-token. This is Available in login API Response.', + description: 'X-auth-token obtained from the login API response.', required: true, schema: { type: 'string' }, }, + { in: 'query', name: '', description: '', schema: { type: 'string' } }, + { + in: 'path', + name: 'page', + description: 'Please add page number', + schema: { type: 'number' }, + }, + { + in: 'path', + name: 'limit', + description: 'Number of records to limit', + schema: { type: 'number' }, + }, + { + in: 'path', + name: 'search', + description: "Please search for information such as 'code' names", + schema: { type: 'string' }, + }, ], responses: { 200: { - description: 'ok', + description: 'OK', content: { 'application/json': { schema: { - $ref: '#/components/schemas/userRole/userRoleListResponse200', + $schema: 'http://json-schema.org/draft-04/schema#', + type: 'object', + properties: { + responseCode: { type: 'string' }, + message: { type: 'string' }, + result: { + type: 'object', + properties: { + data: { + type: 'array', + items: { + type: 'object', + properties: { + id: { type: 'number' }, + title: { type: 'string' }, + user_type: { type: 'number' }, + visibility: { type: 'string' }, + status: { type: 'string' }, + organization_id: { type: 'number' }, + }, + }, + }, + count: { type: 'number' }, + }, + }, + meta: { + type: 'object', + properties: { + formsVersion: { + type: 'array', + items: { type: 'string' }, + }, + correlation: { type: 'string' }, + }, + }, + }, + }, + examples: { + example1: { + value: { + responseCode: 'OK', + message: 'Roles fetched successfully', + result: { + data: [ + { + id: 6, + title: 'system_manager', + user_type: 1, + visibility: 'PUBLIC', + status: 'ACTIVE', + organization_id: 1, + }, + ], + count: 1, + }, + meta: { + formsVersion: [], + correlation: 'b36f45cf-039c-466d-9c50-4649fa4e0856', + }, + }, + }, }, }, }, @@ -81948,14 +87082,33 @@

    Response samples

    }, }, }, + requestBody: { + description: '', + content: { + 'application/json': { + schema: { + $schema: 'http://json-schema.org/draft-04/schema#', + type: 'object', + properties: { + filters: { + type: 'object', + properties: { organization_id: { type: 'number' } }, + }, + }, + required: ['filters'], + }, + examples: { example1: { value: { filters: { organization_id: 1 } } } }, + }, + }, + }, }, }, '/user/v1/entity-type/create': { post: { - summary: 'Create entity type', + summary: 'Create Entity Type', tags: ['EntityType APIs'], description: - 'You can use this API to create a user entity \n - The API Endpoint for creating a user entity is `/mentoring/v1/entity-type/create` \n - It is mandatory to provide values for parameters which are marked as `required` \n - This is a mandatory parameter and cannot be empty or null.', + 'Use this API to create a user entity.\n\n- Endpoint: `/mentoring/v1/entity-type/create`\n- Provide values for parameters marked as `required`.\n- The X-auth-token is mandatory and cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', @@ -81977,72 +87130,17 @@

    Response samples

    }, responses: { 201: { - description: 'Created', + description: 'OK Entity type created successfully', content: { - 'application.json': { + 'application/json': { schema: { - $schema: 'http://json-schema.org/draft-04/schema#', - type: 'object', - properties: { - responseCode: { type: 'string' }, - message: { type: 'string' }, - result: { - type: 'object', - properties: { - id: { type: 'number' }, - value: { type: 'string' }, - label: { type: 'string' }, - status: { type: 'string' }, - allow_filtering: { type: 'boolean' }, - data_type: { type: 'string' }, - created_by: { type: 'number' }, - updated_by: { type: 'number' }, - updated_at: { type: 'string' }, - created_at: { type: 'string' }, - deleted_at: { type: 'string' }, - has_entities: { type: 'boolean' }, - }, - }, - field_0: { type: 'string' }, - meta: { - type: 'object', - properties: { - correlation: { type: 'string' }, - meeting_platform: { type: 'string' }, - }, - }, - }, - }, - examples: { - example1: { - value: { - responseCode: 'OK', - message: 'Entity type created successfully', - result: { - id: 1, - value: 'ln', - label: 'Languages', - status: 'ACTIVE', - allow_filtering: true, - data_type: 'STRING', - created_by: 1, - updated_by: 1, - updated_at: '2023-09-22T12:40:19.817Z', - created_at: '2023-09-22T12:40:19.817Z', - has_entities: true, - }, - meta: { - correlation: '3babe76b-d277-4073-8a59-8dfb94face9b', - meeting_platform: 'BBB', - }, - }, - }, + $ref: '#/components/schemas/entity-type/createEntityType201Response', }, }, }, }, 400: { - description: 'Bad Request. Entity type alrady exist', + description: 'Bad Request. Entity type already exists', content: { 'application/json': { schema: { @@ -82056,16 +87154,15 @@

    Response samples

    }, '/user/v1/entity-type/update/{id}': { post: { - summary: 'Update entity type', - tags: ['EntityType APIs'], + summary: 'Update Entity Type', + tags: [], description: - 'This API is associated with entity type updation \n - Then Endpoint for create entity `/user/v1/entity-type/update` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'Use this API to update an entity type.\n\n- Endpoint: `/user/v1/entity-type/update/{id}`\n- Provide values for parameters marked as `required`.\n- The X-auth-token is mandatory and cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', in: 'header', - description: - 'To make use of the API, you require X-auth-token. This is Available in login API Response.', + description: 'Access token obtained from the login API response.', required: true, schema: { type: 'string' }, }, @@ -82073,7 +87170,7 @@

    Response samples

    name: 'id', in: 'path', required: true, - description: 'Please append a valid user id to the request url', + description: 'Please append a valid user ID to the request URL.', schema: { type: 'integer' }, example: 1, }, @@ -82089,7 +87186,7 @@

    Response samples

    }, responses: { 201: { - description: 'ok', + description: 'OK. Entity Type Updated Successfully', content: { 'application/json': { schema: { @@ -82099,7 +87196,7 @@

    Response samples

    }, }, 400: { - description: 'Bad Request. Entity type alrady exist', + description: 'Bad Request. Entity type already exists', content: { 'application/json': { schema: { @@ -82113,10 +87210,10 @@

    Response samples

    }, '/user/v1/entity-type/read': { post: { - summary: 'Read entity type', + summary: 'Read Entity Type', tags: ['EntityType APIs'], description: - 'This API is associated with entity type list \n - Then Endpoint for create entity `/user/v1/entity-type/read` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'Use this API to retrieve a list of entity types.\n\n- Endpoint: `/user/v1/entity-type/read`\n- Provide values for parameters marked as `required`.\n- The X-auth-token is mandatory and cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', @@ -82146,7 +87243,7 @@

    Response samples

    }, responses: { 201: { - description: 'Created', + description: 'OK Entity Type Fetched Successfully', content: { 'application.json': { schema: { @@ -82246,7 +87343,7 @@

    Response samples

    }, }, 400: { - description: 'Bad Request. Entity type alrady exist', + description: 'Bad Request. Entity type already exists', content: { 'application/json': { schema: { @@ -82259,17 +87356,17 @@

    Response samples

    }, }, '/user/v1/entity-type/delete/{id}': { - post: { - summary: 'Delete entity type', + delete: { + summary: 'Delete Entity Type', tags: ['EntityType APIs'], description: - 'This API is associated with delete entity \n - Then Endpoint for delete user entity `/user/v1/entity-type/delete` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is associated with deleting an entity type. - Endpoint for deleting a user entity: `/user/v1/entity-type/delete` - It is mandatory to provide values for parameters marked with `required`. - Mandatory parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', in: 'header', description: - 'To make use of the API, you require X-auth-token. This is Available in login API Response.', + 'To use the API, include X-auth-token. This is available in the login API response.', required: true, schema: { type: 'string' }, }, @@ -82277,7 +87374,7 @@

    Response samples

    in: 'path', name: 'id', required: true, - description: 'Please append a valid user entity id to the request url', + description: 'Please append a valid user entity ID to the request URL.', schema: { type: 'integer' }, example: 31, }, @@ -82294,7 +87391,7 @@

    Response samples

    }, }, 400: { - description: 'Bad Request. User Entity Already Deleted', + description: 'Bad Request. Entity Not Found', content: { 'application/json': { schema: { @@ -82308,10 +87405,10 @@

    Response samples

    }, '/user/v1/entity/create': { post: { - summary: 'Create entity', + summary: 'Create Entity', tags: ['Entity APIs'], description: - 'This API is associated with entity creation \n - Then Endpoint for create entity `/user/v1/entity/create` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is associated with entity creation.\n- Endpoint for creating an entity: `/user/v1/entity/create`.\n- It is mandatory to provide values for parameters marked with `required`.\n- Mandatory parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', @@ -82333,7 +87430,7 @@

    Response samples

    }, responses: { 201: { - description: 'Created', + description: 'OK. Created', content: { 'application.json': { schema: { @@ -82401,7 +87498,7 @@

    Response samples

    }, }, 400: { - description: 'Bad Request. User Entity alrady exist', + description: 'Bad Request. User Entity already exists', content: { 'application/json': { schema: { @@ -82415,10 +87512,10 @@

    Response samples

    }, '/user/v1/entity/update/{id}': { patch: { - summary: 'Update entity', + summary: 'Update Entity', tags: ['Entity APIs'], description: - 'This API is associated with update entity \n - Then Endpoint for update entity `/user/v1/entity/update` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is associated with updating an entity.\n- Endpoint for updating an entity: `/user/v1/entity/update`.\n- It is mandatory to provide values for parameters marked with `required`.\n- Mandatory parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', @@ -82432,7 +87529,7 @@

    Response samples

    in: 'path', name: 'id', required: true, - description: 'Please append a valid user entity id to the request url', + description: 'Please append a valid user entity ID to the request URL.', schema: { type: 'integer' }, example: 2, }, @@ -82444,10 +87541,22 @@

    Response samples

    $schema: 'http://json-schema.org/draft-04/schema#', type: 'object', properties: { - value: { type: 'string' }, - label: { type: 'string' }, - status: { type: 'string' }, - entity_type_id: { type: 'number' }, + value: { + type: 'string', + description: 'The value of the entity.', + }, + label: { + type: 'string', + description: 'The label of the entity.', + }, + status: { + type: 'string', + description: 'The status of the entity.', + }, + entity_type_id: { + type: 'number', + description: 'The ID of the entity type.', + }, }, }, examples: { @@ -82465,7 +87574,7 @@

    Response samples

    }, responses: { 202: { - description: 'Accepted', + description: 'OK. Accepted', content: { 'application.json': { schema: { @@ -82557,16 +87666,16 @@

    Response samples

    }, '/user/v1/entity/read?id={id}': { get: { - summary: 'Read user entity', + summary: 'Read User Entity', tags: ['Entity APIs'], description: - 'This API is associated with getting user entity based on id or value \n - Then Endpoint for getting user entity `/user/v1/entity/read` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is associated with retrieving a user entity based on ID or value.\n- Endpoint for retrieving a user entity: `/user/v1/entity/read`.\n- It is mandatory to provide values for parameters marked with `required`.\n- Mandatory parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', in: 'header', description: - 'To make use of the API, you require X-auth-token. This is Available in login API Response.', + 'To use the API, include X-auth-token. This is available in the login API response.', required: true, schema: { type: 'string' }, }, @@ -82574,7 +87683,7 @@

    Response samples

    in: 'query', name: 'id', required: true, - description: 'Please append a valid id', + description: 'Please append a valid ID.', schema: { type: 'integer' }, example: 1, }, @@ -82594,17 +87703,17 @@

    Response samples

    }, }, '/user/v1/entity/delete/{id}': { - post: { - summary: 'Delete entity', - tags: ['Entity APIs'], + delete: { + summary: 'Delete Entity', + tags: [], description: - 'This API is associated with delete entity \n - Then Endpoint for delete user entity `/user/v1/entity/delete` \n - It is mandatory to provide values for parameters marked with `required` \n - Mandatory parameter cannot be empty or null', + 'This API is associated with deleting an entity.\n- Endpoint for deleting a user entity: `/user/v1/entity/delete`.\n- It is mandatory to provide values for parameters marked with `required`.\n- Mandatory parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', in: 'header', description: - 'To make use of the API, you require X-auth-token. This is Available in login API Response.', + 'To use the API, include X-auth-token. This is available in the login API response.', required: true, schema: { type: 'string' }, }, @@ -82612,14 +87721,14 @@

    Response samples

    in: 'path', name: 'id', required: true, - description: 'Please append a valid user entity id to the request url', + description: 'Please append a valid user entity ID to the request URL.', schema: { type: 'integer' }, example: 31, }, ], responses: { 202: { - description: 'Accepted', + description: 'OK. Accepted', content: { 'application/json': { schema: { @@ -82644,7 +87753,8 @@

    Response samples

    '/user/v1/org-admin/getRequests': { post: { summary: 'Get Requests', - description: 'Get a list of organization requests based on specified filters.', + description: + 'Get a list of organization requests based on specified filters\n- Endpoint: `/user/v1/org-admin/getRequests`.\n- It is mandatory to provide values for parameters marked with `required`.\n- Mandatory parameters cannot be empty or null.\n', tags: ['Org Admin APIs'], parameters: [ { @@ -82681,15 +87791,19 @@

    Response samples

    properties: { role: { type: 'array', - items: { type: 'string', example: 'mentor' }, + items: { type: 'integer', example: 2 }, + description: 'An array of role IDs.', }, status: { type: 'array', - items: { type: 'string', example: 'requested' }, + items: { type: 'string', example: 'APPROVED' }, + description: 'An array of request statuses.', }, handled_by: { type: 'array', items: { type: 'integer', example: 2 }, + description: + 'An array of user IDs who handled the requests', }, }, }, @@ -82697,10 +87811,12 @@

    Response samples

    }, }, }, + description: + 'Request body for filtering organization requests.\n- `role`: An array of role IDs.\n- `status`: An array of request statuses.\n- `handled_by`: An array of user IDs who handled the requests.\n', }, responses: { 200: { - description: 'Successfully fetched organization requests.', + description: 'OK. Successfully fetched organization requests.', content: { 'application/json': { example: { @@ -82711,8 +87827,8 @@

    Response samples

    { id: 12, requester_id: 23, - role: 'mentor', - status: 'under_review', + role: 2, + status: 'APPROVED', org_id: 43, handled_by: 22, requester: { @@ -82724,8 +87840,8 @@

    Response samples

    { id: 13, requester_id: 22, - role: 'mentor', - status: 'approved', + role: 2, + status: 'APPROVED', org_id: 43, handled_by: 22, requester: { @@ -82747,13 +87863,412 @@

    Response samples

    '/user/v1/org-admin/updateRequestStatus': { post: { summary: 'Update Request Status', - description: 'Update the status of an organization request.', + description: + 'Update the status of an organization request.\n- Endpoint: `/user/v1/org-admin/updateRequestStatus`.\n- It is mandatory to provide values for parameters marked with `required`.\n- Mandatory parameters cannot be empty or null.\n', + tags: ['Org Admin APIs'], + parameters: [ + { + name: 'X-auth-token', + in: 'header', + description: 'Access token of the org admin.', + required: true, + schema: { type: 'string' }, + }, + ], + requestBody: { + required: true, + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + request_id: { + type: 'integer', + example: 12, + description: + 'The ID of the organization request to be updated.', + }, + comments: { + type: 'array', + items: { + type: 'string', + example: 'All uploaded documents verified', + }, + description: + 'Comments related to the request status update.', + }, + status: { + type: 'string', + enum: ['APPROVED', 'REJECTED', 'UNDER_REVIEW'], + example: 'APPROVED', + description: 'The new status for the organization request.', + }, + }, + }, + }, + }, + }, + responses: { + 200: { + description: 'OK. Successfully updated organization request status.', + content: { + 'application/json': { + example: { + responseCode: 'OK', + message: 'Successfully updated organization request status', + result: { + id: 12, + requester_id: 23, + status: 'approved', + org_id: 43, + handled_by: 22, + requester: { id: 23, name: 'Jake' }, + }, + }, + }, + }, + }, + }, + }, + }, + '/user/v1/org-admin/getRequestDetails': { + get: { + summary: 'Get Request Details', + description: + 'Get details of a specific organization request.\n- Endpoint: `/user/v1/org-admin/getRequestDetails`.\n- It is mandatory to provide values for parameters marked with `required`.\n- Mandatory parameters cannot be empty or null.\n', + tags: ['Org Admin APIs'], + parameters: [ + { + name: 'X-auth-token', + in: 'header', + description: 'Access token of the org admin.', + required: true, + schema: { type: 'string' }, + }, + { + name: 'request_id', + in: 'query', + description: 'ID of the request to get details for.', + required: true, + schema: { type: 'integer', example: 12 }, + }, + ], + responses: { + 200: { + description: 'OK. Successfully fetched organization request details.', + content: { + 'application/json': { + example: { + responseCode: 'OK', + message: 'Organisation request details fetched successfully', + result: { + id: 12, + requester_id: 23, + role: 'mentor', + status: 'approved', + org_id: 43, + handled_by: 22, + requester: { id: 23, name: 'Jake' }, + handler: { id: 24, name: 'org_admin name' }, + comments: ['Temp 1', 'Temp 2'], + meta: {}, + }, + }, + }, + }, + }, + }, + }, + }, + '/user/v1/org-admin/bulkUserCreate': { + post: { + summary: 'Bulk User Create', + description: + 'Create multiple users in bulk using a CSV file.\n- Endpoint: `/user/v1/org-admin/bulkUserCreate`.\n- It is mandatory to provide values for parameters marked with `required`.\n- Mandatory parameters cannot be empty or null.\n', + tags: [], + parameters: [ + { + name: 'X-auth-token', + in: 'header', + description: 'Access token of the org admin.', + required: true, + schema: { type: 'string' }, + }, + ], + requestBody: { + required: true, + content: { + 'application/json': { + schema: { + type: 'object', + properties: { + file_path: { + type: 'string', + description: + 'The path to the uploaded CSV file containing user data.', + example: 'path/to/uploaded-csv-file', + }, + }, + }, + }, + }, + }, + responses: { + 200: { + description: 'OK. Successfully uploaded bulk user invites CSV.', + content: { + 'application/json': { + example: { + responseCode: 'OK', + message: 'Bulk User Invites CSV Uploaded Successfully', + result: { + id: 20, + input_path: '', + status: 'UPLOADED', + created_by: 22, + type: 'text/csv', + updated_at: '2023-09-20T12:00:46.533Z', + created_at: '2023-09-20T12:00:46.533Z', + }, + }, + }, + }, + }, + }, + }, + }, + '/user/v1/org-admin/getBulkInvitesFilesList': { + get: { + summary: 'Get Bulk Invite Files List', + description: + 'Get a list of uploaded bulk invite CSV files.\n- Endpoint: `/user/v1/org-admin/getBulkInvitesFilesList`.\n- It is mandatory to provide values for parameters marked with `required`.\n- Mandatory parameters cannot be empty or null.\n', + tags: ['Org Admin APIs'], + parameters: [ + { + name: 'X-auth-token', + in: 'header', + description: 'Access token of the org admin.', + required: true, + schema: { type: 'string' }, + }, + { + name: 'page', + in: 'query', + description: 'Page number for pagination.', + required: true, + schema: { type: 'integer' }, + }, + { + name: 'limit', + in: 'query', + description: 'Number of items per page.', + required: true, + schema: { type: 'integer' }, + }, + { + name: 'status', + in: 'query', + description: 'Status of the bulk invite files (uploaded/processed/failed).', + required: true, + schema: { + type: 'string', + enum: ['uploaded', 'processed', 'failed'], + example: 'uploaded', + }, + }, + ], + responses: { + 200: { + description: 'OK. Successfully fetched bulk invite CSV list.', + content: { + 'application/json': { + example: { + responseCode: 'OK', + message: 'Bulk Invites CSV List Fetched Successfully', + result: { + data: [ + { + id: 12, + name: 'filename.csv', + input_path: '', + status: 'UPLOADED', + created_by: 4, + type: 'text/csv', + output_path: '', + }, + { + id: 13, + name: 'filename2.csv', + input_path: '', + status: 'UPLOADED', + created_by: 4, + type: 'text/csv', + output_path: '', + }, + ], + count: 2, + }, + }, + }, + }, + }, + }, + }, + }, + '/user/v1/org-admin/deactivateUser/{id}': { + post: { + summary: 'Deactivate User', + description: + 'Deactivate a user\n- Endpoint: `/user/v1/org-admin/deactivateUser`.\n- It is mandatory to provide values for parameters marked with `required`.\n- Mandatory parameters cannot be empty or null.\n', + tags: ['Org Admin APIs'], + parameters: [ + { + name: 'X-auth-token', + in: 'header', + description: 'Access token of the org admin.', + required: true, + schema: { type: 'string' }, + }, + { + name: 'id', + in: 'path', + description: 'ID of the user.', + required: true, + schema: { type: 'integer', example: 12 }, + }, + ], + responses: { + 202: { + description: 'Accepted', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/admin/deactivateUser202Response', + }, + }, + }, + }, + 400: { + description: 'Bad Request. User Entity Already Deleted', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/admin/deactivateUser400Response', + }, + }, + }, + }, + }, + }, + }, + '/user/v1/org-admin/inheritEntityType': { + post: { + summary: 'Inherit Entity Type', + description: + 'Inherit entity type.\n- Endpoint: `/user/v1/org-admin/inheritEntityType`.\n- It is mandatory to provide values for parameters marked with `required`.\n- Mandatory parameters cannot be empty or null.\n', tags: ['Org Admin APIs'], parameters: [ { name: 'X-auth-token', in: 'header', - description: 'Access token of the org admin.', + description: 'Access token of the org admin.', + required: true, + schema: { type: 'string' }, + }, + ], + requestBody: { + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/org-admin/inheritEntityTypeRequest', + }, + }, + }, + }, + responses: { + 202: { + description: 'Accepted', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/org-admin/inheritEntityType202Response', + }, + }, + }, + }, + 400: { + description: 'Bad Request. User Entity Already Deleted', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/notification/createNotification400Response', + }, + }, + }, + }, + }, + }, + }, + '/user/v1/notification/template': { + post: { + summary: 'Create, Update, and Delete Notification', + tags: ['Notification APIs'], + description: + 'This API is associated with notification create or update.\n- Endpoint: `/user/v1/notification/template`.\n- It is mandatory to provide values for parameters marked with `required`.\n- Mandatory parameters cannot be empty or null.\n', + parameters: [ + { + name: 'X-auth-token', + in: 'header', + description: + 'Access token required to use the API. Available in the login API response.', + required: true, + schema: { type: 'string' }, + }, + ], + requestBody: { + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/notification/createNotificationRequest', + }, + }, + }, + }, + responses: { + 202: { + description: 'Accepted', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/notification/createNotification200Response', + }, + }, + }, + }, + 400: { + description: 'Bad Request.', + content: { + 'application/json': { + schema: { + $ref: '#/components/schemas/notification/createNotification400Response', + }, + }, + }, + }, + }, + }, + }, + '/user/v1/userRole/Create': { + post: { + summary: 'Create User Role', + description: + 'Create roles for users.\n- Endpoint: `/user/v1/userRole/Create`.\n- It is mandatory to provide values for parameters marked with `required`.\n- Mandatory parameters cannot be empty or null.\n', + tags: ['User Roles APIs'], + parameters: [ + { + name: 'X-auth-token', + in: 'header', + description: 'Access token of the user', required: true, schema: { type: 'string' }, }, @@ -82763,89 +88278,87 @@

    Response samples

    content: { 'application/json': { schema: { + $schema: 'http://json-schema.org/draft-04/schema#', type: 'object', properties: { - request_id: { type: 'integer', example: 12 }, - comments: { - type: 'array', - items: { - type: 'string', - example: 'All uploaded documents verified', - }, - }, - status: { - type: 'string', - enum: ['APPROVED', 'REJECTED', 'UNDER_REVIEW'], - example: 'APPROVED', - }, + title: { type: 'string' }, + user_type: { type: 'number' }, + status: { type: 'string' }, + visibility: { type: 'string' }, + organization_id: { type: 'number' }, }, + required: [ + 'user_type', + 'status', + 'title', + 'visibility', + 'organization_id', + ], }, - }, - }, - }, - responses: { - 200: { - description: 'Successfully updated organization request status.', - content: { - 'application/json': { - example: { - responseCode: 'OK', - message: 'Successfully updated organization request status', - result: { - id: 12, - requester_id: 23, - status: 'approved', - org_id: 43, - handled_by: 22, - requester: { id: 23, name: 'Jake' }, + examples: { + example1: { + value: { + title: 'system_admin', + user_type: 1, + status: 'ACTIVE', + visibility: 'PUBLIC', + organization_id: 1, }, }, }, }, }, }, - }, - }, - '/user/v1/org-admin/getRequestDetails': { - get: { - summary: 'Get Request Details', - description: 'Get details of a specific organization request.', - tags: ['Org Admin APIs'], - parameters: [ - { - name: 'X-auth-token', - in: 'header', - description: 'Access token of the org admin.', - required: true, - schema: { type: 'string' }, - }, - { - name: 'request_id', - in: 'query', - description: 'ID of the request to get details for.', - required: true, - schema: { type: 'integer', example: 12 }, - }, - ], responses: { - 200: { - description: 'Successfully fetched organization request details.', + 201: { + description: 'OK', content: { 'application/json': { - example: { - responseCode: 'OK', - message: 'Organisation request details fetched successfully', - result: { - id: 12, - requester_id: 23, - role: 'mentor', - status: 'approved', - org_id: 43, - handled_by: 22, - requester: { id: 23, name: 'Jake' }, - handler: { id: 24, name: 'org_admin name' }, - comments: ['Temp 1', 'Temp 2'], - meta: {}, + schema: { + $schema: 'http://json-schema.org/draft-04/schema#', + type: 'object', + properties: { + responseCode: { type: 'string' }, + message: { type: 'string' }, + result: { + type: 'object', + properties: { + title: { type: 'string' }, + user_type: { type: 'number' }, + status: { type: 'string' }, + visibility: { type: 'string' }, + organization_id: { type: 'number' }, + }, + }, + meta: { + type: 'object', + properties: { + formsVersion: { + type: 'array', + items: { type: 'string' }, + }, + correlation: { type: 'string' }, + }, + }, + }, + }, + examples: { + example1: { + value: { + responseCode: 'OK', + message: 'Roles added successfully', + result: { + title: 'system_admin', + user_type: 1, + status: 'ACTIVE', + visibility: 'PUBLIC', + organization_id: 1, + }, + meta: { + formsVersion: [], + correlation: '483b441a-c4c2-4c71-9aae-8dcf2d7ee5e8', + }, + }, }, }, }, @@ -82854,30 +88367,58 @@

    Response samples

    }, }, }, - '/user/v1/org-admin/bulkUserCreate': { + '/user/v1/userRole/update/{id}': { post: { - summary: 'Bulk User Create', - description: 'Create multiple users in bulk using a CSV file.', - tags: ['Org Admin APIs'], + summary: 'Update User Roles', + tags: ['User Roles APIs'], + description: + 'Use this API to update an user Role.\n\n- Endpoint: `/user/v1/userRole/update/{id}`\n- Provide values for parameters marked as `required`.\n- The X-auth-token is mandatory and cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', in: 'header', - description: 'Access token of the org admin.', + description: 'Access token obtained from the login API response.', required: true, schema: { type: 'string' }, }, + { + name: 'id', + in: 'path', + required: true, + description: 'Please append a valid user ID to the request URL.', + schema: { type: 'integer' }, + example: 1, + }, ], requestBody: { - required: true, content: { 'application/json': { schema: { + $schema: 'http://json-schema.org/draft-04/schema#', type: 'object', properties: { - file_path: { - type: 'string', - example: 'path/to/uploaded-csv-file', + title: { type: 'string' }, + user_type: { type: 'number' }, + status: { type: 'string' }, + visibility: { type: 'string' }, + organization_id: { type: 'number' }, + }, + required: [ + 'title', + 'user_type', + 'status', + 'visibility', + 'organization_id', + ], + }, + examples: { + example1: { + value: { + title: 'system_', + user_type: 1, + status: 'ACTIVE', + visibility: 'PUBLIC', + organization_id: 3, }, }, }, @@ -82885,21 +88426,55 @@

    Response samples

    }, }, responses: { - 200: { - description: 'Successfully uploaded bulk user invites CSV.', + 201: { + description: 'OK. Roles updated successfully', content: { 'application/json': { - example: { - responseCode: 'OK', - message: 'Bulk User Invites CSV Uploaded Successfully', - result: { - id: 20, - input_path: '', - status: 'UPLOADED', - created_by: 22, - type: 'text/csv', - updated_at: '2023-09-20T12:00:46.533Z', - created_at: '2023-09-20T12:00:46.533Z', + schema: { + $schema: 'http://json-schema.org/draft-04/schema#', + type: 'object', + properties: { + responseCode: { type: 'string' }, + message: { type: 'string' }, + result: { + type: 'object', + properties: { + title: { type: 'string' }, + user_type: { type: 'number' }, + status: { type: 'string' }, + visibility: { type: 'string' }, + organization_id: { type: 'number' }, + }, + }, + meta: { + type: 'object', + properties: { + formsVersion: { + type: 'array', + items: { type: 'string' }, + }, + correlation: { type: 'string' }, + }, + }, + }, + }, + examples: { + example1: { + value: { + responseCode: 'OK', + message: 'Roles updated successfully', + result: { + title: 'system_', + user_type: 1, + status: 'ACTIVE', + visibility: 'PUBLIC', + organization_id: 3, + }, + meta: { + formsVersion: [], + correlation: '7672e4b5-2fa7-4022-a18b-cd574898e590', + }, + }, }, }, }, @@ -82908,75 +88483,65 @@

    Response samples

    }, }, }, - '/user/v1/org-admin/getBulkInvitesFilesList': { - get: { - summary: 'Get Bulk Invite Files List', - description: 'Get a list of uploaded bulk invite CSV files.', - tags: ['Org Admin APIs'], + '/user/v1/userRole/delete/{id}': { + delete: { + summary: 'Delete User Role', + tags: ['User Roles APIs'], + description: + 'This API is associated with deleting an role.\n- Endpoint for deleting a user role: `/user/v1/userRole/delete/{id}`.\n- It is mandatory to provide values for parameters marked with `required`.\n- Mandatory parameters cannot be empty or null.\n', parameters: [ { name: 'X-auth-token', in: 'header', - description: 'Access token of the org admin.', + description: + 'To use the API, include X-auth-token. This is available in the login API response.', required: true, schema: { type: 'string' }, }, { - name: 'page', - in: 'query', - description: 'Page number for pagination.', - required: true, - schema: { type: 'integer' }, - }, - { - name: 'limit', - in: 'query', - description: 'Number of items per page.', + in: 'path', + name: 'id', required: true, + description: 'Please append a valid user role ID to the request URL.', schema: { type: 'integer' }, - }, - { - name: 'status', - in: 'query', - description: 'Status of the bulk invite files (uploaded/processed/failed).', - required: true, - schema: { - type: 'string', - enum: ['uploaded', 'processed', 'failed'], - example: 'uploaded', - }, + example: 31, }, ], responses: { - 200: { - description: 'Successfully fetched bulk invite CSV list.', + 202: { + description: 'OK. Accepted', content: { 'application/json': { - example: { - responseCode: 'OK', - message: 'Bulk Invites CSV List Fetched Successfully', - result: { - data: [ - { - id: 12, - name: 'filename.csv', - input_path: '', - status: 'UPLOADED', - created_by: 4, - type: 'text/csv', - output_path: '', + schema: { + $schema: 'http://json-schema.org/draft-04/schema#', + type: 'object', + properties: { + responseCode: { type: 'string' }, + message: { type: 'string' }, + result: { type: 'object', properties: {} }, + meta: { + type: 'object', + properties: { + formsVersion: { + type: 'array', + items: { type: 'string' }, + }, + correlation: { type: 'string' }, }, - { - id: 13, - name: 'filename2.csv', - input_path: '', - status: 'UPLOADED', - created_by: 4, - type: 'text/csv', - output_path: '', + }, + }, + }, + examples: { + example1: { + value: { + responseCode: 'OK', + message: 'Module deleted successfully', + result: {}, + meta: { + formsVersion: [], + correlation: '645c901e-a7db-49a3-8d4c-dfc4f0b6dadb', }, - ], - count: 2, + }, }, }, }, @@ -82989,6 +88554,50 @@

    Response samples

    components: { schemas: { user: { + registrationOtp400Response: { + description: 'Email field is required', + type: 'object', + properties: { + responseCode: { type: 'string', example: 'CLIENT_ERROR' }, + message: { + type: 'string', + example: 'Validation failed, Entered data is incorrect!', + }, + error: { + type: 'array', + items: { + type: 'object', + properties: { + location: { type: 'string', example: 'body' }, + param: { type: 'string', example: 'email' }, + msg: { type: 'string', example: 'email field is empty' }, + }, + }, + }, + }, + }, + registrationOtpResponse200: { + description: 'Registration OTP response', + type: 'object', + properties: { + responseCode: { type: 'string', example: 'OK' }, + message: { + type: 'string', + example: + 'OTP has been sent to your registered email ID. Please enter the otp to complete the registration process.', + }, + result: { type: 'array', items: { type: 'string' }, example: [] }, + }, + }, + registrationOtpRequest: { + type: 'object', + description: 'Request body for registration OTP', + properties: { + name: { type: 'string', example: 'Anu' }, + email: { type: 'string', example: 'anu@gmail.com' }, + password: { type: 'string', example: 'password' }, + }, + }, userCreateUserRequest: { description: 'User program and solution request', type: 'object', @@ -83060,18 +88669,12 @@

    Response samples

    type: 'boolean', example: true, }, - preferred_language: { - type: 'object', - properties: { - value: { type: 'string', example: 'english' }, - label: { type: 'string', example: 'English' }, - }, - }, + preferred_language: { type: 'string', example: 'en' }, organization_id: { type: 'number', example: 1 }, roles: { type: 'array', items: { type: 'number' }, - example: [2], + example: [3], }, created_at: { type: 'string', @@ -83086,7 +88689,7 @@

    Response samples

    items: { type: 'object', properties: { - id: { type: 'number', example: 1 }, + id: { type: 'number', example: 3 }, title: { type: 'string', example: 'mentee' }, user_type: { type: 'number', example: 0 }, status: { type: 'string', example: 'ACTIVE' }, @@ -83113,23 +88716,23 @@

    Response samples

    type: 'object', properties: { responseCode: { type: 'string', example: 'CLIENT_ERROR' }, - message: { type: 'string', example: 'Incorrect code. Please try again.' }, + message: { type: 'string', example: 'The OTP you entered is wrong.' }, error: { type: 'array', items: { type: 'string' }, example: [] }, }, }, userLoginRequest: { type: 'object', - description: 'API for login', + description: 'Request body for user login', required: ['email', 'password'], properties: { email: { type: 'string', - description: 'Email Id of user', + description: 'Email address of the user', example: 'example@mail.com', }, password: { type: 'string', - description: 'Password of user', + description: 'User password', example: 'Password', }, }, @@ -83167,10 +88770,15 @@

    Response samples

    label: { type: 'string', example: 'Male' }, }, }, - location: { + languages: { type: 'array', - items: { type: 'string' }, - example: [], + items: { + type: 'object', + properties: { + value: { type: 'string', example: 'en_in' }, + label: { type: 'string', example: 'English' }, + }, + }, }, about: { type: 'string', example: null }, share_link: { type: 'string', example: null }, @@ -83184,7 +88792,19 @@

    Response samples

    type: 'boolean', example: true, }, - languages: { type: 'string', example: null }, + location: { + type: 'array', + items: { + type: 'object', + properties: { + value: { type: 'string', example: 'ap' }, + label: { + type: 'string', + example: 'Andhra Pradesh', + }, + }, + }, + }, preferred_language: { type: 'object', properties: { @@ -83192,7 +88812,15 @@

    Response samples

    label: { type: 'string', example: 'English' }, }, }, - organization_id: { type: 'number', example: 1 }, + organization: { + type: 'object', + properties: { + id: { type: 'number', example: 2 }, + name: { type: 'string', example: 'Tunerlabs' }, + code: { type: 'string', example: 'tl' }, + }, + }, + organization_id: { type: 'number', example: 2 }, roles: { type: 'array', items: { type: 'number' }, @@ -83261,8 +88889,8 @@

    Response samples

    }, generateTokenRequest: { type: 'object', - description: 'API for generate access token', - required: ['refreshToken'], + description: 'Request body for generating access token', + required: ['refresh_token'], properties: { refresh_token: { type: 'string', @@ -83273,7 +88901,7 @@

    Response samples

    }, }, generateTokenResponse200: { - description: 'OK, Access token has been genrated again.', + description: 'OK. Access token has been generated successfully.', type: 'object', properties: { responseCode: { type: 'string', example: 'OK' }, @@ -83319,17 +88947,17 @@

    Response samples

    }, genrateOtpRequest: { type: 'object', - description: 'API for genarting OTP', + description: 'Request body for generating OTP', required: ['email', 'password'], properties: { email: { type: 'string', - description: 'Email Id of user', + description: 'Email address of the user', example: 'example@mail.com', }, password: { type: 'string', - description: 'Password of user', + description: 'User password', example: 'Password', }, }, @@ -83370,20 +88998,24 @@

    Response samples

    }, resetPasswordRequest: { type: 'object', - description: 'API for reset password', + description: 'Request body for resetting the user password', required: ['email', 'password', 'otp'], properties: { email: { type: 'string', - description: 'Email Id of user', + description: 'Email address of the user', example: 'example@mail.com', }, password: { type: 'string', - description: 'New password of user', + description: 'New password of the user', example: 'New password', }, - otp: { type: 'number', description: 'OTP sent on mail', example: 123456 }, + otp: { + type: 'number', + description: "OTP sent to the user's email", + example: 123456, + }, }, }, resetPasswordResponse200: { @@ -83436,13 +89068,7 @@

    Response samples

    items: { type: 'string' }, example: [], }, - preferred_language: { - type: 'object', - properties: { - value: { type: 'string', example: 'english' }, - label: { type: 'string', example: 'English' }, - }, - }, + preferred_language: { type: 'string', example: 'en' }, organization_id: { type: 'number', example: 1 }, roles: { type: 'array', @@ -83488,7 +89114,7 @@

    Response samples

    }, }, resetPasswordResponse401: { - description: 'Bad Request', + description: 'UnAuthorized', type: 'object', properties: { responseCode: { type: 'string', example: 'CLIENT_ERROR' }, @@ -83498,7 +89124,7 @@

    Response samples

    }, logoutRequest: { type: 'object', - description: 'API for logout', + description: 'Request body for user logout', required: ['refreshToken'], properties: { refresh_token: { @@ -83657,15 +89283,33 @@

    Response samples

    }, updateRequest: { type: 'object', - description: 'User solutions response', + description: 'User profile update request', properties: { - name: { type: 'string', example: 'Jhon' }, - location: { type: 'array', items: { type: 'string' }, example: ['ap'] }, - about: { type: 'string', example: 'This is test about of mentee' }, - has_accepted_terms_and_conditions: { type: 'boolean', example: true }, - gender: { type: 'string', example: 'male' }, + name: { type: 'string', description: "The user's name.", example: 'John' }, + location: { + type: 'array', + items: { type: 'string', description: "The user's location(s)." }, + example: ['ap'], + }, + about: { + type: 'string', + description: 'A brief description about the user.', + example: 'Experienced Teacher', + }, + has_accepted_terms_and_conditions: { + type: 'boolean', + description: + 'Indicates whether the user has accepted terms and conditions.', + example: true, + }, + gender: { + type: 'string', + description: "The user's gender.", + example: 'male', + }, image: { type: 'string', + description: "URL of the user's profile image.", example: 'https://cloudstorage.com/container/abc.png', }, }, @@ -83746,43 +89390,86 @@

    Response samples

    form: { createFormRequest: { type: 'object', + description: 'Request body for creating a form.', required: ['type', 'sub_type', 'data'], properties: { - type: { type: 'string', example: 'profile' }, - sub_type: { type: 'string', example: 'profileForm' }, + type: { + type: 'string', + description: 'The type of the form.', + example: 'profile', + }, + sub_type: { + type: 'string', + description: 'The sub-type or category of the form.', + example: 'profileForm', + }, data: { type: 'object', + description: 'The main data structure for the form.', properties: { - template_name: { type: 'string', example: 'defaultTemplate' }, + template_name: { + type: 'string', + description: 'The name of the template used for the form.', + example: 'defaultTemplate', + }, fields: { type: 'object', + description: 'The fields that make up the form.', properties: { controls: { type: 'array', + description: 'An array of form controls.', items: { type: 'object', properties: { - name: { type: 'string', example: 'name' }, - label: { type: 'string', example: 'name' }, - value: { type: 'string', example: '' }, + name: { + type: 'string', + description: + 'The name or identifier of the form.', + example: 'name', + }, + label: { + type: 'string', + description: 'The label of the form.', + example: 'name', + }, + value: { + type: 'string', + description: 'Value of the form', + example: '', + }, class: { type: 'string', + description: + 'The CSS class associated with the form', example: 'ion-margin', }, - type: { type: 'string', example: 'text' }, + type: { + type: 'string', + description: + 'The type of the form control (e.g., text, checkbox).', + example: 'text', + }, position: { type: 'string', + description: 'The position of the form', example: 'floating', }, validators: { + description: + 'Validation rules for the form control.', type: 'object', properties: { required: { type: 'boolean', + description: + 'Indicates if the field is required.', example: true, }, minLength: { type: 'number', + description: + 'The minimum length allowed for the field.', example: 10, }, }, @@ -83815,44 +89502,87 @@

    Response samples

    }, }, updateFormRequest: { + description: 'Request body for updating a form.', type: 'object', required: ['type', 'sub_type', 'data'], properties: { - type: { type: 'string', example: 'profile' }, - sub_type: { type: 'string', example: 'profileForm' }, + type: { + type: 'string', + description: 'The type of the form.', + example: 'profile', + }, + sub_type: { + type: 'string', + description: 'The sub-type or category of the form.', + example: 'profileForm', + }, data: { type: 'object', + description: 'The main data structure for the form.', properties: { - template_name: { type: 'string', example: 'defaultTemplate' }, + template_name: { + type: 'string', + description: 'The name of the template used for the form.', + example: 'defaultTemplate', + }, fields: { type: 'object', + description: 'The fields that make up the form.', properties: { controls: { type: 'array', + description: 'An array of form controls.', items: { type: 'object', properties: { - name: { type: 'string', example: 'name' }, - label: { type: 'string', example: 'name' }, - value: { type: 'string', example: '' }, + name: { + type: 'string', + description: + 'The name or identifier of the form.', + example: 'name', + }, + label: { + type: 'string', + description: 'The label of the form.', + example: 'name', + }, + value: { + type: 'string', + description: 'Value of the form', + example: '', + }, class: { type: 'string', + description: + 'The CSS class associated with the form', example: 'ion-margin', }, - type: { type: 'string', example: 'text' }, + type: { + type: 'string', + description: + 'The type of the form control (e.g., text, checkbox).', + example: 'text', + }, position: { type: 'string', + description: 'The position of the form', example: 'floating', }, validators: { + description: + 'Validation rules for the form control.', type: 'object', properties: { required: { type: 'boolean', + description: + 'Indicates if the field is required.', example: true, }, minLength: { type: 'number', + description: + 'The minimum length allowed for the field.', example: 10, }, }, @@ -83886,9 +89616,14 @@

    Response samples

    }, readFormRequest: { type: 'object', + description: 'Request object for retrieving form details.', properties: { - type: { type: 'string', example: 'profile' }, - sub_type: { type: 'string', example: 'profileForm' }, + type: { type: 'string', description: 'Type of form.', example: 'profile' }, + sub_type: { + type: 'string', + description: 'Subtype of the form.', + example: 'profileForm', + }, }, }, readForm200Response: { @@ -83976,6 +89711,21 @@

    Response samples

    }, }, cloudServices: { + getSampleCSVResponse200: { + type: 'object', + properties: { + responseCode: { type: 'string', example: 'OK' }, + message: { + type: 'string', + example: 'Download Url Generated Successfully.', + }, + result: { + type: 'string', + example: + 'https://mentoring-dev-storage.s3.ap-south-1.amazonaws.com/sample/bulk_user_creation.csv', + }, + }, + }, cloudServicesResponse200: { type: 'object', properties: { @@ -84020,20 +89770,85 @@

    Response samples

    }, }, admin: { + deactivateUser400Response: { + type: 'object', + description: 'Delete org response', + properties: { + responseCode: { type: 'string', example: 'CLIENT_ERROR' }, + message: { + type: 'string', + example: 'Validation failed, Entered data is incorrect!', + }, + error: { + items: { + type: 'object', + properties: { + location: { type: 'string', example: 'body' }, + param: { type: 'string', example: 'id' }, + msg: { + type: 'string', + example: 'id must be an array and should not be empty.', + }, + }, + }, + }, + }, + }, + deactivateUser202Response: { + type: 'object', + description: 'Delete org response', + properties: { + responseCode: { type: 'string', example: 'OK' }, + message: { type: 'string', example: 'User deactivated Successfully.' }, + result: { type: 'array', items: { type: 'string' }, example: [] }, + }, + }, + deleteOrg202Response: { + type: 'object', + description: 'Delete org response', + properties: { + responseCode: { type: 'string', example: 'OK' }, + message: { + type: 'string', + example: 'Organization deactivated Successfully.', + }, + result: { + type: 'array', + items: { + type: 'object', + properties: { + deactivated_users: { type: 'integer', example: 100 }, + }, + }, + }, + }, + }, createSystemUserRequest: { type: 'object', - description: 'Creates System user', + description: 'Creates a new system user.', required: ['name', 'email', 'password', 'secret_code'], properties: { - name: { type: 'string', example: 'John Deo', required: true }, - email: { type: 'string', example: 'systemuser@mail.com', required: true }, + name: { + type: 'string', + example: 'John Deo', + description: 'Name of the system user.', + }, + email: { + type: 'string', + example: 'systemuser@mail.com', + description: 'Email of the system user.', + }, password: { type: 'string', format: 'password', example: 'password', - required: true, + description: 'Password for the system user.', + }, + secret_code: { + type: 'string', + example: 'secret_code', + description: 'Secret code for system user creation.', }, - secret_code: { type: 'string', example: 'secret_code', required: true }, }, }, createSystemUser201Response: { @@ -84045,13 +89860,7 @@

    Response samples

    type: 'string', example: 'Sign-up successful, Please wait while logging in.', }, - result: { - type: 'array', - items: { - type: 'object', - properties: { user_id: { type: 'integer', example: 1 } }, - }, - }, + result: { type: 'array', items: { type: 'string' }, example: [] }, }, }, createSystemUser406Response: { @@ -84065,13 +89874,19 @@

    Response samples

    }, loginSystemUserRequest: { type: 'object', - description: 'Creates System user', + description: 'Login System User Request', required: ['email', 'password'], properties: { - email: { type: 'string', example: 'systemuser@mail.com', required: true }, + email: { + type: 'string', + description: 'Email of the system user.', + example: 'systemuser@mail.com', + required: true, + }, password: { type: 'string', format: 'password', + description: 'Password of the system user.', example: 'password', required: true, }, @@ -84211,14 +90026,43 @@

    Response samples

    }, }, organization: { + requestOrgRole200Response: { + type: 'object', + description: 'Role change request response', + properties: { + responseCode: { type: 'string', example: 'OK' }, + message: { type: 'string', example: 'Mentor role requested successfully' }, + result: { + type: 'object', + properties: { + request_id: { type: 'integer', example: 12 }, + org_id: { type: 'integer', example: 10 }, + status: { tupe: 'string', example: 'REQUESTED' }, + meta: { type: 'object', example: {} }, + }, + }, + }, + }, createOrganizationRequest: { type: 'object', - description: 'Creates Organization', + description: 'Request payload for creating an organization.', required: ['name', 'code', 'description'], properties: { - name: { type: 'string', example: 'MentorEd' }, - code: { type: 'string', example: 'mentor112' }, - description: { type: 'string', example: 'testing' }, + name: { + type: 'string', + example: 'MentorEd', + description: 'The name of the organization.', + }, + code: { + type: 'string', + example: 'mentor112', + description: 'A unique code representing the organization.', + }, + description: { + type: 'string', + example: 'testing', + description: 'A brief description of the organization.', + }, }, }, createOrganization200Response: { @@ -84291,25 +90135,70 @@

    Response samples

    'entity-type': { createEntityTypeRequest: { type: 'object', + description: 'Request payload for creating a new entity type.', properties: { - value: { type: 'string', example: 'ln' }, - label: { type: 'string', example: 'Languages' }, - type: { type: 'string', example: 'SYSTEM' }, - allow_filtering: { type: 'boolean', example: true }, - data_type: { type: 'string' }, - has_entities: { type: 'boolean', example: 'STRING' }, + value: { + type: 'string', + description: 'Unique identifier for the entity type.', + example: 'ln', + }, + label: { + type: 'string', + description: 'Descriptive label for the entity type.', + example: 'Languages', + }, + type: { + type: 'string', + description: 'Type of the entity (e.g., SYSTEM, USER).', + example: 'SYSTEM', + }, + allow_filtering: { + type: 'boolean', + description: + 'Indicates whether filtering is allowed for this entity type.', + example: true, + }, + data_type: { type: 'string', description: 'Data type of the entity.' }, + has_entities: { + type: 'boolean', + description: + 'Indicates whether the entity type has associated entities.', + example: 'STRING', + }, }, }, updateEntityTypeRequest: { type: 'object', - description: 'entity type request', + description: 'entity type update request', properties: { - value: { type: 'string', example: 'roles' }, - label: { type: 'string', example: 'Roles' }, - status: { type: 'string', example: 'ACTIVE' }, - type: { type: 'string', example: 'SYSTEM' }, - allow_filtering: { type: 'boolean', example: true }, - data_type: { type: 'string', example: 'string' }, + value: { + type: 'string', + description: 'Unique identifier for the entity type.', + example: 'ln', + }, + label: { + type: 'string', + description: 'Descriptive label for the entity type.', + example: 'Languages', + }, + type: { + type: 'string', + description: 'Type of the entity (e.g., SYSTEM, USER).', + example: 'SYSTEM', + }, + allow_filtering: { + type: 'boolean', + description: + 'Indicates whether filtering is allowed for this entity type.', + example: true, + }, + data_type: { type: 'string', description: 'Data type of the entity.' }, + has_entities: { + type: 'boolean', + description: + 'Indicates whether the entity type has associated entities.', + example: 'STRING', + }, }, }, createEntityType201Response: { @@ -84545,14 +90434,156 @@

    Response samples

    }, }, }, + notification: { + createNotificationRequest: { + type: 'object', + description: 'Notificaion Create', + properties: { + type: { type: 'string', description: 'Type of email', example: 'email' }, + code: { + type: 'string', + description: 'Unique code for the email configuration', + example: 'tl-email-invite', + }, + subject: { + type: 'string', + description: 'Subject of the email', + example: 'Hi Welcome Back', + }, + body: { + type: 'string', + description: 'Body of the email', + example: '

    Dear User,

    Welcome back to mentorEd', + }, + email_header: { + type: 'string', + description: 'Email header content', + example: 'email_header', + }, + email_footer: { + type: 'string', + description: 'Email footer content', + example: 'email_footer', + }, + }, + }, + createNotification200Response: { + type: 'object', + description: 'Notificaion success response', + properties: { + responseCode: { type: 'string', example: 'OK' }, + message: { + type: 'string', + example: 'Notification template created successfully', + }, + result: { + type: 'object', + properties: { + status: { type: 'string', example: 'ACTIVE' }, + id: { type: 'number', example: 13 }, + type: { type: 'string', example: 'email' }, + code: { type: 'string', example: 'tl-email-invite' }, + subject: { type: 'string', example: 'Hi Welcome Backk' }, + body: { + type: 'string', + example: '

    Dear User

    Welcome back to mentorEd', + }, + email_header: { type: 'string', example: 'email_header' }, + email_footer: { type: 'string', example: 'email_footer' }, + organization_id: { type: 'number', example: 2 }, + created_by: { type: 'string', example: 9 }, + updated_at: { + type: 'string', + format: 'date-time', + example: '2023-12-05T06:55:42.178Z', + }, + created_at: { + type: 'string', + format: 'date-time', + example: '2023-12-05T06:55:42.178Z', + }, + updated_by: { type: 'integer', example: 9 }, + deleted_at: { type: 'string', example: null }, + }, + }, + }, + }, + createNotification400Response: { + type: 'object', + description: 'Notificaion 400 response', + properties: { + responseCode: { type: 'string', example: 'CLIENT_ERROR' }, + statusCode: { type: 'number', example: 400 }, + message: { type: 'string', example: "User does't have admin access." }, + }, + }, + }, + 'org-admin': { + inheritEntityTypeRequest: { + type: 'object', + description: 'Inherit entity type', + properties: { + entity_type_value: { type: 'string', example: 'categories' }, + target_entity_type_label: { type: 'string', example: 'training' }, + }, + }, + inheritEntityType202Response: { + type: 'object', + description: 'Inherit entity type response', + properties: { + responseCode: { type: 'string', example: 'OK' }, + message: { type: 'string', example: 'Entity type created successfully' }, + result: { + type: 'object', + properties: { + id: { type: 'number', example: 6 }, + value: { type: 'string', example: 'medium' }, + label: { type: 'string', example: 'Hindi' }, + status: { type: 'string', example: 'ACTIVE' }, + created_by: { type: 'number', example: 9 }, + updated_by: { type: 'number', example: 9 }, + allow_filtering: { type: 'boolean' }, + data_type: { type: 'string', example: 'ARRAY[STRING]' }, + organization_id: { type: 'number', example: 2 }, + parent_id: { type: 'number', example: 1 }, + allow_custom_entities: { type: 'boolean' }, + has_entities: { type: 'boolean' }, + model_names: { + type: 'array', + items: { type: 'string', example: 'session' }, + }, + created_at: { + type: 'string', + format: 'date-time', + example: '2023-11-29T10:16:56.236Z', + }, + updated_at: { + type: 'string', + format: 'date-time', + example: '2023-12-05T09:04:02.566Z', + }, + deleted_at: { type: 'string', example: null }, + }, + }, + }, + }, + }, securitySchemes: null, bearer: { type: 'apiKey', name: 'X-auth-token', in: 'header' }, }, }, + tags: [ + { name: 'User Roles APIs', description: '', externalDocs: { description: '', url: '' } }, + ], }, }, searchIndex: { store: [ + 'tag/User-Roles-APIs', + 'tag/User-Roles-APIs/paths/~1user~1v1~1userRole~1list/get', + 'tag/User-Roles-APIs/paths/~1user~1v1~1userRole~1Create/post', + 'tag/User-Roles-APIs/paths/~1user~1v1~1userRole~1update~1{id}/post', + 'tag/User-Roles-APIs/paths/~1user~1v1~1userRole~1delete~1{id}/delete', 'tag/User-APIs', 'tag/User-APIs/paths/~1user~1v1~1account~1create/post', 'tag/User-APIs/paths/~1user~1v1~1account~1login/post', @@ -84560,6 +90591,7 @@

    Response samples

    'tag/User-APIs/paths/~1user~1v1~1account~1generateOtp/post', 'tag/User-APIs/paths/~1user~1v1~1account~1resetPassword/post', 'tag/User-APIs/paths/~1user~1v1~1account~1logout/post', + 'tag/User-APIs/paths/~1user~1v1~1account~1registrationOtp/post', 'tag/Depreciated-APIs', 'tag/Depreciated-APIs/paths/~1user~1v1~1account~1acceptTermsAndCondition/patch', 'tag/Users-APIs', @@ -84567,9 +90599,10 @@

    Response samples

    'tag/Users-APIs/paths/~1user~1v1~1user~1read~1{userId}/get', 'tag/Users-APIs/paths/~1user~1v1~1user~1update/patch', 'tag/Users-APIs/paths/~1user~1v1~1user~1share~1{userId}/get', - 'tag/Cloud-services-APIs', - 'tag/Cloud-services-APIs/paths/~1user~1v1~1cloud-services~1file~1getSignedUrl?fileName={file_name}/get', - 'tag/Cloud-services-APIs/paths/~1user~1v1~1cloud-services~1file~1getDownloadableUrl?file_path={file_path}/get', + 'tag/Cloud-Services-APIs', + 'tag/Cloud-Services-APIs/paths/~1user~1v1~1cloud-services~1file~1getSignedUrl?fileName={file_name}/get', + 'tag/Cloud-Services-APIs/paths/~1user~1v1~1cloud-services~1file~1getDownloadableUrl?file_path={file_path}/get', + 'tag/Cloud-Services-APIs/paths/~1user~1v1~1cloud-services~1file~1getSampleCSV/get', 'tag/Form-APIs', 'tag/Form-APIs/paths/~1user~1v1~1form~1create/post', 'tag/Form-APIs/paths/~1user~1v1~1form~1update~1{formId}/patch', @@ -84577,363 +90610,469 @@

    Response samples

    'tag/Admin-APIs', 'tag/Admin-APIs/paths/~1user~1v1~1admin~1create/post', 'tag/Admin-APIs/paths/~1user~1v1~1admin~1login/post', - 'tag/Admin-APIs/paths/~1user~1v1~1admin~1deleteUser~1{id}/patch', + 'tag/Admin-APIs/paths/~1user~1v1~1admin~1deleteUser~1{id}/delete', 'tag/Admin-APIs/paths/~1user~1admin~1addOrgAdmin/post', + 'tag/Admin-APIs/paths/~1user~1v1~1admin~1deactivateOrg~1{id}/post', + 'tag/Admin-APIs/paths/~1user~1v1~1admin~1deactivateUser/post', 'tag/Organization', 'tag/Organization/operation/createOrganization', - 'tag/Organization/operation/createOrganization', - 'tag/Organization/paths/~1user~1v1~1organization~1list?page={page}&limit={limit}&search={search}/get', + 'tag/Organization/operation/updateOrganization', + 'tag/Organization/paths/~1user~1v1~1organization~1list/get', 'tag/Organization/paths/~1user~1v1~1organization~1requestOrgRole/post', - 'tag/Organization/paths/~1user~1v1~1organization~1getOrgRoleRequests/get', - 'tag/UserRole-APIs', - 'tag/UserRole-APIs/paths/~1user~1v1~1userRole~1list/get', 'tag/EntityType-APIs', 'tag/EntityType-APIs/paths/~1user~1v1~1entity-type~1create/post', - 'tag/EntityType-APIs/paths/~1user~1v1~1entity-type~1update~1{id}/post', 'tag/EntityType-APIs/paths/~1user~1v1~1entity-type~1read/post', - 'tag/EntityType-APIs/paths/~1user~1v1~1entity-type~1delete~1{id}/post', + 'tag/EntityType-APIs/paths/~1user~1v1~1entity-type~1delete~1{id}/delete', + '/paths/~1user~1v1~1entity-type~1update~1{id}/post', + '/paths/~1user~1v1~1entity~1delete~1{id}/delete', + '/paths/~1user~1v1~1org-admin~1bulkUserCreate/post', 'tag/Entity-APIs', 'tag/Entity-APIs/paths/~1user~1v1~1entity~1create/post', 'tag/Entity-APIs/paths/~1user~1v1~1entity~1update~1{id}/patch', 'tag/Entity-APIs/paths/~1user~1v1~1entity~1read?id={id}/get', - 'tag/Entity-APIs/paths/~1user~1v1~1entity~1delete~1{id}/post', 'tag/Org-Admin-APIs', 'tag/Org-Admin-APIs/paths/~1user~1v1~1org-admin~1getRequests/post', 'tag/Org-Admin-APIs/paths/~1user~1v1~1org-admin~1updateRequestStatus/post', 'tag/Org-Admin-APIs/paths/~1user~1v1~1org-admin~1getRequestDetails/get', - 'tag/Org-Admin-APIs/paths/~1user~1v1~1org-admin~1bulkUserCreate/post', 'tag/Org-Admin-APIs/paths/~1user~1v1~1org-admin~1getBulkInvitesFilesList/get', + 'tag/Org-Admin-APIs/paths/~1user~1v1~1org-admin~1deactivateUser~1{id}/post', + 'tag/Org-Admin-APIs/paths/~1user~1v1~1org-admin~1inheritEntityType/post', + 'tag/Notification-APIs', + 'tag/Notification-APIs/paths/~1user~1v1~1notification~1template/post', ], index: { version: '2.3.9', fields: ['title', 'description'], fieldVectors: [ - ['title/0', [0, 0.587, 1, 0.171]], + ['title/0', [0, 0.425, 1, 1.542, 2, 0.251]], ['description/0', []], - ['title/1', [0, 0.587, 2, 1.211]], + ['title/1', [0, 0.501, 1, 1.817]], [ 'description/1', [ - 0, 0.625, 1, 0.123, 2, 1.289, 3, 0.422, 4, 3.06, 5, 0.678, 6, 0.372, 7, 4.028, 8, - 0.55, 9, 0.372, 10, 0.372, 11, 0.55, 12, 0.372, 13, 0.515, 14, 0.372, 15, 0.372, 16, - 2.72, + 0, 0.41, 1, 1.487, 2, 0.242, 3, 2.144, 4, 1.657, 5, 0.222, 6, 0.204, 7, 3.302, 8, + 0.223, 9, 0.813, 10, 0.223, 11, 0.223, 12, 0.223, 13, 0.291, 14, 1.995, 15, 2.323, + 16, 2.144, 17, 3.302, ], ], - ['title/2', [17, 3.189]], + ['title/2', [0, 0.425, 1, 1.542, 18, 1.054]], [ 'description/2', [ - 0, 0.676, 1, 0.136, 3, 0.47, 5, 0.652, 6, 0.413, 8, 0.595, 9, 0.413, 10, 0.413, 11, - 0.595, 12, 0.413, 13, 0.387, 14, 0.413, 15, 0.413, 17, 2.997, 18, 4.353, + 0, 0.44, 1, 1.595, 5, 0.23, 6, 0.219, 8, 0.333, 9, 0.872, 10, 0.239, 11, 0.333, 12, + 0.239, 13, 0.219, 18, 1.09, 19, 3.541, 20, 0.259, 21, 0.259, ], ], - ['title/3', [19, 2.202, 20, 2.736, 21, 2.736]], + ['title/3', [0, 0.425, 1, 1.542, 22, 1.209]], [ 'description/3', [ - 1, 0.123, 3, 0.422, 5, 0.613, 6, 0.372, 8, 0.55, 9, 0.372, 10, 0.372, 11, 0.55, 12, - 0.372, 13, 0.348, 14, 0.372, 15, 0.372, 19, 2.773, 20, 3.445, 21, 4.102, 22, 2.72, - 23, 2.72, 24, 4.028, + 0, 0.429, 1, 1.557, 2, 0.253, 5, 0.227, 6, 0.214, 8, 0.233, 9, 0.851, 10, 0.233, 11, + 0.233, 12, 0.233, 13, 0.214, 14, 2.089, 20, 0.253, 21, 0.253, 22, 1.22, 23, 2.089, + 24, 3.458, ], ], - ['title/4', [19, 2.605, 25, 3.236]], + ['title/4', [0, 0.425, 1, 1.542, 25, 1.719]], [ 'description/4', [ - 1, 0.136, 3, 0.47, 5, 0.652, 6, 0.413, 8, 0.595, 9, 0.413, 10, 0.413, 11, 0.595, 12, - 0.413, 13, 0.387, 14, 0.413, 15, 0.413, 19, 2.997, 25, 3.722, 26, 4.353, + 0, 0.401, 1, 2.083, 2, 0.237, 5, 0.219, 6, 0.2, 8, 0.312, 9, 0.795, 10, 0.218, 11, + 0.312, 12, 0.218, 13, 0.2, 20, 0.237, 21, 0.237, 25, 2.321, 26, 0.909, 27, 3.229, ], ], - ['title/5', [27, 3.236, 28, 3.236]], + ['title/5', [0, 0.501, 2, 0.296]], + ['description/5', []], + ['title/6', [0, 0.501, 18, 1.242]], [ - 'description/5', + 'description/6', [ - 1, 0.136, 3, 0.47, 5, 0.652, 6, 0.413, 8, 0.595, 9, 0.413, 10, 0.413, 11, 0.595, 12, - 0.413, 13, 0.387, 14, 0.413, 15, 0.413, 27, 3.722, 28, 3.722, 29, 4.353, + 0, 0.574, 2, 0.237, 5, 0.219, 6, 0.2, 8, 0.312, 9, 0.795, 10, 0.218, 11, 0.312, 12, + 0.218, 13, 0.2, 18, 1.424, 20, 0.237, 21, 0.237, 26, 0.909, 28, 2.784, 29, 3.229, ], ], - ['title/6', [30, 3.961]], + ['title/7', [16, 3.189]], [ - 'description/6', + 'description/7', [ - 1, 0.143, 3, 0.492, 5, 0.668, 6, 0.433, 8, 0.615, 9, 0.433, 10, 0.433, 11, 0.615, - 12, 0.433, 13, 0.405, 14, 0.433, 15, 0.433, 30, 3.847, 31, 4.498, + 0, 0.584, 2, 0.242, 5, 0.222, 6, 0.204, 8, 0.317, 9, 0.813, 10, 0.223, 11, 0.317, + 12, 0.223, 13, 0.204, 20, 0.242, 21, 0.242, 26, 0.929, 30, 4.052, 31, 3.302, ], ], - ['title/7', [1, 0.171, 32, 3.784]], - ['description/7', []], - ['title/8', [5, 0.409, 33, 3.199, 34, 2.43]], + ['title/8', [32, 2.41, 33, 2.953, 34, 2.953]], [ 'description/8', - [1, 0.199, 13, 0.563, 35, 4.409, 36, 4.409, 37, 4.409, 38, 4.409, 39, 4.409, 40, 4.409], + [ + 2, 0.231, 5, 0.216, 6, 0.196, 8, 0.213, 10, 0.213, 11, 0.307, 12, 0.213, 13, 0.196, + 20, 0.231, 21, 0.231, 32, 3.204, 33, 2.724, 34, 4.603, 35, 3.159, 36, 3.159, 37, + 3.159, 38, 0.778, + ], ], - ['title/9', [0, 0.587, 1, 0.171]], - ['description/9', []], - ['title/10', [0, 0.587, 41, 1.696]], + ['title/9', [32, 2.839, 39, 2.839]], + [ + 'description/9', + [ + 2, 0.266, 5, 0.233, 6, 0.225, 8, 0.245, 10, 0.245, 11, 0.339, 12, 0.245, 13, 0.225, + 20, 0.266, 21, 0.266, 32, 2.553, 38, 0.893, 39, 2.553, 40, 3.629, + ], + ], + ['title/10', [41, 3.479, 42, 3.479]], [ 'description/10', [ - 0, 0.655, 1, 0.131, 3, 0.45, 5, 0.636, 6, 0.396, 8, 0.576, 9, 0.396, 10, 0.396, 11, - 0.576, 12, 0.396, 13, 0.37, 14, 0.396, 15, 0.396, 34, 2.2, 41, 1.89, 42, 1.993, 43, - 4.217, + 0, 0.44, 2, 0.259, 5, 0.23, 6, 0.219, 8, 0.239, 10, 0.239, 11, 0.333, 12, 0.239, 13, + 0.219, 20, 0.259, 21, 0.259, 38, 0.872, 41, 3.053, 42, 3.053, 43, 3.541, ], ], - ['title/11', [0, 0.587, 44, 2.057]], + ['title/11', [44, 4.911]], [ 'description/11', [ - 0, 0.45, 1, 0.131, 3, 0.45, 5, 0.636, 6, 0.396, 8, 0.576, 9, 0.396, 10, 0.396, 11, - 0.576, 12, 0.396, 13, 0.37, 14, 0.396, 15, 0.396, 44, 2.292, 45, 2.476, 46, 2.663, - 47, 2.896, 48, 2.896, + 0, 0.44, 2, 0.259, 5, 0.23, 6, 0.219, 8, 0.239, 10, 0.239, 11, 0.333, 12, 0.239, 13, + 0.219, 20, 0.259, 21, 0.259, 30, 3.053, 38, 0.872, 45, 3.541, 46, 3.541, ], ], - ['title/12', [0, 0.587, 49, 1.426]], + ['title/12', [39, 2.839, 47, 3.479]], [ 'description/12', [ - 0, 0.655, 1, 0.131, 3, 0.45, 5, 0.636, 6, 0.396, 8, 0.576, 9, 0.396, 10, 0.396, 11, - 0.576, 12, 0.396, 13, 0.37, 14, 0.396, 15, 0.396, 46, 2.663, 49, 1.589, 50, 4.217, + 2, 0.266, 5, 0.233, 6, 0.225, 8, 0.245, 10, 0.245, 11, 0.339, 12, 0.245, 13, 0.225, + 20, 0.266, 21, 0.266, 38, 0.893, 39, 2.553, 47, 3.129, 48, 3.629, ], ], - ['title/13', [4, 2.43, 46, 2.02, 51, 2.736]], + ['title/13', [2, 0.296, 49, 4.036]], + ['description/13', []], + ['title/14', [5, 0.139, 50, 3.425, 51, 2.642]], [ - 'description/13', + 'description/14', [ - 0, 0.45, 1, 0.131, 3, 0.45, 4, 2.2, 5, 0.636, 6, 0.396, 8, 0.576, 9, 0.396, 10, - 0.396, 11, 0.576, 12, 0.396, 13, 0.37, 14, 0.396, 15, 0.396, 44, 1.574, 46, 2.663, - 51, 2.476, 52, 2.896, 53, 2.896, + 2, 0.368, 5, 0.203, 6, 0.225, 13, 0.225, 14, 3.035, 16, 2.356, 23, 2.193, 38, 0.893, + 52, 3.629, 53, 3.629, 54, 3.629, 55, 3.629, 56, 3.629, 57, 3.629, ], ], - ['title/14', [1, 0.144, 54, 2.02, 55, 2.02]], - ['description/14', []], - ['title/15', [54, 1.75, 55, 1.75, 56, 2.369, 57, 1.908]], + ['title/15', [0, 0.501, 2, 0.296]], + ['description/15', []], + ['title/16', [0, 0.501, 4, 2.025]], [ - 'description/15', + 'description/16', [ - 1, 0.128, 3, 0.44, 5, 0.628, 6, 0.387, 8, 0.567, 9, 0.387, 10, 0.387, 11, 0.567, 12, - 0.387, 13, 0.362, 14, 0.387, 15, 0.387, 54, 2.622, 55, 2.622, 56, 2.424, 57, 1.952, - 58, 2.154, 59, 2.835, 60, 2.835, + 0, 0.42, 2, 0.247, 4, 1.695, 5, 0.224, 6, 0.209, 8, 0.228, 10, 0.228, 11, 0.322, 12, + 0.228, 13, 0.209, 20, 0.247, 21, 0.247, 38, 0.832, 51, 2.605, 58, 2.376, 59, 2.605, + 60, 3.378, ], ], - ['title/16', [54, 1.75, 55, 1.75, 57, 1.908, 61, 2.369]], + ['title/17', [0, 0.501, 61, 2.439]], [ - 'description/16', + 'description/17', [ - 1, 0.128, 3, 0.44, 5, 0.628, 6, 0.387, 8, 0.567, 9, 0.387, 10, 0.387, 11, 0.567, 12, - 0.387, 13, 0.362, 14, 0.387, 15, 0.387, 54, 2.622, 55, 2.622, 57, 1.952, 58, 2.154, - 61, 2.424, 62, 2.835, 63, 2.835, + 2, 0.253, 3, 2.245, 5, 0.227, 6, 0.214, 8, 0.233, 10, 0.233, 11, 0.328, 12, 0.233, + 13, 0.214, 20, 0.253, 21, 0.253, 38, 0.851, 61, 2.089, 62, 2.981, 63, 2.245, 64, + 3.458, ], ], - ['title/17', [1, 0.171, 64, 2.057]], - ['description/17', []], - ['title/18', [2, 1.211, 64, 2.057]], + ['title/18', [0, 0.425, 22, 1.209, 63, 2.224]], [ 'description/18', [ - 1, 0.136, 2, 1.393, 3, 0.47, 5, 0.652, 6, 0.413, 8, 0.595, 9, 0.413, 10, 0.413, 11, - 0.595, 12, 0.413, 13, 0.387, 14, 0.413, 15, 0.413, 64, 2.366, 65, 4.353, + 2, 0.259, 5, 0.23, 6, 0.219, 8, 0.239, 10, 0.239, 11, 0.333, 12, 0.239, 13, 0.219, + 20, 0.259, 21, 0.259, 22, 1.25, 38, 0.872, 62, 3.053, 63, 2.299, 65, 3.541, ], ], - ['title/19', [49, 1.426, 64, 2.057]], + ['title/19', [28, 2.953, 63, 2.224, 66, 2.953]], [ 'description/19', [ - 1, 0.136, 3, 0.47, 5, 0.652, 6, 0.413, 8, 0.595, 9, 0.413, 10, 0.413, 11, 0.595, 12, - 0.413, 13, 0.387, 14, 0.413, 15, 0.413, 49, 1.641, 64, 2.366, 66, 3.722, + 2, 0.237, 5, 0.219, 6, 0.2, 8, 0.218, 10, 0.218, 11, 0.312, 12, 0.218, 13, 0.2, 20, + 0.237, 21, 0.237, 26, 0.909, 38, 0.795, 63, 3.004, 66, 3.988, 67, 4.626, 68, 3.229, ], ], - ['title/20', [44, 2.057, 64, 2.057]], + ['title/20', [2, 0.251, 69, 1.937, 70, 1.937]], + ['description/20', []], + ['title/21', [5, 0.106, 69, 1.487, 70, 1.487, 71, 2.267, 72, 1.85]], [ - 'description/20', + 'description/21', [ - 1, 0.136, 3, 0.47, 5, 0.652, 6, 0.413, 8, 0.595, 9, 0.413, 10, 0.413, 11, 0.595, 12, - 0.413, 13, 0.387, 14, 0.413, 15, 0.413, 49, 1.641, 64, 2.366, 66, 2.587, 67, 3.025, + 2, 0.231, 5, 0.216, 6, 0.196, 8, 0.213, 10, 0.213, 11, 0.307, 12, 0.213, 13, 0.196, + 15, 2.222, 20, 0.231, 21, 0.231, 26, 0.889, 38, 0.778, 69, 2.576, 70, 2.576, 71, + 2.724, 72, 2.222, 73, 3.159, ], ], - ['title/21', [1, 0.171, 68, 2.211]], - ['description/21', []], - ['title/22', [0, 0.497, 2, 1.024, 68, 1.869]], + ['title/22', [5, 0.106, 69, 1.487, 70, 1.487, 72, 1.85, 74, 2.267]], [ 'description/22', [ - 0, 0.645, 1, 0.128, 2, 1.329, 3, 0.44, 5, 0.628, 6, 0.387, 8, 0.567, 9, 0.387, 10, - 0.387, 11, 0.567, 12, 0.387, 13, 0.362, 14, 0.387, 15, 0.387, 68, 1.656, 69, 2.835, - 70, 2.424, 71, 4.152, + 2, 0.231, 5, 0.216, 6, 0.196, 8, 0.213, 10, 0.213, 11, 0.307, 12, 0.213, 13, 0.196, + 15, 2.222, 20, 0.231, 21, 0.231, 26, 0.889, 38, 0.778, 69, 2.576, 70, 2.576, 72, + 2.222, 74, 2.724, 75, 3.159, ], ], - ['title/23', [0, 0.497, 17, 2.202, 68, 1.869]], + ['title/23', [5, 0.106, 69, 1.487, 70, 1.487, 76, 2.267, 77, 1.85]], [ 'description/23', [ - 0, 0.655, 1, 0.131, 3, 0.45, 5, 0.636, 6, 0.396, 8, 0.576, 9, 0.396, 10, 0.396, 11, - 0.576, 12, 0.396, 13, 0.37, 14, 0.396, 15, 0.396, 17, 2.903, 70, 3.606, 72, 2.896, - 73, 2.896, + 0, 0.361, 2, 0.213, 5, 0.206, 6, 0.18, 8, 0.196, 10, 0.196, 11, 0.289, 12, 0.196, + 13, 0.18, 15, 2.046, 18, 0.895, 20, 0.213, 21, 0.213, 26, 0.818, 38, 0.716, 69, + 2.425, 70, 2.425, 76, 2.507, 77, 2.046, 78, 2.046, 79, 1.888, 80, 2.908, ], ], - ['title/24', [0, 0.587, 74, 2.057]], + ['title/24', [2, 0.296, 81, 2.283]], + ['description/24', []], + ['title/25', [18, 1.242, 81, 2.283]], [ - 'description/24', + 'description/25', [ - 0, 0.676, 1, 0.136, 3, 0.47, 5, 0.652, 6, 0.413, 8, 0.595, 9, 0.413, 10, 0.413, 11, - 0.595, 12, 0.413, 13, 0.387, 14, 0.413, 15, 0.413, 74, 2.366, 75, 3.025, 76, 3.025, + 2, 0.247, 5, 0.224, 6, 0.209, 8, 0.228, 10, 0.228, 11, 0.322, 12, 0.228, 13, 0.209, + 18, 1.47, 20, 0.247, 21, 0.247, 26, 0.951, 38, 0.832, 81, 2.702, 82, 3.378, ], ], - ['title/25', [68, 1.869, 77, 3.199, 78, 1.206]], + ['title/26', [22, 1.424, 81, 2.283]], [ - 'description/25', + 'description/26', [ - 0, 0.665, 1, 0.133, 5, 0.643, 6, 0.404, 8, 0.585, 9, 0.404, 10, 0.404, 11, 0.585, - 12, 0.404, 13, 0.378, 14, 0.404, 15, 0.404, 74, 1.609, 79, 2.037, 80, 2.959, 81, - 2.959, 82, 2.959, 83, 2.959, + 2, 0.247, 5, 0.224, 6, 0.209, 8, 0.228, 10, 0.228, 11, 0.322, 12, 0.228, 13, 0.209, + 20, 0.247, 21, 0.247, 22, 1.685, 26, 0.951, 38, 0.832, 81, 2.702, 83, 3.378, ], ], - ['title/26', [78, 1.746]], - ['description/26', []], - ['title/27', [2, 1.211, 78, 1.426]], + ['title/27', [61, 2.439, 81, 2.283]], [ 'description/27', [ - 1, 0.14, 2, 0.99, 3, 0.48, 5, 0.66, 6, 0.423, 8, 0.605, 9, 0.423, 10, 0.423, 11, - 0.605, 12, 0.423, 13, 0.395, 14, 0.423, 15, 0.423, 78, 1.668, 84, 4.424, + 2, 0.231, 3, 2.957, 5, 0.216, 6, 0.196, 8, 0.307, 9, 0.778, 10, 0.213, 11, 0.307, + 12, 0.213, 13, 0.196, 20, 0.231, 21, 0.231, 26, 0.889, 61, 2.752, 81, 2.576, 84, + 3.159, ], ], - ['title/28', [49, 1.426, 78, 1.426]], + ['title/28', [2, 0.296, 85, 2.439]], + ['description/28', []], + ['title/29', [0, 0.425, 18, 1.054, 85, 2.07]], [ - 'description/28', + 'description/29', [ - 1, 0.14, 3, 0.48, 5, 0.66, 6, 0.423, 8, 0.605, 9, 0.423, 10, 0.423, 11, 0.605, 12, - 0.423, 13, 0.395, 14, 0.423, 15, 0.423, 49, 1.166, 78, 1.668, 85, 3.095, 86, 3.095, + 0, 0.566, 2, 0.231, 5, 0.216, 6, 0.196, 8, 0.213, 10, 0.213, 11, 0.307, 12, 0.213, + 13, 0.196, 18, 1.402, 20, 0.231, 21, 0.231, 26, 0.889, 38, 0.778, 85, 1.909, 86, + 2.724, 87, 2.724, 88, 3.159, ], ], - ['title/29', [41, 1.696, 78, 1.426]], + ['title/30', [16, 2.621, 85, 2.439]], [ - 'description/29', + 'description/30', [ - 1, 0.131, 3, 0.45, 5, 0.636, 6, 0.396, 8, 0.576, 9, 0.396, 10, 0.396, 11, 0.576, 12, - 0.396, 13, 0.37, 14, 0.396, 15, 0.396, 34, 2.2, 41, 1.89, 42, 1.993, 78, 1.589, 87, - 2.896, 88, 2.896, + 0, 0.574, 2, 0.237, 5, 0.219, 6, 0.2, 8, 0.218, 10, 0.218, 11, 0.312, 12, 0.218, 13, + 0.2, 16, 3.004, 20, 0.237, 21, 0.237, 26, 0.909, 38, 0.795, 87, 3.988, 89, 3.229, ], ], - ['title/30', [89, 1.434, 90, 2.43, 91, 2.02]], - ['description/30', [78, 1.778, 89, 2.114, 91, 2.979, 92, 3.583, 93, 4.717, 94, 4.717]], - ['title/31', [0, 0.43, 89, 1.242, 90, 2.105, 91, 1.75]], + ['title/31', [0, 0.501, 25, 2.025]], [ 'description/31', [ - 0, 0.588, 1, 0.171, 41, 1.698, 78, 1.428, 79, 2.609, 89, 2.282, 91, 3.632, 92, - 2.879, 95, 3.79, 96, 3.79, + 0, 0.462, 5, 0.236, 6, 0.23, 8, 0.251, 10, 0.251, 11, 0.345, 12, 0.251, 13, 0.23, + 20, 0.273, 21, 0.273, 25, 1.867, 38, 0.916, 90, 3.721, + ], + ], + ['title/32', [85, 2.07, 91, 3.425, 92, 1.328]], + [ + 'description/32', + [ + 0, 0.451, 5, 0.233, 6, 0.225, 8, 0.245, 10, 0.245, 11, 0.339, 12, 0.245, 13, 0.225, + 20, 0.266, 21, 0.266, 38, 0.893, 93, 3.629, 94, 3.629, 95, 3.629, ], ], - ['title/32', [1, 0.171, 97, 3.236]], - ['description/32', []], - ['title/33', [41, 1.696, 97, 3.236]], + ['title/33', [92, 1.565, 96, 2.439]], [ 'description/33', [ - 0, 0.45, 1, 0.131, 3, 0.45, 5, 0.636, 6, 0.396, 8, 0.576, 9, 0.396, 10, 0.396, 11, - 0.576, 12, 0.396, 13, 0.37, 14, 0.396, 15, 0.396, 44, 2.292, 45, 2.476, 46, 1.829, - 91, 1.829, 98, 4.217, + 5, 0.236, 6, 0.23, 8, 0.251, 10, 0.251, 11, 0.345, 12, 0.251, 13, 0.23, 20, 0.273, + 21, 0.273, 38, 0.916, 92, 1.443, 96, 2.249, 97, 3.721, ], ], - ['title/34', [1, 0.171, 99, 3.784]], - ['description/34', []], - ['title/35', [2, 1.024, 100, 0.97, 101, 1.869]], + ['title/34', [0, 0.501, 96, 2.439]], [ - 'description/35', + 'description/34', [ - 0, 0.645, 1, 0.187, 2, 1.329, 5, 0.628, 6, 0.387, 8, 0.567, 9, 0.387, 10, 0.387, 11, - 0.567, 12, 0.387, 13, 0.362, 14, 0.387, 15, 0.387, 79, 1.952, 100, 1.259, 102, - 2.835, 103, 2.835, + 0, 0.44, 5, 0.23, 6, 0.219, 8, 0.239, 10, 0.239, 11, 0.333, 12, 0.239, 13, 0.219, + 20, 0.259, 21, 0.259, 38, 0.872, 96, 2.14, 98, 3.541, 99, 3.541, 100, 3.541, ], ], - ['title/36', [49, 1.206, 100, 0.97, 101, 1.869]], + ['title/35', [92, 1.904]], + ['description/35', []], + ['title/36', [18, 1.242, 92, 1.565]], [ 'description/36', [ - 1, 0.133, 2, 0.947, 3, 0.459, 5, 0.643, 6, 0.404, 8, 0.585, 9, 0.404, 10, 0.404, 11, - 0.585, 12, 0.404, 13, 0.378, 14, 0.404, 15, 0.404, 49, 1.115, 100, 1.299, 101, - 1.729, 104, 2.959, 105, 2.959, + 5, 0.233, 6, 0.225, 8, 0.245, 10, 0.245, 11, 0.339, 12, 0.245, 13, 0.225, 18, 1.117, + 20, 0.266, 21, 0.266, 38, 0.893, 86, 3.129, 92, 1.407, 101, 3.629, ], ], - ['title/37', [100, 0.97, 101, 1.869, 106, 2.736]], + ['title/37', [22, 1.424, 92, 1.565]], [ 'description/37', [ - 1, 0.133, 2, 0.947, 3, 0.459, 5, 0.643, 6, 0.404, 8, 0.585, 9, 0.404, 10, 0.404, 11, - 0.585, 12, 0.404, 13, 0.378, 14, 0.404, 15, 0.404, 41, 1.326, 100, 1.299, 101, - 1.729, 107, 4.284, + 2, 0.242, 5, 0.222, 6, 0.204, 8, 0.317, 9, 0.813, 10, 0.223, 11, 0.317, 12, 0.223, + 13, 0.204, 20, 0.242, 21, 0.242, 22, 1.658, 26, 0.929, 92, 1.822, 102, 3.302, ], ], - ['title/38', [74, 1.739, 100, 0.97, 101, 1.869]], + ['title/38', [4, 2.025, 92, 1.565]], [ 'description/38', [ - 0, 0.459, 1, 0.133, 3, 0.459, 5, 0.643, 6, 0.404, 8, 0.585, 9, 0.404, 10, 0.404, 11, - 0.585, 12, 0.404, 13, 0.378, 14, 0.404, 15, 0.404, 74, 2.329, 100, 1.299, 108, - 2.959, 109, 2.959, + 2, 0.231, 4, 2.285, 5, 0.216, 6, 0.196, 8, 0.213, 10, 0.213, 11, 0.307, 12, 0.213, + 13, 0.196, 20, 0.231, 21, 0.231, 26, 0.889, 38, 0.778, 51, 2.437, 58, 2.222, 59, + 2.437, 92, 1.766, 103, 3.159, ], ], - ['title/39', [1, 0.171, 100, 1.148]], - ['description/39', []], - ['title/40', [2, 1.211, 100, 1.148]], + ['title/39', [1, 1.542, 104, 1.822, 105, 2.953]], [ - 'description/40', + 'description/39', [ - 1, 0.136, 2, 0.968, 3, 0.47, 5, 0.652, 6, 0.413, 8, 0.595, 9, 0.413, 10, 0.413, 11, - 0.595, 12, 0.413, 13, 0.387, 14, 0.413, 15, 0.413, 100, 1.32, 110, 3.025, 111, - 4.353, + 1, 1.487, 2, 0.242, 5, 0.222, 6, 0.204, 8, 0.223, 10, 0.223, 11, 0.317, 12, 0.223, + 13, 0.204, 20, 0.242, 21, 0.242, 26, 0.929, 38, 0.813, 92, 1.28, 104, 1.756, 106, + 2.846, 107, 3.302, 108, 3.302, ], ], - ['title/41', [49, 1.426, 100, 1.148]], + ['title/40', [2, 0.296, 109, 4.036]], + ['description/40', []], + ['title/41', [18, 1.054, 110, 1.054, 111, 1.719]], [ 'description/41', [ - 1, 0.136, 3, 0.47, 5, 0.652, 6, 0.413, 8, 0.595, 9, 0.413, 10, 0.413, 11, 0.595, 12, - 0.413, 13, 0.387, 14, 0.413, 15, 0.413, 49, 1.641, 100, 1.32, 112, 3.025, 113, - 3.025, + 0, 0.429, 2, 0.253, 5, 0.227, 6, 0.214, 8, 0.233, 9, 0.851, 10, 0.233, 11, 0.233, + 12, 0.233, 13, 0.214, 14, 2.089, 18, 1.064, 20, 0.253, 21, 0.253, 23, 2.089, 110, + 1.064, 112, 3.458, ], ], - ['title/42', [0, 0.497, 100, 0.97, 106, 2.736]], + ['title/42', [110, 1.054, 111, 1.719, 113, 2.953]], [ 'description/42', [ - 0, 0.625, 1, 0.123, 3, 0.422, 5, 0.613, 6, 0.372, 8, 0.55, 9, 0.372, 10, 0.55, 11, - 0.55, 12, 0.372, 13, 0.348, 14, 0.372, 15, 0.372, 42, 1.873, 58, 3.06, 100, 1.222, - 114, 2.72, 115, 2.72, 116, 2.72, + 2, 0.247, 3, 2.193, 4, 1.695, 5, 0.224, 6, 0.209, 8, 0.228, 9, 0.832, 10, 0.228, 11, + 0.228, 12, 0.228, 13, 0.209, 14, 2.041, 20, 0.247, 21, 0.247, 23, 2.041, 110, 1.04, + 111, 1.695, 114, 3.378, ], ], - ['title/43', [74, 2.057, 100, 1.148]], + ['title/43', [25, 1.719, 110, 1.054, 111, 1.719]], [ 'description/43', [ - 0, 0.459, 1, 0.133, 3, 0.459, 5, 0.643, 6, 0.404, 8, 0.585, 9, 0.404, 10, 0.404, 11, - 0.585, 12, 0.404, 13, 0.378, 14, 0.404, 15, 0.404, 74, 2.329, 100, 1.299, 117, - 2.959, 118, 2.959, + 0, 0.392, 2, 0.231, 5, 0.216, 6, 0.196, 8, 0.307, 9, 0.778, 10, 0.213, 11, 0.307, + 12, 0.213, 13, 0.196, 20, 0.231, 21, 0.231, 25, 2.285, 26, 0.889, 110, 1.402, 111, + 1.585, 115, 3.159, + ], + ], + ['title/44', [22, 1.209, 110, 1.054, 111, 1.719]], + [ + 'description/44', + [ + 2, 0.253, 5, 0.227, 6, 0.214, 8, 0.233, 9, 0.851, 10, 0.233, 11, 0.233, 12, 0.233, + 13, 0.214, 14, 2.089, 20, 0.253, 21, 0.253, 22, 1.22, 23, 2.089, 110, 1.064, 111, + 1.735, 116, 3.458, ], ], - ['title/44', [1, 0.144, 68, 1.869, 90, 2.43]], - ['description/44', []], - ['title/45', [89, 2.076]], + ['title/45', [25, 2.025, 110, 1.242]], [ 'description/45', - [41, 2.043, 42, 3.138, 78, 1.718, 89, 2.043, 119, 4.557, 120, 4.557, 121, 4.557], + [ + 0, 0.401, 2, 0.237, 5, 0.219, 6, 0.2, 8, 0.312, 9, 0.795, 10, 0.218, 11, 0.312, 12, + 0.218, 13, 0.2, 20, 0.237, 21, 0.237, 25, 2.321, 26, 0.909, 110, 1.424, 117, 3.229, + ], + ], + ['title/46', [0, 0.425, 18, 1.054, 79, 2.224]], + [ + 'description/46', + [ + 0, 0.401, 5, 0.219, 6, 0.2, 8, 0.312, 9, 0.795, 10, 0.218, 11, 0.312, 12, 0.218, 13, + 0.2, 18, 0.994, 20, 0.237, 21, 0.237, 23, 1.951, 77, 2.272, 78, 2.272, 79, 2.097, + 118, 3.229, 119, 3.229, + ], ], - ['title/46', [49, 1.206, 89, 1.434, 122, 2.736]], - ['description/46', [49, 1.842, 78, 1.842, 89, 2.19, 122, 4.179, 123, 4.887]], - ['title/47', [44, 2.057, 89, 1.696]], - ['description/47', [44, 2.657, 78, 1.842, 89, 2.19, 92, 3.713, 124, 4.887]], - ['title/48', [0, 0.497, 2, 1.024, 125, 2.202]], + ['title/47', [2, 0.296, 110, 1.242]], + ['description/47', []], + ['title/48', [18, 1.242, 110, 1.242]], [ 'description/48', [ - 0, 0.684, 2, 1.411, 79, 3.035, 125, 3.035, 126, 4.409, 127, 3.77, 128, 3.349, 129, - 4.409, + 2, 0.242, 5, 0.222, 6, 0.204, 8, 0.317, 9, 0.813, 10, 0.223, 11, 0.317, 12, 0.223, + 13, 0.204, 18, 1.016, 20, 0.242, 21, 0.242, 26, 0.929, 110, 1.447, 120, 3.302, 121, + 3.302, ], ], - ['title/49', [41, 1.242, 125, 1.908, 128, 2.105, 130, 2.369]], + ['title/49', [22, 1.424, 110, 1.242]], [ 'description/49', - [41, 2.043, 125, 3.138, 127, 3.897, 128, 3.462, 130, 3.897, 131, 4.557, 132, 4.557], + [ + 2, 0.242, 5, 0.222, 6, 0.204, 8, 0.317, 9, 0.813, 10, 0.223, 11, 0.317, 12, 0.223, + 13, 0.204, 20, 0.242, 21, 0.242, 22, 1.658, 26, 0.929, 110, 1.447, 122, 3.302, + ], + ], + ['title/50', [0, 0.425, 110, 1.054, 113, 2.953]], + [ + 'description/50', + [ + 0, 0.54, 2, 0.217, 3, 2.825, 5, 0.209, 6, 0.184, 8, 0.294, 9, 0.73, 10, 0.294, 11, + 0.294, 12, 0.2, 13, 0.184, 20, 0.217, 21, 0.217, 26, 0.835, 58, 2.087, 110, 1.339, + 123, 2.967, 124, 2.967, + ], + ], + ['title/51', [2, 0.251, 85, 2.07, 105, 2.953]], + ['description/51', []], + ['title/52', [104, 2.612]], + [ + 'description/52', + [ + 4, 1.657, 5, 0.222, 6, 0.204, 8, 0.317, 9, 0.813, 10, 0.223, 11, 0.317, 12, 0.223, + 13, 0.204, 20, 0.242, 21, 0.242, 58, 2.323, 59, 2.547, 92, 1.28, 104, 1.756, 125, + 3.302, 126, 3.302, + ], + ], + ['title/53', [22, 1.209, 104, 1.822, 127, 2.953]], + [ + 'description/53', + [ + 5, 0.227, 6, 0.214, 8, 0.328, 9, 0.851, 10, 0.233, 11, 0.328, 12, 0.233, 13, 0.214, + 20, 0.253, 21, 0.253, 22, 1.22, 92, 1.341, 104, 1.839, 127, 2.981, 128, 3.458, + ], + ], + ['title/54', [61, 2.439, 104, 2.146]], + [ + 'description/54', + [ + 5, 0.227, 6, 0.214, 8, 0.328, 9, 0.851, 10, 0.233, 11, 0.328, 12, 0.233, 13, 0.214, + 20, 0.253, 21, 0.253, 61, 2.089, 92, 1.341, 104, 1.839, 106, 2.981, 129, 3.458, + ], + ], + ['title/55', [4, 1.493, 78, 2.093, 79, 1.932, 130, 2.565]], + [ + 'description/55', + [ + 4, 1.657, 5, 0.222, 6, 0.204, 8, 0.317, 9, 0.813, 10, 0.223, 11, 0.317, 12, 0.223, + 13, 0.204, 20, 0.242, 21, 0.242, 77, 2.323, 78, 2.323, 79, 2.144, 130, 2.846, 131, + 3.302, 132, 3.302, + ], + ], + ['title/56', [0, 0.501, 96, 2.439]], + [ + 'description/56', + [ + 0, 0.451, 5, 0.233, 6, 0.225, 8, 0.339, 9, 0.893, 10, 0.245, 11, 0.339, 12, 0.245, + 13, 0.225, 20, 0.266, 21, 0.266, 96, 2.193, 133, 3.629, + ], + ], + ['title/57', [110, 1.054, 111, 1.719, 134, 2.953]], + [ + 'description/57', + [ + 5, 0.23, 6, 0.219, 8, 0.333, 9, 0.872, 10, 0.239, 11, 0.333, 12, 0.239, 13, 0.219, + 20, 0.259, 21, 0.259, 110, 1.09, 111, 1.777, 134, 3.053, 135, 3.541, + ], + ], + ['title/58', [2, 0.296, 136, 3.113]], + ['description/58', []], + ['title/59', [18, 0.916, 22, 1.05, 25, 1.493, 136, 2.295]], + [ + 'description/59', + [ + 2, 0.247, 5, 0.224, 6, 0.209, 8, 0.322, 9, 0.832, 10, 0.228, 11, 0.322, 12, 0.228, + 13, 0.209, 18, 1.04, 20, 0.247, 21, 0.247, 22, 1.192, 26, 0.951, 136, 2.605, 137, + 3.378, + ], ], ], invertedIndex: [ @@ -84941,228 +91080,270 @@

    Response samples

    '', { _index: 5, - title: { 8: {} }, + title: { 14: {}, 21: {}, 22: {}, 23: {} }, description: { 1: {}, 2: {}, 3: {}, 4: {}, - 5: {}, 6: {}, + 7: {}, + 8: {}, + 9: {}, 10: {}, 11: {}, 12: {}, - 13: {}, - 15: {}, + 14: {}, 16: {}, + 17: {}, 18: {}, 19: {}, - 20: {}, + 21: {}, 22: {}, 23: {}, - 24: {}, 25: {}, + 26: {}, 27: {}, - 28: {}, 29: {}, + 30: {}, + 31: {}, + 32: {}, 33: {}, - 35: {}, + 34: {}, 36: {}, 37: {}, 38: {}, - 40: {}, + 39: {}, 41: {}, 42: {}, 43: {}, + 44: {}, + 45: {}, + 46: {}, + 48: {}, + 49: {}, + 50: {}, + 52: {}, + 53: {}, + 54: {}, + 55: {}, + 56: {}, + 57: {}, + 59: {}, }, }, ], - ['access', { _index: 20, title: { 3: {} }, description: { 3: {} } }], - ['add', { _index: 77, title: { 25: {} }, description: {} }], + ['access', { _index: 33, title: { 8: {} }, description: { 8: {} } }], + ['add', { _index: 91, title: { 32: {} }, description: {} }], [ 'admin', { - _index: 68, - title: { 21: {}, 22: {}, 23: {}, 25: {}, 44: {} }, - description: { 22: {} }, + _index: 85, + title: { 28: {}, 29: {}, 30: {}, 32: {}, 51: {} }, + description: { 29: {} }, }, ], [ 'api', { - _index: 1, + _index: 2, title: { 0: {}, - 7: {}, - 9: {}, - 14: {}, - 17: {}, - 21: {}, - 32: {}, - 34: {}, - 39: {}, - 44: {}, + 5: {}, + 13: {}, + 15: {}, + 20: {}, + 24: {}, + 28: {}, + 40: {}, + 47: {}, + 51: {}, + 58: {}, }, description: { 1: {}, - 2: {}, 3: {}, 4: {}, - 5: {}, 6: {}, + 7: {}, 8: {}, + 9: {}, 10: {}, 11: {}, 12: {}, - 13: {}, - 15: {}, + 14: {}, 16: {}, + 17: {}, 18: {}, 19: {}, - 20: {}, + 21: {}, 22: {}, 23: {}, - 24: {}, 25: {}, + 26: {}, 27: {}, - 28: {}, 29: {}, - 31: {}, - 33: {}, - 35: {}, - 36: {}, + 30: {}, 37: {}, 38: {}, - 40: {}, + 39: {}, 41: {}, 42: {}, 43: {}, + 44: {}, + 45: {}, + 48: {}, + 49: {}, + 50: {}, + 59: {}, }, }, ], - ['assign', { _index: 80, title: {}, description: { 25: {} } }], + ['assign', { _index: 93, title: {}, description: { 32: {} } }], [ 'associ', { - _index: 3, + _index: 26, title: {}, description: { - 1: {}, - 2: {}, - 3: {}, 4: {}, - 5: {}, 6: {}, - 10: {}, - 11: {}, - 12: {}, - 13: {}, - 15: {}, - 16: {}, - 18: {}, + 7: {}, 19: {}, - 20: {}, + 21: {}, 22: {}, 23: {}, - 24: {}, + 25: {}, + 26: {}, 27: {}, - 28: {}, 29: {}, - 33: {}, - 36: {}, + 30: {}, 37: {}, 38: {}, - 40: {}, - 41: {}, - 42: {}, + 39: {}, 43: {}, + 45: {}, + 48: {}, + 49: {}, + 50: {}, + 59: {}, }, }, ], - ['base', { _index: 42, title: {}, description: { 10: {}, 29: {}, 42: {}, 45: {} } }], - ['bulk', { _index: 125, title: { 48: {}, 49: {} }, description: { 48: {}, 49: {} } }], - ['chang', { _index: 95, title: {}, description: { 31: {} } }], + ['base', { _index: 58, title: {}, description: { 16: {}, 38: {}, 50: {}, 52: {} } }], + [ + 'bulk', + { _index: 79, title: { 46: {}, 55: {} }, description: { 23: {}, 46: {}, 55: {} } }, + ], [ 'cloud', - { _index: 54, title: { 14: {}, 15: {}, 16: {} }, description: { 15: {}, 16: {} } }, + { + _index: 69, + title: { 20: {}, 21: {}, 22: {}, 23: {} }, + description: { 21: {}, 22: {}, 23: {} }, + }, ], - ['condit', { _index: 34, title: { 8: {} }, description: { 10: {}, 29: {} } }], + ['condit', { _index: 51, title: { 14: {} }, description: { 16: {}, 38: {} } }], [ 'creat', { - _index: 2, - title: { 1: {}, 18: {}, 22: {}, 27: {}, 35: {}, 40: {}, 48: {} }, + _index: 18, + title: { 2: {}, 6: {}, 25: {}, 29: {}, 36: {}, 41: {}, 46: {}, 48: {}, 59: {} }, description: { - 1: {}, - 18: {}, - 22: {}, - 27: {}, - 35: {}, + 2: {}, + 6: {}, + 23: {}, + 25: {}, + 29: {}, 36: {}, - 37: {}, - 40: {}, + 41: {}, + 46: {}, 48: {}, + 59: {}, }, }, ], - ['creation', { _index: 110, title: {}, description: { 40: {} } }], - ['csv', { _index: 127, title: {}, description: { 48: {}, 49: {} } }], + ['creation', { _index: 120, title: {}, description: { 48: {} } }], + ['csv', { _index: 77, title: { 23: {} }, description: { 23: {}, 46: {}, 55: {} } }], + [ + 'deactiv', + { + _index: 96, + title: { 33: {}, 34: {}, 56: {} }, + description: { 33: {}, 34: {}, 56: {} }, + }, + ], [ 'delet', { - _index: 74, - title: { 24: {}, 38: {}, 43: {} }, - description: { 24: {}, 25: {}, 38: {}, 43: {} }, + _index: 25, + title: { 4: {}, 31: {}, 43: {}, 45: {}, 59: {} }, + description: { 4: {}, 31: {}, 43: {}, 45: {} }, }, ], - ['depreci', { _index: 32, title: { 7: {} }, description: {} }], + ['depreci', { _index: 49, title: { 13: {} }, description: {} }], [ 'detail', { - _index: 44, - title: { 11: {}, 20: {}, 47: {} }, - description: { 11: {}, 13: {}, 33: {}, 47: {} }, + _index: 61, + title: { 17: {}, 27: {}, 54: {} }, + description: { 17: {}, 27: {}, 54: {} }, }, ], - ['download', { _index: 61, title: { 16: {} }, description: { 16: {} } }], - ['email', { _index: 37, title: {}, description: { 8: {} } }], + ['download', { _index: 74, title: { 22: {} }, description: { 22: {} } }], + ['email_verifi', { _index: 53, title: {}, description: { 14: {} } }], [ 'empti', { - _index: 14, + _index: 20, title: {}, description: { - 1: {}, 2: {}, 3: {}, 4: {}, - 5: {}, 6: {}, + 7: {}, + 8: {}, + 9: {}, 10: {}, 11: {}, 12: {}, - 13: {}, - 15: {}, 16: {}, + 17: {}, 18: {}, 19: {}, - 20: {}, + 21: {}, 22: {}, 23: {}, - 24: {}, 25: {}, + 26: {}, 27: {}, - 28: {}, 29: {}, + 30: {}, + 31: {}, + 32: {}, 33: {}, - 35: {}, + 34: {}, 36: {}, 37: {}, 38: {}, - 40: {}, + 39: {}, 41: {}, 42: {}, 43: {}, + 44: {}, + 45: {}, + 46: {}, + 48: {}, + 49: {}, + 50: {}, + 52: {}, + 53: {}, + 54: {}, + 55: {}, + 56: {}, + 57: {}, + 59: {}, }, }, ], @@ -85176,69 +91357,110 @@

    Response samples

    2: {}, 3: {}, 4: {}, - 5: {}, 6: {}, + 7: {}, + 8: {}, + 9: {}, 10: {}, 11: {}, 12: {}, - 13: {}, - 15: {}, + 14: {}, 16: {}, + 17: {}, 18: {}, 19: {}, - 20: {}, + 21: {}, 22: {}, 23: {}, - 24: {}, 25: {}, + 26: {}, 27: {}, - 28: {}, 29: {}, + 30: {}, + 31: {}, + 32: {}, 33: {}, - 35: {}, + 34: {}, 36: {}, 37: {}, 38: {}, - 40: {}, + 39: {}, 41: {}, 42: {}, 43: {}, + 44: {}, + 45: {}, + 46: {}, + 48: {}, + 49: {}, + 50: {}, + 52: {}, + 53: {}, + 54: {}, + 55: {}, + 56: {}, + 57: {}, + 59: {}, }, }, ], [ 'entiti', { - _index: 100, - title: { 35: {}, 36: {}, 37: {}, 38: {}, 39: {}, 40: {}, 41: {}, 42: {}, 43: {} }, - description: { 35: {}, 36: {}, 37: {}, 38: {}, 40: {}, 41: {}, 42: {}, 43: {} }, + _index: 110, + title: { + 41: {}, + 42: {}, + 43: {}, + 44: {}, + 45: {}, + 47: {}, + 48: {}, + 49: {}, + 50: {}, + 57: {}, + }, + description: { + 41: {}, + 42: {}, + 43: {}, + 44: {}, + 45: {}, + 48: {}, + 49: {}, + 50: {}, + 57: {}, + }, }, ], - ['entitytyp', { _index: 99, title: { 34: {} }, description: {} }], - ['file', { _index: 128, title: { 49: {} }, description: { 48: {}, 49: {} } }], - ['filter', { _index: 120, title: {}, description: { 45: {} } }], + ['entitytyp', { _index: 109, title: { 40: {} }, description: {} }], + ['field', { _index: 54, title: {}, description: { 14: {} } }], + ['file', { _index: 78, title: { 55: {} }, description: { 23: {}, 46: {}, 55: {} } }], + ['filter', { _index: 125, title: {}, description: { 52: {} } }], [ 'form', { - _index: 64, - title: { 17: {}, 18: {}, 19: {}, 20: {} }, - description: { 18: {}, 19: {}, 20: {} }, + _index: 81, + title: { 24: {}, 25: {}, 26: {}, 27: {} }, + description: { 25: {}, 26: {}, 27: {} }, }, ], - ['gener', { _index: 19, title: { 3: {}, 4: {} }, description: { 3: {}, 4: {} } }], - ['get', { _index: 58, title: {}, description: { 15: {}, 16: {}, 42: {} } }], - ['id', { _index: 114, title: {}, description: { 42: {} } }], - ['invit', { _index: 130, title: { 49: {} }, description: { 49: {} } }], + ['gener', { _index: 32, title: { 8: {}, 9: {} }, description: { 8: {}, 9: {} } }], + ['header', { _index: 17, title: {}, description: { 1: {} } }], + ['id', { _index: 123, title: {}, description: { 50: {} } }], + ['inherit', { _index: 134, title: { 57: {} }, description: { 57: {} } }], + ['invit', { _index: 130, title: { 55: {} }, description: { 55: {} } }], [ 'list', { - _index: 41, - title: { 10: {}, 29: {}, 33: {}, 49: {} }, - description: { 10: {}, 29: {}, 31: {}, 37: {}, 45: {}, 49: {} }, + _index: 4, + title: { 16: {}, 38: {}, 55: {} }, + description: { 1: {}, 16: {}, 38: {}, 42: {}, 52: {}, 55: {} }, }, ], - ['login', { _index: 17, title: { 2: {}, 23: {} }, description: { 2: {}, 23: {} } }], - ['logout', { _index: 30, title: { 6: {} }, description: { 6: {} } }], + ['log', { _index: 30, title: {}, description: { 7: {}, 11: {} } }], + ['login', { _index: 16, title: { 7: {}, 30: {} }, description: { 1: {}, 14: {}, 30: {} } }], + ['logout', { _index: 44, title: { 11: {} }, description: {} }], [ 'mandatori', { @@ -85249,33 +91471,49 @@

    Response samples

    2: {}, 3: {}, 4: {}, - 5: {}, 6: {}, + 7: {}, + 8: {}, + 9: {}, 10: {}, 11: {}, 12: {}, - 13: {}, - 15: {}, 16: {}, + 17: {}, 18: {}, 19: {}, - 20: {}, + 21: {}, 22: {}, 23: {}, - 24: {}, 25: {}, + 26: {}, 27: {}, - 28: {}, 29: {}, + 30: {}, + 31: {}, + 32: {}, 33: {}, - 35: {}, + 34: {}, 36: {}, 37: {}, 38: {}, - 40: {}, + 39: {}, 41: {}, 42: {}, 43: {}, + 44: {}, + 45: {}, + 46: {}, + 48: {}, + 49: {}, + 50: {}, + 52: {}, + 53: {}, + 54: {}, + 55: {}, + 56: {}, + 57: {}, + 59: {}, }, }, ], @@ -85289,91 +91527,128 @@

    Response samples

    2: {}, 3: {}, 4: {}, - 5: {}, 6: {}, + 7: {}, + 8: {}, + 9: {}, 10: {}, 11: {}, 12: {}, - 13: {}, - 15: {}, 16: {}, + 17: {}, 18: {}, 19: {}, - 20: {}, + 21: {}, 22: {}, 23: {}, - 24: {}, 25: {}, + 26: {}, 27: {}, - 28: {}, 29: {}, + 30: {}, + 31: {}, + 32: {}, 33: {}, - 35: {}, + 34: {}, 36: {}, 37: {}, 38: {}, - 40: {}, + 39: {}, 41: {}, 42: {}, 43: {}, + 44: {}, + 45: {}, + 46: {}, + 48: {}, + 49: {}, + 50: {}, + 52: {}, + 53: {}, + 54: {}, + 55: {}, + 56: {}, + 57: {}, + 59: {}, }, }, ], - ['mentor', { _index: 4, title: { 13: {} }, description: { 1: {}, 13: {} } }], - ['mentoring/v1/entity-type/cr', { _index: 102, title: {}, description: { 35: {} } }], - ['multipl', { _index: 126, title: {}, description: { 48: {} } }], - ['new', { _index: 69, title: {}, description: { 22: {} } }], + ['mentor', { _index: 28, title: { 19: {} }, description: { 6: {} } }], + ["mentor'", { _index: 67, title: {}, description: { 19: {} } }], + ['mentoring/v1/entity-type/cr', { _index: 112, title: {}, description: { 41: {} } }], + ['more', { _index: 99, title: {}, description: { 34: {} } }], + ['multipl', { _index: 118, title: {}, description: { 46: {} } }], + ['new', { _index: 86, title: {}, description: { 29: {}, 36: {} } }], + ['notif', { _index: 136, title: { 58: {}, 59: {} }, description: { 59: {} } }], [ 'null', { - _index: 15, + _index: 21, title: {}, description: { - 1: {}, 2: {}, 3: {}, 4: {}, - 5: {}, 6: {}, + 7: {}, + 8: {}, + 9: {}, 10: {}, 11: {}, 12: {}, - 13: {}, - 15: {}, 16: {}, + 17: {}, 18: {}, 19: {}, - 20: {}, + 21: {}, 22: {}, 23: {}, - 24: {}, 25: {}, + 26: {}, 27: {}, - 28: {}, 29: {}, + 30: {}, + 31: {}, + 32: {}, 33: {}, - 35: {}, + 34: {}, 36: {}, 37: {}, 38: {}, - 40: {}, + 39: {}, 41: {}, 42: {}, 43: {}, + 44: {}, + 45: {}, + 46: {}, + 48: {}, + 49: {}, + 50: {}, + 52: {}, + 53: {}, + 54: {}, + 55: {}, + 56: {}, + 57: {}, + 59: {}, }, }, ], - ['org', { _index: 90, title: { 30: {}, 31: {}, 44: {} }, description: {} }], - ['org-admin', { _index: 81, title: {}, description: { 25: {} } }], + ['obtain', { _index: 15, title: {}, description: { 1: {}, 21: {}, 22: {}, 23: {} } }], + ['on', { _index: 98, title: {}, description: { 34: {} } }], + ['org', { _index: 105, title: { 39: {}, 51: {} }, description: {} }], + ['org-admin', { _index: 94, title: {}, description: { 32: {} } }], [ 'organ', { - _index: 78, - title: { 25: {}, 26: {}, 27: {}, 28: {}, 29: {} }, - description: { 27: {}, 28: {}, 29: {}, 30: {}, 31: {}, 45: {}, 46: {}, 47: {} }, + _index: 92, + title: { 32: {}, 33: {}, 35: {}, 36: {}, 37: {}, 38: {} }, + description: { 33: {}, 36: {}, 37: {}, 38: {}, 39: {}, 52: {}, 53: {}, 54: {} }, }, ], - ['otp', { _index: 25, title: { 4: {} }, description: { 4: {} } }], + ['otp', { _index: 39, title: { 9: {}, 12: {} }, description: { 9: {}, 12: {} } }], + ['out', { _index: 45, title: {}, description: { 11: {} } }], [ 'paramet', { @@ -85384,40 +91659,56 @@

    Response samples

    2: {}, 3: {}, 4: {}, - 5: {}, 6: {}, + 7: {}, + 8: {}, + 9: {}, 10: {}, 11: {}, 12: {}, - 13: {}, - 15: {}, 16: {}, + 17: {}, 18: {}, 19: {}, - 20: {}, + 21: {}, 22: {}, 23: {}, - 24: {}, 25: {}, + 26: {}, 27: {}, - 28: {}, 29: {}, + 30: {}, + 31: {}, + 32: {}, 33: {}, - 35: {}, + 34: {}, 36: {}, 37: {}, 38: {}, - 40: {}, + 39: {}, 41: {}, 42: {}, 43: {}, + 44: {}, + 45: {}, + 46: {}, + 48: {}, + 49: {}, + 50: {}, + 52: {}, + 53: {}, + 54: {}, + 55: {}, + 56: {}, + 57: {}, + 59: {}, }, }, ], - ['password', { _index: 28, title: { 5: {} }, description: { 5: {} } }], + ['password', { _index: 42, title: { 10: {} }, description: { 10: {} } }], [ 'profil', - { _index: 46, title: { 13: {} }, description: { 11: {}, 12: {}, 13: {}, 33: {} } }, + { _index: 63, title: { 18: {}, 19: {} }, description: { 17: {}, 18: {}, 19: {} } }, ], [ 'provid', @@ -85429,45 +91720,39 @@

    Response samples

    2: {}, 3: {}, 4: {}, - 5: {}, 6: {}, - 10: {}, - 11: {}, - 12: {}, - 13: {}, - 15: {}, - 16: {}, - 18: {}, - 19: {}, - 20: {}, - 22: {}, - 23: {}, - 24: {}, - 25: {}, + 7: {}, 27: {}, - 28: {}, - 29: {}, - 33: {}, - 35: {}, - 36: {}, 37: {}, - 38: {}, - 40: {}, 41: {}, 42: {}, 43: {}, + 44: {}, + 45: {}, + 46: {}, + 48: {}, + 49: {}, + 50: {}, + 52: {}, + 53: {}, + 54: {}, + 55: {}, + 56: {}, + 57: {}, + 59: {}, }, }, ], - ['re-login', { _index: 22, title: {}, description: { 3: {} } }], - ['read', { _index: 106, title: { 37: {}, 42: {} }, description: {} }], - ['refresh', { _index: 23, title: {}, description: { 3: {} } }], + ['re-login', { _index: 35, title: {}, description: { 8: {} } }], + ['read', { _index: 113, title: { 42: {}, 50: {} }, description: {} }], + ['refresh', { _index: 36, title: {}, description: { 8: {} } }], + ['registr', { _index: 47, title: { 12: {} }, description: { 12: {} } }], [ 'request', { - _index: 89, - title: { 30: {}, 31: {}, 45: {}, 46: {}, 47: {} }, - description: { 30: {}, 31: {}, 45: {}, 46: {}, 47: {} }, + _index: 104, + title: { 39: {}, 52: {}, 53: {}, 54: {} }, + description: { 39: {}, 52: {}, 53: {}, 54: {} }, }, ], [ @@ -85480,76 +91765,112 @@

    Response samples

    2: {}, 3: {}, 4: {}, - 5: {}, 6: {}, + 7: {}, 8: {}, + 9: {}, 10: {}, 11: {}, 12: {}, - 13: {}, - 15: {}, + 14: {}, 16: {}, + 17: {}, 18: {}, 19: {}, - 20: {}, + 21: {}, 22: {}, 23: {}, - 24: {}, 25: {}, + 26: {}, 27: {}, - 28: {}, 29: {}, + 30: {}, + 31: {}, + 32: {}, 33: {}, - 35: {}, + 34: {}, 36: {}, 37: {}, 38: {}, - 40: {}, + 39: {}, 41: {}, 42: {}, 43: {}, + 44: {}, + 45: {}, + 46: {}, + 48: {}, + 49: {}, + 50: {}, + 52: {}, + 53: {}, + 54: {}, + 55: {}, + 56: {}, + 57: {}, + 59: {}, }, }, ], - ['reset', { _index: 27, title: { 5: {} }, description: { 5: {} } }], + ['reset', { _index: 41, title: { 10: {} }, description: { 10: {} } }], + ['respons', { _index: 57, title: {}, description: { 14: {} } }], + [ + 'retriev', + { _index: 3, title: {}, description: { 1: {}, 17: {}, 27: {}, 42: {}, 50: {} } }, + ], [ 'role', - { _index: 91, title: { 30: {}, 31: {} }, description: { 30: {}, 31: {}, 33: {} } }, + { + _index: 1, + title: { 0: {}, 1: {}, 2: {}, 3: {}, 4: {}, 39: {} }, + description: { 1: {}, 2: {}, 3: {}, 4: {}, 39: {} }, + }, ], - ['secretcod', { _index: 16, title: {}, description: { 1: {} } }], + ['sampl', { _index: 76, title: { 23: {} }, description: { 23: {} } }], [ 'servic', - { _index: 55, title: { 14: {}, 15: {}, 16: {} }, description: { 15: {}, 16: {} } }, + { + _index: 70, + title: { 20: {}, 21: {}, 22: {}, 23: {} }, + description: { 21: {}, 22: {}, 23: {} }, + }, ], - ['set', { _index: 36, title: {}, description: { 8: {} } }], - ['share', { _index: 51, title: { 13: {} }, description: { 13: {} } }], - ['sign', { _index: 56, title: { 15: {} }, description: { 15: {} } }], - ['specif', { _index: 92, title: {}, description: { 30: {}, 31: {}, 47: {} } }], - ['specifi', { _index: 119, title: {}, description: { 45: {} } }], - ['statu', { _index: 122, title: { 46: {} }, description: { 46: {} } }], - ['system', { _index: 70, title: {}, description: { 22: {}, 23: {} } }], - ['term', { _index: 33, title: { 8: {} }, description: {} }], - ['token', { _index: 21, title: { 3: {} }, description: { 3: {} } }], - ['true', { _index: 39, title: {}, description: { 8: {} } }], + ['set', { _index: 52, title: {}, description: { 14: {} } }], + ['share', { _index: 66, title: { 19: {} }, description: { 19: {} } }], + ['sign', { _index: 71, title: { 21: {} }, description: { 21: {} } }], + ['specif', { _index: 106, title: {}, description: { 39: {}, 54: {} } }], + ['specifi', { _index: 59, title: {}, description: { 16: {}, 38: {}, 52: {} } }], + ['statu', { _index: 127, title: { 53: {} }, description: { 53: {} } }], + ['system', { _index: 87, title: {}, description: { 29: {}, 30: {} } }], + ['term', { _index: 50, title: { 14: {} }, description: {} }], + ['token', { _index: 34, title: { 8: {} }, description: { 8: {} } }], + ['true', { _index: 55, title: {}, description: { 14: {} } }], [ 'type', { - _index: 101, - title: { 35: {}, 36: {}, 37: {}, 38: {} }, - description: { 36: {}, 37: {} }, + _index: 111, + title: { 41: {}, 42: {}, 43: {}, 44: {}, 57: {} }, + description: { 42: {}, 43: {}, 44: {}, 57: {} }, }, ], [ 'updat', { - _index: 49, - title: { 12: {}, 19: {}, 28: {}, 36: {}, 41: {}, 46: {} }, - description: { 12: {}, 19: {}, 20: {}, 28: {}, 36: {}, 41: {}, 46: {} }, + _index: 22, + title: { 3: {}, 18: {}, 26: {}, 37: {}, 44: {}, 49: {}, 53: {}, 59: {} }, + description: { 3: {}, 18: {}, 26: {}, 37: {}, 44: {}, 49: {}, 53: {}, 59: {} }, + }, + ], + ['upload', { _index: 131, title: {}, description: { 55: {} } }], + ['url', { _index: 72, title: { 21: {}, 22: {} }, description: { 21: {}, 22: {} } }], + [ + 'us', + { + _index: 23, + title: {}, + description: { 3: {}, 14: {}, 41: {}, 42: {}, 44: {}, 46: {} }, }, ], - ['upload', { _index: 131, title: {}, description: { 49: {} } }], - ['url', { _index: 57, title: { 15: {}, 16: {} }, description: { 15: {}, 16: {} } }], - ['us', { _index: 79, title: {}, description: { 25: {}, 31: {}, 35: {}, 48: {} } }], [ 'user', { @@ -85557,117 +91878,146 @@

    Response samples

    title: { 0: {}, 1: {}, - 9: {}, - 10: {}, - 11: {}, - 12: {}, - 22: {}, - 23: {}, - 24: {}, + 2: {}, + 3: {}, + 4: {}, + 5: {}, + 6: {}, + 15: {}, + 16: {}, + 17: {}, + 18: {}, + 29: {}, 31: {}, - 42: {}, - 48: {}, + 34: {}, + 46: {}, + 50: {}, + 56: {}, }, description: { 1: {}, 2: {}, + 3: {}, + 4: {}, + 6: {}, + 7: {}, 10: {}, 11: {}, - 12: {}, - 13: {}, - 22: {}, + 16: {}, 23: {}, - 24: {}, - 25: {}, + 29: {}, + 30: {}, 31: {}, - 33: {}, - 35: {}, - 38: {}, - 42: {}, + 32: {}, + 34: {}, + 41: {}, 43: {}, - 48: {}, + 45: {}, + 46: {}, + 50: {}, + 56: {}, }, }, ], - ["user'", { _index: 45, title: {}, description: { 11: {}, 33: {} } }], - ['user/admin/addorgadmin', { _index: 83, title: {}, description: { 25: {} } }], - ['user/v1/account/accepttermsandcondit', { _index: 40, title: {}, description: { 8: {} } }], - ['user/v1/account/cr', { _index: 7, title: {}, description: { 1: {} } }], - ['user/v1/account/generateotp', { _index: 26, title: {}, description: { 4: {} } }], - ['user/v1/account/generatetoken', { _index: 24, title: {}, description: { 3: {} } }], - ['user/v1/account/list', { _index: 43, title: {}, description: { 10: {} } }], - ['user/v1/account/login', { _index: 18, title: {}, description: { 2: {} } }], - ['user/v1/account/logout', { _index: 31, title: {}, description: { 6: {} } }], - ['user/v1/account/resetpassword', { _index: 29, title: {}, description: { 5: {} } }], - ['user/v1/admin/addorgadmin', { _index: 82, title: {}, description: { 25: {} } }], - ['user/v1/admin/cr', { _index: 71, title: {}, description: { 22: {} } }], - ['user/v1/admin/deleteus', { _index: 75, title: {}, description: { 24: {} } }], - ['user/v1/admin/deleteuser/{id', { _index: 76, title: {}, description: { 24: {} } }], - ['user/v1/admin/login', { _index: 73, title: {}, description: { 23: {} } }], + ["user'", { _index: 62, title: {}, description: { 17: {}, 18: {} } }], [ - 'user/v1/cloud-services/file/getdownloadableurl', - { _index: 62, title: {}, description: { 16: {} } }, + 'user/v1/account/accepttermsandcondit', + { _index: 56, title: {}, description: { 14: {} } }, ], + ['user/v1/account/cr', { _index: 29, title: {}, description: { 6: {} } }], + ['user/v1/account/generateotp', { _index: 40, title: {}, description: { 9: {} } }], + ['user/v1/account/generatetoken', { _index: 37, title: {}, description: { 8: {} } }], + ['user/v1/account/list', { _index: 60, title: {}, description: { 16: {} } }], + ['user/v1/account/login', { _index: 31, title: {}, description: { 7: {} } }], + ['user/v1/account/logout', { _index: 46, title: {}, description: { 11: {} } }], + ['user/v1/account/registrationotp', { _index: 48, title: {}, description: { 12: {} } }], + ['user/v1/account/resetpassword', { _index: 43, title: {}, description: { 10: {} } }], + ['user/v1/admin/addorgadmin', { _index: 95, title: {}, description: { 32: {} } }], + ['user/v1/admin/cr', { _index: 88, title: {}, description: { 29: {} } }], + ['user/v1/admin/deactivateorg', { _index: 97, title: {}, description: { 33: {} } }], + ['user/v1/admin/deactivateus', { _index: 100, title: {}, description: { 34: {} } }], + ['user/v1/admin/deleteus', { _index: 90, title: {}, description: { 31: {} } }], + ['user/v1/admin/login', { _index: 89, title: {}, description: { 30: {} } }], [ - 'user/v1/cloud-services/file/getdownloadableurl?file_path={file_path', - { _index: 63, title: {}, description: { 16: {} } }, + 'user/v1/cloud-services/file/getdownloadableurl', + { _index: 75, title: {}, description: { 22: {} } }, ], [ - 'user/v1/cloud-services/file/getsignedurl', - { _index: 59, title: {}, description: { 15: {} } }, + 'user/v1/cloud-services/file/getsamplecsv', + { _index: 80, title: {}, description: { 23: {} } }, ], [ - 'user/v1/cloud-services/file/getsignedurl?filename={file_nam', - { _index: 60, title: {}, description: { 15: {} } }, + 'user/v1/cloud-services/file/getsignedurl', + { _index: 73, title: {}, description: { 21: {} } }, ], - ['user/v1/entity-type/cr', { _index: 103, title: {}, description: { 35: {} } }], - ['user/v1/entity-type/delet', { _index: 108, title: {}, description: { 38: {} } }], - ['user/v1/entity-type/delete/{id', { _index: 109, title: {}, description: { 38: {} } }], - ['user/v1/entity-type/read', { _index: 107, title: {}, description: { 37: {} } }], - ['user/v1/entity-type/upd', { _index: 104, title: {}, description: { 36: {} } }], - ['user/v1/entity-type/update/{id', { _index: 105, title: {}, description: { 36: {} } }], - ['user/v1/entity/cr', { _index: 111, title: {}, description: { 40: {} } }], - ['user/v1/entity/delet', { _index: 117, title: {}, description: { 43: {} } }], - ['user/v1/entity/delete/{id', { _index: 118, title: {}, description: { 43: {} } }], - ['user/v1/entity/read', { _index: 115, title: {}, description: { 42: {} } }], - ['user/v1/entity/read?id={id', { _index: 116, title: {}, description: { 42: {} } }], - ['user/v1/entity/upd', { _index: 112, title: {}, description: { 41: {} } }], - ['user/v1/entity/update/{id', { _index: 113, title: {}, description: { 41: {} } }], - ['user/v1/form/cr', { _index: 65, title: {}, description: { 18: {} } }], - ['user/v1/form/read/{formid', { _index: 67, title: {}, description: { 20: {} } }], - ['user/v1/form/update/{formid', { _index: 66, title: {}, description: { 19: {}, 20: {} } }], - ['user/v1/org-admin/bulkusercr', { _index: 129, title: {}, description: { 48: {} } }], + ['user/v1/entity-type/delet', { _index: 115, title: {}, description: { 43: {} } }], + ['user/v1/entity-type/read', { _index: 114, title: {}, description: { 42: {} } }], + ['user/v1/entity-type/update/{id', { _index: 116, title: {}, description: { 44: {} } }], + ['user/v1/entity/cr', { _index: 121, title: {}, description: { 48: {} } }], + ['user/v1/entity/delet', { _index: 117, title: {}, description: { 45: {} } }], + ['user/v1/entity/read', { _index: 124, title: {}, description: { 50: {} } }], + ['user/v1/entity/upd', { _index: 122, title: {}, description: { 49: {} } }], + ['user/v1/form/cr', { _index: 82, title: {}, description: { 25: {} } }], + ['user/v1/form/read/{formid', { _index: 84, title: {}, description: { 27: {} } }], + ['user/v1/form/update/{formid', { _index: 83, title: {}, description: { 26: {} } }], + ['user/v1/notification/templ', { _index: 137, title: {}, description: { 59: {} } }], + ['user/v1/org-admin/bulkusercr', { _index: 119, title: {}, description: { 46: {} } }], + ['user/v1/org-admin/deactivateus', { _index: 133, title: {}, description: { 56: {} } }], [ 'user/v1/org-admin/getbulkinvitesfileslist', - { _index: 132, title: {}, description: { 49: {} } }, + { _index: 132, title: {}, description: { 55: {} } }, ], - ['user/v1/org-admin/getrequest', { _index: 121, title: {}, description: { 45: {} } }], - ['user/v1/org-admin/getrequestdetail', { _index: 124, title: {}, description: { 47: {} } }], + ['user/v1/org-admin/getrequest', { _index: 126, title: {}, description: { 52: {} } }], + ['user/v1/org-admin/getrequestdetail', { _index: 129, title: {}, description: { 54: {} } }], + ['user/v1/org-admin/inheritentitytyp', { _index: 135, title: {}, description: { 57: {} } }], [ 'user/v1/org-admin/updaterequeststatu', - { _index: 123, title: {}, description: { 46: {} } }, - ], - ['user/v1/organization/cr', { _index: 84, title: {}, description: { 27: {} } }], - [ - 'user/v1/organization/getorgrolerequest', - { _index: 96, title: {}, description: { 31: {} } }, + { _index: 128, title: {}, description: { 53: {} } }, ], - ['user/v1/organization/list', { _index: 87, title: {}, description: { 29: {} } }], + ['user/v1/organization/cr', { _index: 101, title: {}, description: { 36: {} } }], + ['user/v1/organization/list', { _index: 103, title: {}, description: { 38: {} } }], + ['user/v1/organization/requestorgrol', { _index: 108, title: {}, description: { 39: {} } }], + ['user/v1/organization/upd', { _index: 102, title: {}, description: { 37: {} } }], + ['user/v1/user/read/{userid', { _index: 64, title: {}, description: { 17: {} } }], + ['user/v1/user/share/{userid', { _index: 68, title: {}, description: { 19: {} } }], + ['user/v1/user/upd', { _index: 65, title: {}, description: { 18: {} } }], + ['user/v1/userrole/cr', { _index: 19, title: {}, description: { 2: {} } }], + ['user/v1/userrole/delete/{id', { _index: 27, title: {}, description: { 4: {} } }], + ['user/v1/userrole/list', { _index: 7, title: {}, description: { 1: {} } }], + ['user/v1/userrole/update/{id', { _index: 24, title: {}, description: { 3: {} } }], [ - 'user/v1/organization/list?page={page}&limit={limit}&search={search', - { _index: 88, title: {}, description: { 29: {} } }, + 'valid', + { + _index: 38, + title: {}, + description: { + 8: {}, + 9: {}, + 10: {}, + 11: {}, + 12: {}, + 14: {}, + 16: {}, + 17: {}, + 18: {}, + 19: {}, + 21: {}, + 22: {}, + 23: {}, + 25: {}, + 26: {}, + 29: {}, + 30: {}, + 31: {}, + 32: {}, + 33: {}, + 34: {}, + 36: {}, + 38: {}, + 39: {}, + }, + }, ], - ['user/v1/organization/requestorgrol', { _index: 94, title: {}, description: { 30: {} } }], - ['user/v1/organization/upd', { _index: 85, title: {}, description: { 28: {} } }], - ['user/v1/organization/update/{id', { _index: 86, title: {}, description: { 28: {} } }], - ['user/v1/systemusers/login', { _index: 72, title: {}, description: { 23: {} } }], - ['user/v1/user/read', { _index: 47, title: {}, description: { 11: {} } }], - ['user/v1/user/read/{userid', { _index: 48, title: {}, description: { 11: {} } }], - ['user/v1/user/shar', { _index: 52, title: {}, description: { 13: {} } }], - ['user/v1/user/share/{userid', { _index: 53, title: {}, description: { 13: {} } }], - ['user/v1/user/upd', { _index: 50, title: {}, description: { 12: {} } }], - ['user/v1/userrole/list', { _index: 98, title: {}, description: { 33: {} } }], - ['userrol', { _index: 97, title: { 32: {}, 33: {} }, description: {} }], [ 'valu', { @@ -85678,39 +92028,61 @@

    Response samples

    2: {}, 3: {}, 4: {}, - 5: {}, 6: {}, + 7: {}, + 8: {}, + 9: {}, 10: {}, 11: {}, 12: {}, - 13: {}, - 15: {}, 16: {}, + 17: {}, 18: {}, 19: {}, - 20: {}, + 21: {}, 22: {}, 23: {}, - 24: {}, 25: {}, + 26: {}, 27: {}, - 28: {}, 29: {}, + 30: {}, + 31: {}, + 32: {}, 33: {}, - 35: {}, + 34: {}, 36: {}, 37: {}, 38: {}, - 40: {}, + 39: {}, 41: {}, 42: {}, 43: {}, + 44: {}, + 45: {}, + 46: {}, + 48: {}, + 49: {}, + 50: {}, + 52: {}, + 53: {}, + 54: {}, + 55: {}, + 56: {}, + 57: {}, + 59: {}, }, }, ], - ['verifi', { _index: 38, title: {}, description: { 8: {} } }], - ['within', { _index: 93, title: {}, description: { 30: {} } }], - ['x-auth-token', { _index: 35, title: {}, description: { 8: {} } }], + ['within', { _index: 107, title: {}, description: { 39: {} } }], + [ + 'x-auth-token', + { + _index: 14, + title: {}, + description: { 1: {}, 3: {}, 14: {}, 41: {}, 42: {}, 44: {} }, + }, + ], ], pipeline: [], }, From 6e1bc21f4424ea8c362adf52c3824a49df9b66a7 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Fri, 22 Dec 2023 17:30:33 +0530 Subject: [PATCH 021/109] userRole changes for organization_id --- .../MentorED-Users.postman_collection.json | 10 +- src/api-doc/api-doc.yaml | 8 -- src/controllers/v1/userRole.js | 58 ++++---- src/database/queries/userRole.js | 34 ++++- src/services/userRole.js | 126 ++++++++++-------- src/validators/v1/userRole.js | 12 -- 6 files changed, 133 insertions(+), 115 deletions(-) diff --git a/src/api-doc/MentorED-Users.postman_collection.json b/src/api-doc/MentorED-Users.postman_collection.json index 40a107761..438a99e56 100644 --- a/src/api-doc/MentorED-Users.postman_collection.json +++ b/src/api-doc/MentorED-Users.postman_collection.json @@ -753,7 +753,7 @@ ], "body": { "mode": "raw", - "raw": "{\n \"email\": \"nevil@tunerlabs.com\",\n \"organization_id\": 1\n}", + "raw": "{\n \"email\": \"suman@cc.com\",\n \"organization_id\": 1\n}", "options": { "raw": { "language": "json" @@ -1682,7 +1682,7 @@ ], "body": { "mode": "raw", - "raw": "{ \n\"title\":\"system_admin\", \n\"user_type\": 1, \n\"status\":\"ACTIVE\", \n\"visibility\":\"PUBLIC\", \n\"organization_id\": 1\n} ", + "raw": "{ \n\"title\":\"system_admins\", \n\"user_type\": 1, \n\"status\":\"ACTIVE\", \n\"visibility\":\"PUBLIC\"\n} ", "options": { "raw": { "language": "json" @@ -1710,7 +1710,7 @@ ], "body": { "mode": "raw", - "raw": "{ \n\"title\":\"system_adminn\", \n\"user_type\": 1, \n\"status\":\"ACTIVE\", \n\"visibility\":\"PUBLIC\", \n\"organization_id\": 3\n} ", + "raw": "{ \n\"title\":\"system_adminstrations\", \n\"user_type\": 1, \n\"status\":\"ACTIVE\", \n\"visibility\":\"PUBLIC\"\n} ", "options": { "raw": { "language": "json" @@ -1724,7 +1724,7 @@ "variable": [ { "key": "id", - "value": "7" + "value": "9" } ] } @@ -1749,7 +1749,7 @@ "variable": [ { "key": "id", - "value": "7" + "value": "9" } ] } diff --git a/src/api-doc/api-doc.yaml b/src/api-doc/api-doc.yaml index 5688ee7a5..f212273a3 100644 --- a/src/api-doc/api-doc.yaml +++ b/src/api-doc/api-doc.yaml @@ -2429,14 +2429,11 @@ paths: type: string visibility: type: string - organization_id: - type: number required: - user_type - status - title - visibility - - organization_id examples: example1: value: @@ -2444,7 +2441,6 @@ paths: user_type: 1 status: ACTIVE visibility: PUBLIC - organization_id: 1 responses: '201': description: OK @@ -2521,14 +2517,11 @@ paths: type: string visibility: type: string - organization_id: - type: number required: - title - user_type - status - visibility - - organization_id examples: example1: value: @@ -2536,7 +2529,6 @@ paths: user_type: 1 status: ACTIVE visibility: PUBLIC - organization_id: 3 responses: '201': description: OK. Roles updated successfully diff --git a/src/controllers/v1/userRole.js b/src/controllers/v1/userRole.js index 00678cf21..4e6a37274 100644 --- a/src/controllers/v1/userRole.js +++ b/src/controllers/v1/userRole.js @@ -10,22 +10,22 @@ const roleService = require('@services/userRole') module.exports = class userRole { /** - * create roles + * Create roles. * @method * @name create - * @param {Object} req -request data. - * @param {Object} req.body -request body contains role creation deatils. - * @param {String} req.body.title - title of the role. - * @param {Integer} req.body.userType - userType role . - * @param {String} req.body.status - role status. - * @param {String} req.body.visibility - visibility of the role. - * @param {Integer} req.body.organization_id - organization for role. - * @returns {JSON} - response contains role creation details. + * @param {Object} req - Request data. + * @param {Object} req.body - Request body contains role creation details. + * @param {String} req.body.title - Title of the role. + * @param {Integer} req.body.userType - User type of the role. + * @param {String} req.body.status - Role status. + * @param {String} req.body.visibility - Visibility of the role. + * @param {Integer} req.body.organization_id - Organization ID for the role. + * @returns {JSON} - Response contains role creation details. */ async create(req) { try { - const createRole = await roleService.create(req.body) + const createRole = await roleService.create(req.body, req.decodedToken.organization_id) return createRole } catch (error) { return error @@ -33,22 +33,22 @@ module.exports = class userRole { } /** - * update roles + * Update roles. * @method * @name update - * @param {Object} req -request data. - * @param {Object} req.body -request body contains role updation details. - * @param {String} req.body.title - title of the role. - * @param {Integer} req.body.userType - userType role . - * @param {String} req.body.status - role status. - * @param {String} req.body.visibility - visibility of the role. - * @param {Integer} req.body.organization_id - organization for role. - * @returns {JSON} - response contains role updation details. + * @param {Object} req - Request data. + * @param {Object} req.body - Request body contains role update details. + * @param {String} req.body.title - Title of the role. + * @param {Integer} req.body.userType - User type of the role. + * @param {String} req.body.status - Role status. + * @param {String} req.body.visibility - Visibility of the role. + * @param {Integer} req.body.organization_id - Organization ID for the role. + * @returns {JSON} - Response contains role update details. */ async update(req) { try { - const updateRole = await roleService.update(req.params.id, req.body) + const updateRole = await roleService.update(req.params.id, req.body, req.decodedToken.organization_id) return updateRole } catch (error) { return error @@ -56,31 +56,21 @@ module.exports = class userRole { } /** - * deletes role + * Delete role. * @method * @name delete - * @param {Object} req - request data. - * @returns {JSON} - role deletion response. + * @param {Object} req - Request data. + * @returns {JSON} - Role deletion response. */ async delete(req) { try { - return await roleService.delete(req.params.id) + return await roleService.delete(req.params.id, req.decodedToken.organization_id) } catch (error) { return error } } - /** - * Get all available roles - * @method - * @name list - * @param {String} req.pageNo - Page No. - * @param {String} req.pageSize - Page size limit. - * @param {String} req.searchText - Search text. - * @returns {JSON} - role List. - */ - async list(req) { try { const roleList = await roleService.list(req.body.filters, req.pageNo, req.pageSize, req.searchText) diff --git a/src/database/queries/userRole.js b/src/database/queries/userRole.js index cea7400ee..2deccb7e5 100644 --- a/src/database/queries/userRole.js +++ b/src/database/queries/userRole.js @@ -3,7 +3,39 @@ const UserRole = require('@database/models/index').UserRole const { Op } = require('sequelize') -exports.create = async (data) => { +exports.findOne = async (filter, options = {}) => { + try { + return await UserRole.findOne({ + where: filter, + ...options, + raw: true, + }) + } catch (error) { + return error + } +} + +exports.findByPk = async (id) => { + try { + return await UserRole.findByPk(id, { raw: true }) + } catch (error) { + return error + } +} + +exports.findAll = async (filter, options = {}) => { + try { + return await UserRole.findAll({ + where: filter, + ...options, + raw: true, + }) + } catch (error) { + return error + } +} + +exports.create = async (data, user_organization_id) => { try { return await UserRole.create(data, { returning: true }) } catch (error) { diff --git a/src/services/userRole.js b/src/services/userRole.js index 99613b0b6..2b8368b94 100644 --- a/src/services/userRole.js +++ b/src/services/userRole.js @@ -14,20 +14,21 @@ const { Op } = require('sequelize') module.exports = class userRoleHelper { /** - * create role + * Create roles. * @method * @name create - * @param {Object} req -request data. - * @param {Object} req.body -request body contains role creation deatils. - * @param {String} req.body.title - title of the role. - * @param {Integer} req.body.userType - userType role . - * @param {String} req.body.status - role status. - * @param {String} req.body.visibility - visibility of the role. - * @param {Integer} req.body.organization_id - organization for role. - * @returns {JSON} - response contains role creation details. + * @param {Object} req - Request data. + * @param {Object} req.body - Request body contains role creation details. + * @param {String} req.body.title - Title of the role. + * @param {Integer} req.body.userType - User type of the role. + * @param {String} req.body.status - Role status. + * @param {String} req.body.visibility - Visibility of the role. + * @param {Integer} req.body.organization_id - Organization ID for the role. + * @returns {JSON} - Response contains role creation details. */ - static async create(bodyData) { + static async create(bodyData, user_organization_id) { try { + bodyData.organization_id = user_organization_id const roles = await roleQueries.create(bodyData) return common.successResponse({ statusCode: httpStatusCode.created, @@ -46,44 +47,50 @@ module.exports = class userRoleHelper { } /** - * update role + * Update roles. * @method * @name update - * @param {Object} req -request data. - * @param {Object} req.body -request body contains role updation details. - * @param {String} req.body.title - title of the role. - * @param {Integer} req.body.userType - userType role . - * @param {String} req.body.status - role status. - * @param {String} req.body.visibility - visibility of the role. - * @param {Integer} req.body.organization_id - organization for role. - * @returns {JSON} - response contains role updation details. + * @param {Object} req - Request data. + * @param {Object} req.body - Request body contains role update details. + * @param {String} req.body.title - Title of the role. + * @param {Integer} req.body.userType - User type of the role. + * @param {String} req.body.status - Role status. + * @param {String} req.body.visibility - Visibility of the role. + * @param {Integer} req.body.organization_id - Organization ID for the role. + * @returns {JSON} - Response contains role update details. */ - static async update(id, bodyData) { + static async update(id, bodyData, user_organization_id) { try { const roles = await roleQueries.findRoleById(id) if (!roles) { throw new Error('ROLE_NOT_FOUND') } - - const updateRole = await roleQueries.updateRoleById(id, bodyData) - if (!updateRole) { - return common.failureResponse({ - message: 'ROLE_NOT_UPDATED', - statusCode: httpStatusCode.bad_request, - responseCode: 'CLIENT_ERROR', + if (roles.organization_id === user_organization_id) { + const updateRole = await roleQueries.updateRoleById(id, bodyData) + if (!updateRole) { + return common.failureResponse({ + message: 'ROLE_NOT_UPDATED', + statusCode: httpStatusCode.bad_request, + responseCode: 'CLIENT_ERROR', + }) + } + return common.successResponse({ + statusCode: httpStatusCode.created, + message: 'ROLE_UPDATED_SUCCESSFULLY', + result: { + title: updateRole.title, + user_type: updateRole.user_type, + status: updateRole.status, + visibility: updateRole.visibility, + organization_id: updateRole.organization_id, + }, }) } - return common.successResponse({ - statusCode: httpStatusCode.created, - message: 'ROLE_UPDATED_SUCCESSFULLY', - result: { - title: updateRole.title, - user_type: updateRole.user_type, - status: updateRole.status, - visibility: updateRole.visibility, - organization_id: updateRole.organization_id, - }, + return common.failureResponse({ + message: 'USER_ORG_ID_DOES_NOT_MATCH', + statusCode: httpStatusCode.bad_request, + responseCode: 'CLIENT_ERROR', }) } catch (error) { throw error @@ -91,16 +98,16 @@ module.exports = class userRoleHelper { } /** - * delete role + * Delete role. * @method * @name delete - * @param {Object} req - request data. - * @returns {JSON} - role deletion response. + * @param {Object} req - Request data. + * @returns {JSON} - Role deletion response. */ - static async delete(id) { + static async delete(id, user_organization_id) { try { const roles = await roleQueries.findRoleById(id) - + console.log('roles=>', roles) if (!roles) { return common.failureResponse({ message: 'ROLE_ALREADY_DELETED_OR_ROLE_NOT_PRESENT', @@ -108,19 +115,26 @@ module.exports = class userRoleHelper { responseCode: 'CLIENT_ERROR', }) } else { - const deleteRole = await roleQueries.deleteRoleById(id) + if (roles.organization_id === user_organization_id) { + const deleteRole = await roleQueries.deleteRoleById(id) - if (!deleteRole) { - return common.failureResponse({ - message: 'ROLE_NOT_DELETED', - statusCode: httpStatusCode.bad_request, - responseCode: 'CLIENT_ERROR', + if (!deleteRole) { + return common.failureResponse({ + message: 'ROLE_NOT_DELETED', + statusCode: httpStatusCode.bad_request, + responseCode: 'CLIENT_ERROR', + }) + } + return common.successResponse({ + statusCode: httpStatusCode.accepted, + message: 'ROLE_DELETED_SUCCESSFULLY', + result: {}, }) } - return common.successResponse({ - statusCode: httpStatusCode.accepted, - message: 'ROLE_DELETED_SUCCESSFULLY', - result: {}, + return common.failureResponse({ + message: 'USER_ORG_ID_DOES_NOT_MATCH', + statusCode: httpStatusCode.bad_request, + responseCode: 'CLIENT_ERROR', }) } } catch (error) { @@ -129,14 +143,16 @@ module.exports = class userRoleHelper { } /** - * Get all available roles + * Get all available roles. * @method * @name list - * @param {String} req.pageNo - Page No. + * @param {Array(String)} req.body.filters - Filters. + * @param {String} req.pageNo - Page number. * @param {String} req.pageSize - Page size limit. * @param {String} req.searchText - Search text. - * @returns {JSON} - role List. + * @returns {JSON} - Role list. */ + static async list(filters, page, limit, search) { try { const offset = common.getPaginationOffset(page, limit) diff --git a/src/validators/v1/userRole.js b/src/validators/v1/userRole.js index 616b758b9..71e955f16 100644 --- a/src/validators/v1/userRole.js +++ b/src/validators/v1/userRole.js @@ -30,12 +30,6 @@ module.exports = { .matches(/^[A-Z_]+$/) .withMessage('visibility is invalid, must not contain spaces') - req.checkBody('organization_id') - .notEmpty() - .withMessage('organization_id field is empty') - .matches(/^[0-9]+$/) - .withMessage('organization_id should be number') - req.checkBody('status') .trim() .matches(/^[A-Za-z]*$/) @@ -69,12 +63,6 @@ module.exports = { .matches(/^[A-Z_]+$/) .withMessage('visibility is invalid, must not contain spaces') - req.checkBody('organization_id') - .notEmpty() - .withMessage('organization_id field is empty') - .matches(/^[0-9]+$/) - .withMessage('organization_id should be number') - req.checkBody('status') .trim() .matches(/^[A-Za-z]*$/) From 92d0bdecb46f058d5a05ea84fb64871fe38c2a3b Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Tue, 26 Dec 2023 14:23:32 +0530 Subject: [PATCH 022/109] Comment changes 26/12 --- src/database/models/userRole.js | 5 -- src/database/queries/userRole.js | 17 ++-- .../20231221080334-add_system_manager_role.js | 25 +++--- src/services/userRole.js | 79 +++++++------------ 4 files changed, 48 insertions(+), 78 deletions(-) diff --git a/src/database/models/userRole.js b/src/database/models/userRole.js index 3d60fdfe5..2d58f23fc 100644 --- a/src/database/models/userRole.js +++ b/src/database/models/userRole.js @@ -32,11 +32,6 @@ module.exports = (sequelize, DataTypes) => { type: DataTypes.STRING, defaultValue: 'PUBLIC', }, - organization_id: { - type: DataTypes.INTEGER, - defaultValue: defaultOrgId, - allowNull: false, - }, }, { sequelize, modelName: 'UserRole', tableName: 'user_roles', freezeTableName: true, paranoid: true } ) diff --git a/src/database/queries/userRole.js b/src/database/queries/userRole.js index 2deccb7e5..30001ce99 100644 --- a/src/database/queries/userRole.js +++ b/src/database/queries/userRole.js @@ -53,36 +53,33 @@ exports.findRoleById = async (id) => { exports.findAllRoles = async (filter, attributes, options) => { try { - const roles = await UserRole.findAndCountAll({ + return await UserRole.findAndCountAll({ where: filter, attributes, ...options, }) - return roles } catch (error) { throw error } } -exports.updateRoleById = async (id, updatedata) => { +exports.updateRole = async (filter, updatedata) => { try { - const [rowsUpdated, [updatedRoles]] = await UserRole.update(updatedata, { - where: { id }, + return await UserRole.update(updatedata, { + where: filter, returning: true, }) - return updatedRoles } catch (error) { throw error } } -exports.deleteRoleById = async (id) => { +exports.deleteRole = async (filter) => { try { - const deletedRows = await UserRole.destroy({ - where: { id: id }, + return await UserRole.destroy({ + where: filter, individualHooks: true, }) - return deletedRows } catch (error) { throw error } diff --git a/src/database/seeders/20231221080334-add_system_manager_role.js b/src/database/seeders/20231221080334-add_system_manager_role.js index d981640e9..515a10b55 100644 --- a/src/database/seeders/20231221080334-add_system_manager_role.js +++ b/src/database/seeders/20231221080334-add_system_manager_role.js @@ -3,19 +3,22 @@ /** @type {import('sequelize-cli').Migration} */ module.exports = { async up(queryInterface, Sequelize) { - let roleData = [] const defaultOrgId = queryInterface.sequelize.options.defaultOrgId - let eachRow = { - title: 'system_manager', - user_type: 1, - visibility: 'PUBLIC', - organization_id: defaultOrgId, - updated_at: new Date(), - created_at: new Date(), - } - roleData.push(eachRow) - await queryInterface.bulkInsert('user_roles', roleData, {}) + await queryInterface.bulkInsert( + 'user_roles', + [ + { + title: 'system_manager', + user_type: 1, + visibility: 'PUBLIC', + organization_id: defaultOrgId, + updated_at: new Date(), + created_at: new Date(), + }, + ], + {} + ) }, async down(queryInterface, Sequelize) { diff --git a/src/services/userRole.js b/src/services/userRole.js index 2b8368b94..348c7d02e 100644 --- a/src/services/userRole.js +++ b/src/services/userRole.js @@ -62,35 +62,25 @@ module.exports = class userRoleHelper { static async update(id, bodyData, user_organization_id) { try { - const roles = await roleQueries.findRoleById(id) - if (!roles) { - throw new Error('ROLE_NOT_FOUND') - } - if (roles.organization_id === user_organization_id) { - const updateRole = await roleQueries.updateRoleById(id, bodyData) - if (!updateRole) { - return common.failureResponse({ - message: 'ROLE_NOT_UPDATED', - statusCode: httpStatusCode.bad_request, - responseCode: 'CLIENT_ERROR', - }) - } - return common.successResponse({ - statusCode: httpStatusCode.created, - message: 'ROLE_UPDATED_SUCCESSFULLY', - result: { - title: updateRole.title, - user_type: updateRole.user_type, - status: updateRole.status, - visibility: updateRole.visibility, - organization_id: updateRole.organization_id, - }, + const filter = { id: id, organization_id: user_organization_id } + const [updateCount, updateRole] = await roleQueries.updateRole(filter, bodyData) + if (updateCount < 0) { + return common.failureResponse({ + message: 'ROLE_NOT_UPDATED', + statusCode: httpStatusCode.bad_request, + responseCode: 'CLIENT_ERROR', }) } - return common.failureResponse({ - message: 'USER_ORG_ID_DOES_NOT_MATCH', - statusCode: httpStatusCode.bad_request, - responseCode: 'CLIENT_ERROR', + return common.successResponse({ + statusCode: httpStatusCode.created, + message: 'ROLE_UPDATED_SUCCESSFULLY', + result: { + title: updateRole.title, + user_type: updateRole.user_type, + status: updateRole.status, + visibility: updateRole.visibility, + organization_id: updateRole.organization_id, + }, }) } catch (error) { throw error @@ -106,37 +96,22 @@ module.exports = class userRoleHelper { */ static async delete(id, user_organization_id) { try { - const roles = await roleQueries.findRoleById(id) - console.log('roles=>', roles) - if (!roles) { - return common.failureResponse({ - message: 'ROLE_ALREADY_DELETED_OR_ROLE_NOT_PRESENT', - statusCode: httpStatusCode.bad_request, - responseCode: 'CLIENT_ERROR', - }) - } else { - if (roles.organization_id === user_organization_id) { - const deleteRole = await roleQueries.deleteRoleById(id) + const filter = { id: id, organization_id: user_organization_id } + const deleteRole = await roleQueries.deleteRole(filter) - if (!deleteRole) { - return common.failureResponse({ - message: 'ROLE_NOT_DELETED', - statusCode: httpStatusCode.bad_request, - responseCode: 'CLIENT_ERROR', - }) - } - return common.successResponse({ - statusCode: httpStatusCode.accepted, - message: 'ROLE_DELETED_SUCCESSFULLY', - result: {}, - }) - } + if (deleteRole === '0') { return common.failureResponse({ - message: 'USER_ORG_ID_DOES_NOT_MATCH', + message: 'ROLE_NOT_DELETED', statusCode: httpStatusCode.bad_request, responseCode: 'CLIENT_ERROR', }) } + + return common.successResponse({ + statusCode: httpStatusCode.accepted, + message: 'ROLE_DELETED_SUCCESSFULLY', + result: {}, + }) } catch (error) { throw error } From 96c02211b268fb67bfcf209a6393837290d098e5 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Tue, 26 Dec 2023 14:56:20 +0530 Subject: [PATCH 023/109] List changes 26/12 --- src/controllers/v1/userRole.js | 8 +++++++- src/services/userRole.js | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/controllers/v1/userRole.js b/src/controllers/v1/userRole.js index 4e6a37274..40ea868d2 100644 --- a/src/controllers/v1/userRole.js +++ b/src/controllers/v1/userRole.js @@ -73,7 +73,13 @@ module.exports = class userRole { async list(req) { try { - const roleList = await roleService.list(req.body.filters, req.pageNo, req.pageSize, req.searchText) + const roleList = await roleService.list( + req.body.filters, + req.pageNo, + req.pageSize, + req.searchText, + req.decodedToken.organization_id + ) return roleList } catch (error) { return error diff --git a/src/services/userRole.js b/src/services/userRole.js index 348c7d02e..f98e99dd8 100644 --- a/src/services/userRole.js +++ b/src/services/userRole.js @@ -128,7 +128,7 @@ module.exports = class userRoleHelper { * @returns {JSON} - Role list. */ - static async list(filters, page, limit, search) { + static async list(filters, page, limit, search, user_organization_id) { try { const offset = common.getPaginationOffset(page, limit) const options = { @@ -136,6 +136,7 @@ module.exports = class userRoleHelper { limit, } const filter = { + organization_id: user_organization_id, title: { [Op.iLike]: `%${search}%` }, ...filters, } From 5f36fd95c5600bbb05cc3c2102cef8d21601f729 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Tue, 26 Dec 2023 16:10:47 +0530 Subject: [PATCH 024/109] Comment changes 26/12 --- src/services/userRole.js | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/src/services/userRole.js b/src/services/userRole.js index f98e99dd8..44db1f228 100644 --- a/src/services/userRole.js +++ b/src/services/userRole.js @@ -26,9 +26,9 @@ module.exports = class userRoleHelper { * @param {Integer} req.body.organization_id - Organization ID for the role. * @returns {JSON} - Response contains role creation details. */ - static async create(bodyData, user_organization_id) { + static async create(bodyData, userOrganizationId) { try { - bodyData.organization_id = user_organization_id + bodyData.organization_id = userOrganizationId const roles = await roleQueries.create(bodyData) return common.successResponse({ statusCode: httpStatusCode.created, @@ -60,11 +60,11 @@ module.exports = class userRoleHelper { * @returns {JSON} - Response contains role update details. */ - static async update(id, bodyData, user_organization_id) { + static async update(id, bodyData, userOrganizationId) { try { - const filter = { id: id, organization_id: user_organization_id } + const filter = { id: id, organization_id: userOrganizationId } const [updateCount, updateRole] = await roleQueries.updateRole(filter, bodyData) - if (updateCount < 0) { + if (updateCount == 0) { return common.failureResponse({ message: 'ROLE_NOT_UPDATED', statusCode: httpStatusCode.bad_request, @@ -94,9 +94,9 @@ module.exports = class userRoleHelper { * @param {Object} req - Request data. * @returns {JSON} - Role deletion response. */ - static async delete(id, user_organization_id) { + static async delete(id, userOrganizationId) { try { - const filter = { id: id, organization_id: user_organization_id } + const filter = { id: id, organization_id: userOrganizationId } const deleteRole = await roleQueries.deleteRole(filter) if (deleteRole === '0') { @@ -128,7 +128,7 @@ module.exports = class userRoleHelper { * @returns {JSON} - Role list. */ - static async list(filters, page, limit, search, user_organization_id) { + static async list(filters, page, limit, search, userOrganizationId) { try { const offset = common.getPaginationOffset(page, limit) const options = { @@ -136,7 +136,7 @@ module.exports = class userRoleHelper { limit, } const filter = { - organization_id: user_organization_id, + organization_id: userOrganizationId, title: { [Op.iLike]: `%${search}%` }, ...filters, } @@ -149,18 +149,17 @@ module.exports = class userRoleHelper { statusCode: httpStatusCode.bad_request, responseCode: 'CLIENT_ERROR', }) - } else { - const results = { - data: roles.rows, - count: roles.count, - } - - return common.successResponse({ - statusCode: httpStatusCode.ok, - message: 'ROLES_FETCHED_SUCCESSFULLY', - result: results, - }) } + const results = { + data: roles.rows, + count: roles.count, + } + + return common.successResponse({ + statusCode: httpStatusCode.ok, + message: 'ROLES_FETCHED_SUCCESSFULLY', + result: results, + }) } catch (error) { throw error } From 5da4bdb5d47d89eeb04467b3b01912f06db2e286 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Tue, 26 Dec 2023 16:21:31 +0530 Subject: [PATCH 025/109] Comment changes 26/12 --- src/services/userRole.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/userRole.js b/src/services/userRole.js index 44db1f228..1be8afeab 100644 --- a/src/services/userRole.js +++ b/src/services/userRole.js @@ -136,7 +136,7 @@ module.exports = class userRoleHelper { limit, } const filter = { - organization_id: userOrganizationId, + [Op.or]: [{ organization_id: userOrganizationId }, { organization_id: defaultOrganizationId }], title: { [Op.iLike]: `%${search}%` }, ...filters, } From fa100dc0899619d80fcfd933ba3025d7b1e1f5fb Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Tue, 26 Dec 2023 16:30:38 +0530 Subject: [PATCH 026/109] Comment changes 26/12 --- src/services/userRole.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/services/userRole.js b/src/services/userRole.js index 1be8afeab..9fab2b2d2 100644 --- a/src/services/userRole.js +++ b/src/services/userRole.js @@ -11,6 +11,7 @@ const httpStatusCode = require('@generics/http-status') const roleQueries = require('@database/queries/userRole') const common = require('@constants/common') const { Op } = require('sequelize') +const organizationQueries = require('@database/queries/organization') module.exports = class userRoleHelper { /** @@ -135,8 +136,13 @@ module.exports = class userRoleHelper { offset, limit, } + let defaultOrg = await organizationQueries.findOne( + { code: process.env.DEFAULT_ORGANISATION_CODE }, + { attributes: ['id'] } + ) + let defaultOrgId = defaultOrg.id const filter = { - [Op.or]: [{ organization_id: userOrganizationId }, { organization_id: defaultOrganizationId }], + [Op.or]: [{ organization_id: userOrganizationId }, { organization_id: defaultOrgId }], title: { [Op.iLike]: `%${search}%` }, ...filters, } From 870a5c5519b0e1a7fcdb44783de61f65a6312049 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Tue, 26 Dec 2023 19:37:51 +0530 Subject: [PATCH 027/109] Comment changes 26/12 --- src/services/userRole.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/userRole.js b/src/services/userRole.js index 9fab2b2d2..6776bf7aa 100644 --- a/src/services/userRole.js +++ b/src/services/userRole.js @@ -100,7 +100,7 @@ module.exports = class userRoleHelper { const filter = { id: id, organization_id: userOrganizationId } const deleteRole = await roleQueries.deleteRole(filter) - if (deleteRole === '0') { + if (deleteRole === 0) { return common.failureResponse({ message: 'ROLE_NOT_DELETED', statusCode: httpStatusCode.bad_request, From 8f291df4899e8cbd49ae0bb37972ee20c332f046 Mon Sep 17 00:00:00 2001 From: Nevil Date: Thu, 28 Dec 2023 14:41:30 +0530 Subject: [PATCH 028/109] optimizes entity types queries --- src/controllers/v1/entity-type.js | 2 +- src/database/queries/entityType.js | 73 +++++++++++++++--------------- src/services/entityType.js | 20 +++++--- 3 files changed, 51 insertions(+), 44 deletions(-) diff --git a/src/controllers/v1/entity-type.js b/src/controllers/v1/entity-type.js index 4478a0aab..bc8d9d197 100644 --- a/src/controllers/v1/entity-type.js +++ b/src/controllers/v1/entity-type.js @@ -72,7 +72,7 @@ module.exports = class Entity { async delete(req) { try { - return await entityTypeService.delete(req.params.id) + return await entityTypeService.delete(req.params.id, req.decodedToken.organization_id) } catch (error) { return error } diff --git a/src/database/queries/entityType.js b/src/database/queries/entityType.js index b080e9054..3bca0f1b1 100644 --- a/src/database/queries/entityType.js +++ b/src/database/queries/entityType.js @@ -28,14 +28,7 @@ module.exports = class UserEntityData { try { const entityData = await EntityType.findAll({ where: { - [Op.or]: [ - { - created_by: 0, - }, - { - organization_id: orgId, - }, - ], + organization_id: orgId, ...filter, }, attributes, @@ -50,21 +43,24 @@ module.exports = class UserEntityData { try { const entityTypes = await EntityType.findAll({ where: filter, + raw: true, }) - const result = await Promise.all( - entityTypes.map(async (entityType) => { - const entities = await Entity.findAll({ - where: { entity_type_id: entityType.id }, - //attributes: { exclude: ['entity_type_id'] }, - }) + const entityTypeIds = entityTypes.map((entityType) => entityType.id) - return { - ...entityType.toJSON(), - entities: entities.map((entity) => entity.toJSON()), - } - }) - ) + const entities = await Entity.findAll({ + where: { entity_type_id: entityTypeIds, status: 'ACTIVE' }, + raw: true, + //attributes: { exclude: ['entity_type_id'] }, + }) + + const result = entityTypes.map((entityType) => { + const matchingEntities = entities.filter((entity) => entity.entity_type_id === entityType.id) + return { + ...entityType, + entities: matchingEntities, + } + }) return result } catch (error) { @@ -73,7 +69,7 @@ module.exports = class UserEntityData { } } - static async findUserEntityTypesAndEntitiesRaw(filter) { + /* static async findUserEntityTypesAndEntitiesRaw(filter) { try { const [result, metadata] = await Sequelize.query( `SELECT @@ -97,13 +93,14 @@ module.exports = class UserEntityData { console.error('Error fetching data:', error) throw error } - } + } */ - static async updateOneEntityType(id, update, options = {}) { + static async updateOneEntityType(id, organizationId, update, options = {}) { try { return await EntityType.update(update, { where: { id: id, + organization_id: organizationId, }, ...options, }) @@ -112,11 +109,12 @@ module.exports = class UserEntityData { } } - static async deleteOneEntityType(id) { + static async deleteOneEntityType(id, orgId) { try { return await EntityType.destroy({ where: { id: id, + organization_id: orgId, }, individualHooks: true, }) @@ -137,22 +135,25 @@ module.exports = class UserEntityData { try { const entityTypes = await EntityType.findAll({ where: filter, + raw: true, }) - const result = await Promise.all( - entityTypes.map(async (entityType) => { - const entities = await Entity.findAll({ - where: { entity_type_id: entityType.id, status: 'ACTIVE' }, - //attributes: { exclude: ['entity_type_id'] }, - }) + const entityTypeIds = entityTypes.map((entityType) => entityType.id) - return { - ...entityType.toJSON(), - entities: entities.map((entity) => entity.toJSON()), - } - }) - ) + // Fetch all matching entities using the IDs + const entities = await Entity.findAll({ + where: { entity_type_id: entityTypeIds, status: 'ACTIVE' }, + raw: true, + //attributes: { exclude: ['entity_type_id'] }, + }) + const result = entityTypes.map((entityType) => { + const matchingEntities = entities.filter((entity) => entity.entity_type_id === entityType.id) + return { + ...entityType, + entities: matchingEntities, + } + }) return result } catch (error) { return error diff --git a/src/services/entityType.js b/src/services/entityType.js index cb287ab96..b268c1c66 100644 --- a/src/services/entityType.js +++ b/src/services/entityType.js @@ -52,12 +52,12 @@ module.exports = class EntityHelper { static async update(bodyData, id, loggedInUserId, orgId) { ;(bodyData.updated_by = loggedInUserId), (bodyData.organization_id = orgId) try { - const [updateCount, updatedEntityType] = await entityTypeQueries.updateOneEntityType(id, bodyData, { + const [updateCount, updatedEntityType] = await entityTypeQueries.updateOneEntityType(id, orgId, bodyData, { returning: true, raw: true, }) - if (updateCount === '0') { + if (updateCount === 0) { return common.failureResponse({ message: 'ENTITY_TYPE_NOT_FOUND', statusCode: httpStatusCode.bad_request, @@ -82,11 +82,17 @@ module.exports = class EntityHelper { } } - static async readAllSystemEntityTypes(organization_id) { + static async readAllSystemEntityTypes(orgId) { try { + const defaultOrg = await organizationQueries.findOne( + { code: process.env.DEFAULT_ORGANISATION_CODE }, + { attributes: ['id'] } + ) + const defaultOrgId = defaultOrg.id + const attributes = ['value', 'label', 'id'] - const entities = await entityTypeQueries.findAllEntityTypes(organization_id, attributes) + const entities = await entityTypeQueries.findAllEntityTypes([orgId, defaultOrgId], attributes) if (!entities.length) { return common.failureResponse({ @@ -140,10 +146,10 @@ module.exports = class EntityHelper { * @returns {JSON} - Entity deleted response. */ - static async delete(id) { + static async delete(id, orgId) { try { - const deleteCount = await entityTypeQueries.deleteOneEntityType(id) - if (deleteCount === '0') { + const deleteCount = await entityTypeQueries.deleteOneEntityType(id, orgId) + if (deleteCount === 0) { return common.failureResponse({ message: 'ENTITY_TYPE_NOT_FOUND', statusCode: httpStatusCode.bad_request, From c1aef43a2595f25928f4b9d9756fb688de840306 Mon Sep 17 00:00:00 2001 From: Priyanka Pradeep Date: Thu, 28 Dec 2023 22:13:25 +0530 Subject: [PATCH 029/109] DC Query Optimization --- src/controllers/v1/account.js | 12 ++++++------ src/middlewares/authenticator.js | 1 + src/services/account.js | 13 ++++++++----- src/services/admin.js | 2 +- src/services/org-admin.js | 20 ++++++++++++++++---- src/services/organization.js | 1 + src/services/userInvite.js | 5 ++++- 7 files changed, 37 insertions(+), 17 deletions(-) diff --git a/src/controllers/v1/account.js b/src/controllers/v1/account.js index 227c6cc94..4ac0e2dc9 100644 --- a/src/controllers/v1/account.js +++ b/src/controllers/v1/account.js @@ -60,17 +60,18 @@ module.exports = class Account { * @name logout * @param {Object} req -request data. * @param {Object} req.decodedToken - it contains user token informations. - * @param {string} req.body.loggedInId - user id. * @param {string} req.body.refresh_token - refresh token. * @param {String} req.decodedToken.id - userId. * @returns {JSON} - accounts loggedout. */ async logout(req) { - const params = req.body - params.loggedInId = req.decodedToken.id try { - const loggedOutAccount = await accountService.logout(params) + const loggedOutAccount = await accountService.logout( + req.body, + req.decodedToken.id, + req.decodedToken.organization_id + ) return loggedOutAccount } catch (error) { return error @@ -87,9 +88,8 @@ module.exports = class Account { */ async generateToken(req) { - const params = req.body try { - const createdToken = await accountService.generateToken(params) + const createdToken = await accountService.generateToken(req.body) return createdToken } catch (error) { return error diff --git a/src/middlewares/authenticator.js b/src/middlewares/authenticator.js index f56d84685..7a4fd0928 100644 --- a/src/middlewares/authenticator.js +++ b/src/middlewares/authenticator.js @@ -127,6 +127,7 @@ module.exports = async function (req, res, next) { //update the token role as same as current user role decodedToken.data.roles = roles + decodedToken.data.organization_id = user.organization_id } req.decodedToken = decodedToken.data next() diff --git a/src/services/account.js b/src/services/account.js index 56d1df106..8e33d450f 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -89,12 +89,13 @@ module.exports = class AccountHelper { [Op.eq]: null, }, }, - { attributes: ['organization_user_invite_id'], raw: true } + { attributes: ['organization_user_invite_id', 'organization_id'], raw: true } ) if (invitedUserId) { invitedUserMatch = await userInviteQueries.findOne({ id: invitedUserId.organization_user_invite_id, + organization_id: invitedUserId.organization_id, }) //add org id here to optimize the query } @@ -457,14 +458,15 @@ module.exports = class AccountHelper { * @method * @name logout * @param {Object} req -request data. - * @param {string} bodyData.loggedInId - user id. + * @param {Integer} user_id - user id. + * @param {Integer} organization_id - organization id. * @param {string} bodyData.refresh_token - refresh token. * @returns {JSON} - returns accounts loggedout information. */ - static async logout(bodyData) { + static async logout(bodyData, user_id, organization_id) { try { - const user = await userQueries.findByPk(bodyData.loggedInId) + const user = await userQueries.findOne({ id: user_id, organization_id }) if (!user) { return common.failureResponse({ message: 'USER_NOT_FOUND', @@ -483,6 +485,7 @@ module.exports = class AccountHelper { { id: user.id, organization_id: user.organization_id }, { refresh_tokens: refreshTokens } ) + /* If user doc not updated because of stored token does not matched with bodyData.refreshToken */ if (affectedRows == 0) { return common.failureResponse({ @@ -1046,7 +1049,7 @@ module.exports = class AccountHelper { let result = [] /* Required to resolve all promises first before preparing response object else sometime - it will push unresolved promise object if you put this logic in below for loop */ + it will push unresolved promise object if you put this logic in below for loop */ await Promise.all( users.data.map(async (user) => { diff --git a/src/services/admin.js b/src/services/admin.js index 2a8d681ab..198666ec6 100644 --- a/src/services/admin.js +++ b/src/services/admin.js @@ -41,7 +41,7 @@ module.exports = class AdminHelper { let updateParams = _generateUpdateParams(userId) const removeKeys = _.omit(user, _removeUserKeys()) const update = _.merge(removeKeys, updateParams) - await userQueries.updateUser({ email: user.email }, update) + await userQueries.updateUser({ id: user.id, organization_id: user.organization_id }, update) delete update.id await UserCredentialQueries.forceDeleteUserWithEmail(user.email) diff --git a/src/services/org-admin.js b/src/services/org-admin.js index bf34b3e93..1f3c78bd7 100644 --- a/src/services/org-admin.js +++ b/src/services/org-admin.js @@ -37,7 +37,10 @@ module.exports = class OrgAdminHelper { static async bulkUserCreate(filePath, tokenInformation) { try { const { id, organization_id } = tokenInformation - const { name, email } = await userQueries.findOne({ id }, { attributes: ['name', 'email'] }) + const { name, email } = await userQueries.findOne( + { id, organization_id }, + { attributes: ['name', 'email'] } + ) const organization = await organizationQueries.findOne({ id: organization_id }, { attributes: ['name'] }) @@ -242,7 +245,10 @@ module.exports = class OrgAdminHelper { }) } - const requestDetails = await orgRoleReqQueries.requestDetails({ id: requestId }) + const requestDetails = await orgRoleReqQueries.requestDetails({ + id: requestId, + organization_id: tokenInformation.organization_id, + }) const isApproved = bodyData.status === common.ACCEPTED_STATUS const isRejected = bodyData.status === common.REJECTED_STATUS @@ -250,7 +256,10 @@ module.exports = class OrgAdminHelper { const shouldSendEmail = isApproved || isRejected const message = isApproved ? 'ORG_ROLE_REQ_APPROVED' : 'ORG_ROLE_REQ_UPDATED' - const user = await userQueries.findByPk(requestDetails.requester_id) + const user = await userQueries.findOne({ + id: requestDetails.requester_id, + organization_id: tokenInformation.organization_id, + }) console.log(shouldSendEmail, 'shouldSendEmail') if (isApproved) { await updateRoleForApprovedRequest(requestDetails, user) @@ -430,7 +439,10 @@ function updateRoleForApprovedRequest(requestDetails, user) { const roles = _.uniq(rolesToUpdate) await userQueries.updateUser( - { id: requestDetails.requester_id }, + { + id: requestDetails.requester_id, + organization_id: user.organization_id, + }, { roles, } diff --git a/src/services/organization.js b/src/services/organization.js index a0d1a2d61..74d87fae0 100644 --- a/src/services/organization.js +++ b/src/services/organization.js @@ -295,6 +295,7 @@ module.exports = class OrganizationsHelper { { requester_id: tokenInformation.id, role: bodyData.role, + organization_id: tokenInformation.organization_id, }, { order: [['created_at', 'DESC']], diff --git a/src/services/userInvite.js b/src/services/userInvite.js index 957c039c2..84bcb2cc2 100644 --- a/src/services/userInvite.js +++ b/src/services/userInvite.js @@ -63,7 +63,10 @@ module.exports = class UserInviteHelper { } // //update output path in file uploads - const rowsAffected = await fileUploadQueries.update({ id: data.fileDetails.id }, update) + const rowsAffected = await fileUploadQueries.update( + { id: data.fileDetails.id, organization_id: data.user.organization_id }, + update + ) if (rowsAffected === 0) { throw new Error('FILE_UPLOAD_MODIFY_ERROR') } From 7be4687d4f525e6c0addb61aa0b8f42fe3968e76 Mon Sep 17 00:00:00 2001 From: Priyanka Pradeep Date: Thu, 28 Dec 2023 23:05:31 +0530 Subject: [PATCH 030/109] error fix for csv process --- src/database/queries/orgUserInvite.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/database/queries/orgUserInvite.js b/src/database/queries/orgUserInvite.js index 5c2e6d02d..ce812b53e 100644 --- a/src/database/queries/orgUserInvite.js +++ b/src/database/queries/orgUserInvite.js @@ -56,3 +56,15 @@ exports.deleteOne = async (id, options = {}) => { return error } } + +exports.findAll = async (filter, options = {}) => { + try { + return await organizationUserInvite.findAll({ + where: filter, + ...options, + raw: true, + }) + } catch (error) { + return error + } +} From 64cc239346b35ec8d2095652f5e0d503c5122c7a Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 2 Jan 2024 14:46:12 +0530 Subject: [PATCH 031/109] Added Email Encryption Utils & Generation Script --- src/scripts/generateEncyrptionKeys.js | 3 +++ src/utils/emailEncryption.js | 29 +++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 src/scripts/generateEncyrptionKeys.js create mode 100644 src/utils/emailEncryption.js diff --git a/src/scripts/generateEncyrptionKeys.js b/src/scripts/generateEncyrptionKeys.js new file mode 100644 index 000000000..88f53d886 --- /dev/null +++ b/src/scripts/generateEncyrptionKeys.js @@ -0,0 +1,3 @@ +const crypto = require('crypto') +console.log('Email Id Encryption Key: ', crypto.randomBytes(32).toString('hex')) +console.log('Email Id Encryption IV:', crypto.randomBytes(16).toString('hex')) diff --git a/src/utils/emailEncryption.js b/src/utils/emailEncryption.js new file mode 100644 index 000000000..f8572ad43 --- /dev/null +++ b/src/utils/emailEncryption.js @@ -0,0 +1,29 @@ +'use strict' +const crypto = require('crypto') + +const secretKey = Buffer.from(process.env.EMAIL_ID_ENCRYPTION_KEY, 'hex') +const fixedIV = Buffer.from(process.env.EMAIL_ID_ENCRYPTION_IV, 'hex') +const algorithm = process.env.EMAIL_ID_ENCRYPTION_ALGORITHM + +const encrypt = (plainTextEmail) => { + try { + const cipher = crypto.createCipheriv(algorithm, secretKey, fixedIV) + return cipher.update(plainTextEmail, 'utf-8', 'hex') + cipher.final('hex') + } catch (err) { + console.log(err) + throw err + } +} + +const decrypt = (encryptedEmail) => { + try { + const decipher = crypto.createDecipheriv(algorithm, secretKey, 'hex', fixedIV) + return decipher.update(encryptedEmail, 'hex', 'utf-8') + decipher.final('utf-8') + } catch (err) { + console.log(err) + throw err + } +} +const emailEncryption = { encrypt, decrypt } + +module.exports = emailEncryption From 7ff54fc372614453ae585ac6577a28aafee9909b Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 2 Jan 2024 15:01:06 +0530 Subject: [PATCH 032/109] Added Env Validators --- src/envVariables.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/envVariables.js b/src/envVariables.js index 97f54fbfa..fbcc51fac 100644 --- a/src/envVariables.js +++ b/src/envVariables.js @@ -239,6 +239,19 @@ let enviromentVariables = { optional: false, default: 540000, }, + EMAIL_ID_ENCRYPTION_KEY: { + message: 'Required Email ID Encryption Key', + optional: false, + }, + EMAIL_ID_ENCRYPTION_IV: { + message: 'Required Email ID Encryption IV', + optional: false, + }, + EMAIL_ID_ENCRYPTION_ALGORITHM: { + message: 'Required Email ID Encryption Algorithm', + optional: false, + default: 'aes-256-cbc', + }, } let success = true From 83623c575f8a250fdf9bf3f73c6397f349b26438 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 2 Jan 2024 15:12:54 +0530 Subject: [PATCH 033/109] Modified Registration OTP To Use Encrypted Email Ids --- src/services/account.js | 122 +++++++++++++++++++--------------------- 1 file changed, 58 insertions(+), 64 deletions(-) diff --git a/src/services/account.js b/src/services/account.js index 8e33d450f..aba0e9be0 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -27,6 +27,7 @@ const utils = require('@generics/utils') const { Op } = require('sequelize') const { removeDefaultOrgEntityTypes } = require('@generics/utils') const UserCredentialQueries = require('@database/queries/userCredential') +const emailEncryption = require('@utils/emailEncryption') module.exports = class AccountHelper { /** * create account @@ -684,79 +685,72 @@ module.exports = class AccountHelper { */ static async registrationOtp(bodyData) { - try { - let otp - let isValidOtpExist = true - const userCredentials = await UserCredentialQueries.findOne({ - email: bodyData.email.toLowerCase(), - password: { - [Op.ne]: null, - }, + let otp + let isValidOtpExist = true + const plaintextEmailId = bodyData.email.toLowerCase() + const encryptedEmailId = emailEncryption.encrypt(plaintextEmailId) + const userCredentials = await UserCredentialQueries.findOne({ + email: encryptedEmailId, + password: { + [Op.ne]: null, + }, + }) + if (userCredentials) { + return common.failureResponse({ + message: 'USER_ALREADY_EXISTS', + statusCode: httpStatusCode.bad_request, + responseCode: 'CLIENT_ERROR', }) - if (userCredentials) { - return common.failureResponse({ - message: 'USER_ALREADY_EXISTS', - statusCode: httpStatusCode.bad_request, - responseCode: 'CLIENT_ERROR', - }) - } + } - const userData = await utilsHelper.redisGet(bodyData.email.toLowerCase()) + const userData = await utilsHelper.redisGet(encryptedEmailId) + if (userData && userData.action === 'signup') { + otp = userData.otp // If valid then get previuosly generated otp + } else { + isValidOtpExist = false + } - if (userData && userData.action === 'signup') { - otp = userData.otp // If valid then get previuosly generated otp - } else { - isValidOtpExist = false + if (!isValidOtpExist) { + otp = Math.floor(Math.random() * 900000 + 100000) // 6 digit otp + const redisData = { + verify: encryptedEmailId, + action: 'signup', + otp, } - - if (!isValidOtpExist) { - otp = Math.floor(Math.random() * 900000 + 100000) // 6 digit otp - const redisData = { - verify: bodyData.email.toLowerCase(), - action: 'signup', - otp, - } - const res = await utilsHelper.redisSet( - bodyData.email.toLowerCase(), - redisData, - common.otpExpirationTime - ) - if (res !== 'OK') { - return common.failureResponse({ - message: 'UNABLE_TO_SEND_OTP', - statusCode: httpStatusCode.internal_server_error, - responseCode: 'SERVER_ERROR', - }) - } + const res = await utilsHelper.redisSet(encryptedEmailId, redisData, common.otpExpirationTime) + if (res !== 'OK') { + return common.failureResponse({ + message: 'UNABLE_TO_SEND_OTP', + statusCode: httpStatusCode.internal_server_error, + responseCode: 'SERVER_ERROR', + }) } + } - const templateData = await notificationTemplateQueries.findOneEmailTemplate( - process.env.REGISTRATION_OTP_EMAIL_TEMPLATE_CODE - ) - - if (templateData) { - // Push otp to kafka - const payload = { - type: common.notificationEmailType, - email: { - to: bodyData.email, - subject: templateData.subject, - body: utilsHelper.composeEmailBody(templateData.body, { name: bodyData.name, otp }), - }, - } + const templateData = await notificationTemplateQueries.findOneEmailTemplate( + process.env.REGISTRATION_OTP_EMAIL_TEMPLATE_CODE + ) - await kafkaCommunication.pushEmailToKafka(payload) - } - if (process.env.APPLICATION_ENV === 'development') { - console.log(otp) + if (templateData) { + // Push otp to kafka + const payload = { + type: common.notificationEmailType, + email: { + to: plaintextEmailId, + subject: templateData.subject, + body: utilsHelper.composeEmailBody(templateData.body, { name: bodyData.name, otp }), + }, } - return common.successResponse({ - statusCode: httpStatusCode.ok, - message: 'REGISTRATION_OTP_SENT_SUCCESSFULLY', - }) - } catch (error) { - throw error + + await kafkaCommunication.pushEmailToKafka(payload) } + if (process.env.APPLICATION_ENV === 'development') { + console.log(otp) + } + return common.successResponse({ + statusCode: httpStatusCode.ok, + message: 'REGISTRATION_OTP_SENT_SUCCESSFULLY', + }) } /** From 51cd6047df5bf5eb873c61bb4543b146c7c479ac Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 2 Jan 2024 15:43:04 +0530 Subject: [PATCH 034/109] Refactored RegistrationOtp API --- src/services/account.js | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/src/services/account.js b/src/services/account.js index aba0e9be0..982a4e369 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -685,8 +685,6 @@ module.exports = class AccountHelper { */ static async registrationOtp(bodyData) { - let otp - let isValidOtpExist = true const plaintextEmailId = bodyData.email.toLowerCase() const encryptedEmailId = emailEncryption.encrypt(plaintextEmailId) const userCredentials = await UserCredentialQueries.findOne({ @@ -695,23 +693,19 @@ module.exports = class AccountHelper { [Op.ne]: null, }, }) - if (userCredentials) { + if (userCredentials) return common.failureResponse({ message: 'USER_ALREADY_EXISTS', statusCode: httpStatusCode.bad_request, responseCode: 'CLIENT_ERROR', }) - } const userData = await utilsHelper.redisGet(encryptedEmailId) - if (userData && userData.action === 'signup') { - otp = userData.otp // If valid then get previuosly generated otp - } else { - isValidOtpExist = false - } - - if (!isValidOtpExist) { - otp = Math.floor(Math.random() * 900000 + 100000) // 6 digit otp + const [otp, isNew] = + userData && userData.action === 'signup' + ? [userData.otp, false] + : [Math.floor(Math.random() * 900000 + 100000), true] + if (isNew) { const redisData = { verify: encryptedEmailId, action: 'signup', @@ -726,13 +720,10 @@ module.exports = class AccountHelper { }) } } - const templateData = await notificationTemplateQueries.findOneEmailTemplate( process.env.REGISTRATION_OTP_EMAIL_TEMPLATE_CODE ) - if (templateData) { - // Push otp to kafka const payload = { type: common.notificationEmailType, email: { @@ -741,12 +732,9 @@ module.exports = class AccountHelper { body: utilsHelper.composeEmailBody(templateData.body, { name: bodyData.name, otp }), }, } - await kafkaCommunication.pushEmailToKafka(payload) } - if (process.env.APPLICATION_ENV === 'development') { - console.log(otp) - } + if (process.env.APPLICATION_ENV === 'development') console.log(otp) return common.successResponse({ statusCode: httpStatusCode.ok, message: 'REGISTRATION_OTP_SENT_SUCCESSFULLY', From ba8f8b8ff6da3b4d9935328dcdaf850c045e3fa5 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 2 Jan 2024 16:12:22 +0530 Subject: [PATCH 035/109] Modified Account Create API To Use Encrypted Email --- src/services/account.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/services/account.js b/src/services/account.js index 982a4e369..07c110214 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -46,9 +46,11 @@ module.exports = class AccountHelper { const projection = ['password', 'refresh_tokens'] try { - const email = bodyData.email.toLowerCase() + const plaintextEmailId = bodyData.email.toLowerCase() + const encryptedEmailId = emailEncryption.encrypt(plaintextEmailId) + console.log({ plaintextEmailId, encryptedEmailId }) let user = await UserCredentialQueries.findOne({ - email: email.toLowerCase(), + email: encryptedEmailId, password: { [Op.ne]: null, }, @@ -62,7 +64,7 @@ module.exports = class AccountHelper { } if (process.env.ENABLE_EMAIL_OTP_VERIFICATION === 'true') { - const redisData = await utilsHelper.redisGet(email) + const redisData = await utilsHelper.redisGet(encryptedEmailId) if (!redisData || redisData.otp != bodyData.otp) { return common.failureResponse({ message: 'OTP_INVALID', @@ -82,7 +84,7 @@ module.exports = class AccountHelper { const invitedUserId = await UserCredentialQueries.findOne( { - email: email, + email: encryptedEmailId, organization_user_invite_id: { [Op.ne]: null, }, @@ -138,7 +140,7 @@ module.exports = class AccountHelper { bodyData.roles = roles } else { //find organization from email domain - let emailDomain = utilsHelper.extractDomainFromEmail(email) + let emailDomain = utilsHelper.extractDomainFromEmail(plaintextEmailId) let domainDetails = await orgDomainQueries.findOne({ domain: emailDomain, }) @@ -257,7 +259,7 @@ module.exports = class AccountHelper { } await userQueries.updateUser({ id: user.id, organization_id: userCredentials.organization_id }, update) - await utilsHelper.redisDel(email) + await utilsHelper.redisDel(encryptedEmailId) //make the user as org admin if (isOrgAdmin) { @@ -284,7 +286,7 @@ module.exports = class AccountHelper { const payload = { type: common.notificationEmailType, email: { - to: email, + to: plaintextEmailId, subject: templateData.subject, body: utilsHelper.composeEmailBody(templateData.body, { name: bodyData.name, From 0df1197054a63b01943677bef2465b4d2a781c09 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 2 Jan 2024 16:39:45 +0530 Subject: [PATCH 036/109] Create API Fix + Modified Login API To Work With Encrypted Email --- src/services/account.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/services/account.js b/src/services/account.js index 07c110214..f2c681363 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -48,7 +48,6 @@ module.exports = class AccountHelper { try { const plaintextEmailId = bodyData.email.toLowerCase() const encryptedEmailId = emailEncryption.encrypt(plaintextEmailId) - console.log({ plaintextEmailId, encryptedEmailId }) let user = await UserCredentialQueries.findOne({ email: encryptedEmailId, password: { @@ -182,7 +181,7 @@ module.exports = class AccountHelper { const insertedUser = await userQueries.create(bodyData) const userCredentialsBody = { - email: bodyData.email, + email: encryptedEmailId, password: bodyData.password, organization_id: insertedUser.organization_id, user_id: insertedUser.id, @@ -191,7 +190,7 @@ module.exports = class AccountHelper { if (invitedUserMatch) { userCredentials = await UserCredentialQueries.updateUser( { - email: bodyData.email, + email: encryptedEmailId, }, { user_id: insertedUser.id, password: bodyData.password }, { @@ -321,8 +320,10 @@ module.exports = class AccountHelper { static async login(bodyData) { try { + const plaintextEmailId = bodyData.email.toLowerCase() + const encryptedEmailId = emailEncryption.encrypt(plaintextEmailId) const userCredentials = await UserCredentialQueries.findOne({ - email: bodyData.email.toLowerCase(), + email: encryptedEmailId, password: { [Op.ne]: null, }, @@ -1028,7 +1029,6 @@ module.exports = class AccountHelper { params.pageSize, params.searchText ) - console.log('USERS:', users) let foundKeys = {} let result = [] From 63b0f7077edcb1015e86fc6b0249aa2df8360adf Mon Sep 17 00:00:00 2001 From: adithya_dinesh Date: Tue, 2 Jan 2024 17:28:06 +0530 Subject: [PATCH 037/109] Mentee list search - Katha 1065 --- src/database/queries/users.js | 10 +++++++++- src/services/account.js | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/database/queries/users.js b/src/database/queries/users.js index 9cd0ee9f2..a312009a6 100644 --- a/src/database/queries/users.js +++ b/src/database/queries/users.js @@ -165,7 +165,7 @@ exports.findUserWithOrganization = async (filter, options = {}) => { return error } } -exports.listUsersFromView = async (roleId, organization_id, page, limit, search, userIds) => { +exports.listUsersFromView = async (roleId, organization_id, page, limit, search, userIds, email, name) => { try { const offset = (page - 1) * limit @@ -185,6 +185,12 @@ exports.listUsersFromView = async (roleId, organization_id, page, limit, search, if (userIds) { filterConditions.push(`users.id IN (:userIds)`) } + if (email) { + filterConditions.push(`users.email IN (:email)`) + } + if (name) { + filterConditions.push(`users.name ILIKE :name`) + } const filterClause = filterConditions.length > 0 ? `WHERE ${filterConditions.join(' AND ')}` : '' @@ -222,6 +228,8 @@ exports.listUsersFromView = async (roleId, organization_id, page, limit, search, offset: parseInt(offset, 10), limit: parseInt(limit, 10), userIds: userIds, + email: email, + name: '%' + name + '%', } const users = await Sequelize.query(filterQuery, { diff --git a/src/services/account.js b/src/services/account.js index cb7169b1a..1350401f8 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -1210,7 +1210,9 @@ module.exports = class AccountHelper { params.pageNo, params.pageSize, params.searchText, - params.body.user_ids ? params.body.user_ids : false + params.body.user_ids ? params.body.user_ids : false, + params.body.email ? params.body.email : false, + params.body.name ? params.body.name : false ) /* Required to resolve all promises first before preparing response object else sometime From 2957a1d2487b722a683738177ccacb9ac06d852b Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 2 Jan 2024 17:56:31 +0530 Subject: [PATCH 038/109] Modified GenerateOTP API To Use Encrypted EmailId --- src/services/account.js | 54 +++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 34 deletions(-) diff --git a/src/services/account.js b/src/services/account.js index f2c681363..de85e7882 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -584,96 +584,82 @@ module.exports = class AccountHelper { static async generateOtp(bodyData) { try { - let otp - let isValidOtpExist = true + const plaintextEmailId = bodyData.email.toLowerCase() + const encryptedEmailId = emailEncryption.encrypt(plaintextEmailId) const userCredentials = await UserCredentialQueries.findOne({ - email: bodyData.email.toLowerCase(), + email: encryptedEmailId, password: { [Op.ne]: null, }, }) - if (!userCredentials) { + if (!userCredentials) return common.failureResponse({ message: 'USER_DOESNOT_EXISTS', statusCode: httpStatusCode.bad_request, responseCode: 'CLIENT_ERROR', }) - } + const user = await userQueries.findOne({ id: userCredentials.user_id, organization_id: userCredentials.organization_id, }) - if (!user) { + if (!user) return common.failureResponse({ message: 'USER_DOESNOT_EXISTS', statusCode: httpStatusCode.bad_request, responseCode: 'CLIENT_ERROR', }) - } - const userData = await utilsHelper.redisGet(bodyData.email.toLowerCase()) - - if (userData && userData.action === 'forgetpassword') { - otp = userData.otp // If valid then get previuosly generated otp - console.log(otp) - } else { - isValidOtpExist = false - } - - const isPasswordCorrect = bcryptJs.compareSync(bodyData.password, userCredentials.password) - if (isPasswordCorrect) { + const isPasswordSame = bcryptJs.compareSync(bodyData.password, userCredentials.password) + if (isPasswordSame) return common.failureResponse({ message: 'RESET_PREVIOUS_PASSWORD', statusCode: httpStatusCode.bad_request, responseCode: 'CLIENT_ERROR', }) - } - if (!isValidOtpExist) { - otp = Math.floor(Math.random() * 900000 + 100000) // 6 digit otp + const userData = await utilsHelper.redisGet(encryptedEmailId) + const [otp, isNew] = + userData && userData.action === 'forgetpassword' + ? [userData.otp, false] + : [Math.floor(Math.random() * 900000 + 100000), true] + if (isNew) { const redisData = { - verify: bodyData.email.toLowerCase(), + verify: encryptedEmailId, action: 'forgetpassword', otp, } - const res = await utilsHelper.redisSet( - bodyData.email.toLowerCase(), - redisData, - common.otpExpirationTime - ) - if (res !== 'OK') { + const res = await utilsHelper.redisSet(encryptedEmailId, redisData, common.otpExpirationTime) + if (res !== 'OK') return common.failureResponse({ message: 'UNABLE_TO_SEND_OTP', statusCode: httpStatusCode.internal_server_error, responseCode: 'SERVER_ERROR', }) - } } const templateData = await notificationTemplateQueries.findOneEmailTemplate( process.env.OTP_EMAIL_TEMPLATE_CODE, user.organization_id ) - if (templateData) { - // Push otp to kafka const payload = { type: common.notificationEmailType, email: { - to: bodyData.email, + to: plaintextEmailId, subject: templateData.subject, body: utilsHelper.composeEmailBody(templateData.body, { name: user.name, otp }), }, } - await kafkaCommunication.pushEmailToKafka(payload) } - + if (process.env.APPLICATION_ENV === 'development') console.log({ otp, isNew }) return common.successResponse({ statusCode: httpStatusCode.ok, message: 'OTP_SENT_SUCCESSFULLY', }) } catch (error) { + console.log(error) throw error } } From 0820bfa0f25537384d9802cd6e5f21967a93ab37 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 2 Jan 2024 18:09:01 +0530 Subject: [PATCH 039/109] Modified ResetPassword API To Work With Encrypted EmailId --- src/services/account.js | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/services/account.js b/src/services/account.js index de85e7882..6adc4397c 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -744,8 +744,10 @@ module.exports = class AccountHelper { static async resetPassword(bodyData) { const projection = ['location'] try { + const plaintextEmailId = bodyData.email.toLowerCase() + const encryptedEmailId = emailEncryption.encrypt(plaintextEmailId) const userCredentials = await UserCredentialQueries.findOne({ - email: bodyData.email.toLowerCase(), + email: encryptedEmailId, password: { [Op.ne]: null, }, @@ -780,10 +782,9 @@ module.exports = class AccountHelper { responseCode: 'CLIENT_ERROR', }) } - user.user_roles = roles - const redisData = await utilsHelper.redisGet(bodyData.email.toLowerCase()) + const redisData = await utilsHelper.redisGet(encryptedEmailId) if (!redisData || redisData.otp != bodyData.otp) { return common.failureResponse({ message: 'RESET_OTP_INVALID', @@ -791,18 +792,15 @@ module.exports = class AccountHelper { responseCode: 'CLIENT_ERROR', }) } - const isPasswordCorrect = bcryptJs.compareSync(bodyData.password, userCredentials.password) - if (isPasswordCorrect) { + const isPasswordSame = bcryptJs.compareSync(bodyData.password, userCredentials.password) + if (isPasswordSame) { return common.failureResponse({ message: 'RESET_PREVIOUS_PASSWORD', statusCode: httpStatusCode.bad_request, responseCode: 'CLIENT_ERROR', }) } - - const salt = bcryptJs.genSaltSync(10) - bodyData.password = bcryptJs.hashSync(bodyData.password, salt) - + bodyData.password = utilsHelper.hashPassword(bodyData.password) const tokenDetail = { data: { id: user.id, @@ -825,11 +823,9 @@ module.exports = class AccountHelper { let noOfTokensToKeep = common.refreshTokenLimit - 1 let refreshTokens = [] - if (userTokens && userTokens.length >= common.refreshTokenLimit) { + if (userTokens && userTokens.length >= common.refreshTokenLimit) refreshTokens = userTokens.splice(-noOfTokensToKeep) - } else { - refreshTokens = userTokens - } + else refreshTokens = userTokens refreshTokens.push(currentToken) const updateParams = { @@ -844,29 +840,26 @@ module.exports = class AccountHelper { ) await UserCredentialQueries.updateUser( { - email: userCredentials.email, + email: encryptedEmailId, }, { password: bodyData.password } ) - await utilsHelper.redisDel(bodyData.email.toLowerCase()) + await utilsHelper.redisDel(encryptedEmailId) /* Mongoose schema is in strict mode, so can not delete otpInfo directly */ delete user.password delete user.otpInfo // Check if user and user.image exist, then fetch a downloadable URL for the image - if (user && user.image) { - user.image = await utils.getDownloadableUrl(user.image) - } - + if (user && user.image) user.image = await utils.getDownloadableUrl(user.image) const result = { access_token: accessToken, refresh_token: refreshToken, user } - return common.successResponse({ statusCode: httpStatusCode.ok, message: 'PASSWORD_RESET_SUCCESSFULLY', result, }) } catch (error) { + console.log(error) throw error } } From 2ddd83b705f8cb5e8eb40e83c911e4d0b99d041f Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 2 Jan 2024 18:12:20 +0530 Subject: [PATCH 040/109] Modified Change Role API To Use Encrypted EmailId --- src/services/account.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/services/account.js b/src/services/account.js index 6adc4397c..f96026bcf 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -1111,6 +1111,8 @@ module.exports = class AccountHelper { */ static async changeRole(bodyData) { try { + const plaintextEmailId = bodyData.email.toLowerCase() + const encryptedEmailId = emailEncryption.encrypt(plaintextEmailId) let role = await roleQueries.findOne({ title: bodyData.role.toLowerCase() }) if (!role) { return common.failureResponse({ @@ -1120,7 +1122,7 @@ module.exports = class AccountHelper { }) } const userCredentials = await UserCredentialQueries.findOne({ - email: bodyData.email.toLowerCase(), + email: encryptedEmailId, password: { [Op.ne]: null, }, @@ -1150,6 +1152,7 @@ module.exports = class AccountHelper { message: 'USER_ROLE_UPDATED_SUCCESSFULLY', }) } catch (error) { + console.log(error) throw error } } From 5b5e8244509e260e665c51bc8ae4176d8a321310 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 2 Jan 2024 18:26:05 +0530 Subject: [PATCH 041/109] Removed Depreciated BulkCreateMentors API + Minor Commons Fix --- src/constants/common.js | 1 - src/controllers/v1/account.js | 17 ----------- src/services/account.js | 56 ----------------------------------- 3 files changed, 74 deletions(-) diff --git a/src/constants/common.js b/src/constants/common.js index 58341b1b4..221edb45c 100644 --- a/src/constants/common.js +++ b/src/constants/common.js @@ -95,7 +95,6 @@ module.exports = { location: 'location', languages: 'languages', typeSystem: 'system', - ORG_ADMIN_ROLE: 'org_admin', UPLOADED_STATUS: 'UPLOADED', FAILED_STATUS: 'FAILED', PROCESSED_STATUS: 'PROCESSED', diff --git a/src/controllers/v1/account.js b/src/controllers/v1/account.js index 4ac0e2dc9..90ab308d1 100644 --- a/src/controllers/v1/account.js +++ b/src/controllers/v1/account.js @@ -136,23 +136,6 @@ module.exports = class Account { } } - /** - * Bulk create mentors - * @method - * @name bulkCreateMentors - * @param {Object} req -request data. - * @returns {CSV} - created mentors. - */ - async bulkCreateMentors(req) { - try { - const mentors = await csv().fromString(req.files.mentors.data.toString()) - const createdMentors = await accountService.bulkCreateMentors(mentors, req.decodedToken) - return createdMentors - } catch (error) { - return error - } - } - /** * Accept term and condition * @method diff --git a/src/services/account.js b/src/services/account.js index f96026bcf..f844f47e4 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -21,7 +21,6 @@ const kafkaCommunication = require('@generics/kafka-communication') const roleQueries = require('@database/queries/userRole') const orgDomainQueries = require('@database/queries/orgDomain') const userInviteQueries = require('@database/queries/orgUserInvite') -const FILESTREAM = require('@generics/file-stream') const entityTypeQueries = require('@database/queries/entityType') const utils = require('@generics/utils') const { Op } = require('sequelize') @@ -864,61 +863,6 @@ module.exports = class AccountHelper { } } - //Is this api used ? - /** - * Bulk create mentors - * @method - * @name bulkCreateMentors - * @param {Array} mentors - mentor details. - * @param {Object} tokenInformation - token details. - * @returns {CSV} - created mentors. - */ - static async bulkCreateMentors(mentors, tokenInformation) { - try { - const systemUser = await systemUserData.findUsersByEmail(tokenInformation.email) - - if (!systemUser) { - return common.failureResponse({ - message: 'USER_DOESNOT_EXISTS', - statusCode: httpStatusCode.bad_request, - responseCode: 'CLIENT_ERROR', - }) - } - - if (systemUser.role.toLowerCase() !== 'admin') { - return common.failureResponse({ - message: 'NOT_AN_ADMIN', - statusCode: httpStatusCode.bad_request, - responseCode: 'CLIENT_ERROR', - }) - } - - const fileName = 'mentors-creation' - let fileStream = new FILESTREAM(fileName) - let input = fileStream.initStream() - - ;(async function () { - await fileStream.getProcessorPromise() - return { - isResponseAStream: true, - fileNameWithPath: fileStream.fileNameWithPath(), - } - })() - - for (const mentor of mentors) { - mentor.isAMentor = true - const data = await this.create(mentor) - mentor.email = mentor.email.address - mentor.status = data.message - input.push(mentor) - } - - input.push(null) - } catch (error) { - throw error - } - } - /** * Account List * @method From 4cfea280d926cc48c8bff9b89f25d90b1ef9d9c7 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 2 Jan 2024 18:27:52 +0530 Subject: [PATCH 042/109] Removed Unnecessary CSV Package Import --- src/controllers/v1/account.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/controllers/v1/account.js b/src/controllers/v1/account.js index 90ab308d1..9ac9c015a 100644 --- a/src/controllers/v1/account.js +++ b/src/controllers/v1/account.js @@ -7,7 +7,6 @@ // Dependencies const accountService = require('@services/account') -const csv = require('csvtojson') module.exports = class Account { /** From e42571e0225c90a29467eb9381fa27d39e5c8ccb Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 2 Jan 2024 18:54:08 +0530 Subject: [PATCH 043/109] Modified OrgAdmin BulkUserCreate API To Use Decrypted EmailId Of Org-Admin --- src/controllers/v1/org-admin.js | 2 +- src/services/org-admin.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/controllers/v1/org-admin.js b/src/controllers/v1/org-admin.js index 3fef0adfa..484ea373a 100644 --- a/src/controllers/v1/org-admin.js +++ b/src/controllers/v1/org-admin.js @@ -55,7 +55,7 @@ module.exports = class OrgAdmin { }) } - const fileUploadList = await orgAdminService.getBulkInvitesFilesList(req) + const fileUploadList = await orgAdminService.getBulkInvitesFilesList(req) // TODO: Request Object shouldn't be allowed to leave controller layer. return fileUploadList } catch (error) { return error diff --git a/src/services/org-admin.js b/src/services/org-admin.js index 1f3c78bd7..4f691d401 100644 --- a/src/services/org-admin.js +++ b/src/services/org-admin.js @@ -23,6 +23,7 @@ const { eventBroadcaster } = require('@helpers/eventBroadcaster') const { Queue } = require('bullmq') const { Op } = require('sequelize') const UserCredentialQueries = require('@database/queries/userCredential') +const emailEncryption = require('@utils/emailEncryption') module.exports = class OrgAdminHelper { /** @@ -41,6 +42,7 @@ module.exports = class OrgAdminHelper { { id, organization_id }, { attributes: ['name', 'email'] } ) + const adminPlaintextEmailId = emailEncryption.decrypt(email) const organization = await organizationQueries.findOne({ id: organization_id }, { attributes: ['name'] }) @@ -71,7 +73,7 @@ module.exports = class OrgAdminHelper { user: { id, name, - email, + adminPlaintextEmailId, organization_id, org_name: organization.name, }, @@ -92,6 +94,7 @@ module.exports = class OrgAdminHelper { result: result, }) } catch (error) { + console.log(error) throw error } } From 386577104d0292a5df3e5400ae334832c00e5310 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 2 Jan 2024 19:20:19 +0530 Subject: [PATCH 044/109] Partial Implementation To Make BulkUpload Work With Encrypted EmailId --- src/services/account.js | 1 + src/services/org-admin.js | 2 +- src/services/userInvite.js | 9 ++++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/services/account.js b/src/services/account.js index f844f47e4..8c835e6e1 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -177,6 +177,7 @@ module.exports = class AccountHelper { } delete bodyData.role + bodyData.email = encryptedEmailId const insertedUser = await userQueries.create(bodyData) const userCredentialsBody = { diff --git a/src/services/org-admin.js b/src/services/org-admin.js index 4f691d401..2ea7efa9f 100644 --- a/src/services/org-admin.js +++ b/src/services/org-admin.js @@ -73,7 +73,7 @@ module.exports = class OrgAdminHelper { user: { id, name, - adminPlaintextEmailId, + email: adminPlaintextEmailId, organization_id, org_name: organization.name, }, diff --git a/src/services/userInvite.js b/src/services/userInvite.js index 6c0db0550..92ac24f0d 100644 --- a/src/services/userInvite.js +++ b/src/services/userInvite.js @@ -28,6 +28,7 @@ const inviteeFileDir = ProjectRootDir + common.tempFolderForBulkUpload const UserCredentialQueries = require('@database/queries/userCredential') const { Op } = require('sequelize') +const emailEncryption = require('@utils/emailEncryption') module.exports = class UserInviteHelper { static async uploadInvites(data) { @@ -81,7 +82,7 @@ module.exports = class UserInviteHelper { if (templateData) { const inviteeUploadURL = await utils.getDownloadableUrl(output_path) - await this.sendInviteeEmail(templateData, data.user, inviteeUploadURL) + await this.sendInviteeEmail(templateData, data.user, inviteeUploadURL) //Rename this to function to generic name since this function is used for both Invitee & Org-admin. } } @@ -166,7 +167,7 @@ module.exports = class UserInviteHelper { }) //get all existing user - const emailArray = _.uniq(_.map(csvData, 'email')) + const emailArray = _.uniq(_.map(csvData, 'email')).map((email) => emailEncryption.encrypt(email)) const userCredentials = await UserCredentialQueries.findAll( { email: { [Op.in]: emailArray } }, { @@ -209,7 +210,9 @@ module.exports = class UserInviteHelper { } //get existing invitees - const allEmails = _.uniq(_.map(csvData, 'email').map((userEmail) => userEmail.toLowerCase())) + const allEmails = _.uniq( + _.map(csvData, 'email').map((userEmail) => emailEncryption.encrypt(userEmail.toLowerCase())) + ) const emailList = await userInviteQueries.findAll({ email: allEmails }) const existingInvitees = {} emailList.forEach((userInvitee) => { From 846a23831251cbfc56cef64b11247f625de18fc8 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Wed, 3 Jan 2024 12:13:57 +0530 Subject: [PATCH 045/109] filter changes 03/01/24 --- src/controllers/v1/userRole.js | 2 +- .../seeders/20231221080334-add_system_manager_role.js | 4 ++-- src/services/userRole.js | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/controllers/v1/userRole.js b/src/controllers/v1/userRole.js index 40ea868d2..e776f9a1e 100644 --- a/src/controllers/v1/userRole.js +++ b/src/controllers/v1/userRole.js @@ -74,7 +74,7 @@ module.exports = class userRole { async list(req) { try { const roleList = await roleService.list( - req.body.filters, + req.query, req.pageNo, req.pageSize, req.searchText, diff --git a/src/database/seeders/20231221080334-add_system_manager_role.js b/src/database/seeders/20231221080334-add_system_manager_role.js index 515a10b55..89a202ccd 100644 --- a/src/database/seeders/20231221080334-add_system_manager_role.js +++ b/src/database/seeders/20231221080334-add_system_manager_role.js @@ -9,7 +9,7 @@ module.exports = { 'user_roles', [ { - title: 'system_manager', + title: 'session_manager', user_type: 1, visibility: 'PUBLIC', organization_id: defaultOrgId, @@ -22,6 +22,6 @@ module.exports = { }, async down(queryInterface, Sequelize) { - await queryInterface.bulkDelete('user_roles', { title: 'system_manager' }) + await queryInterface.bulkDelete('user_roles', { title: 'session_manager' }) }, } diff --git a/src/services/userRole.js b/src/services/userRole.js index 6776bf7aa..6aeccc110 100644 --- a/src/services/userRole.js +++ b/src/services/userRole.js @@ -131,6 +131,7 @@ module.exports = class userRoleHelper { static async list(filters, page, limit, search, userOrganizationId) { try { + delete filters.search const offset = common.getPaginationOffset(page, limit) const options = { offset, From ba30bd1d8e7a58bf0f0ed3600ba9b055eb3b9fb8 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Wed, 3 Jan 2024 12:36:01 +0530 Subject: [PATCH 046/109] api doc and testcases updated 03/01/24 --- .../MentorED-Users.postman_collection.json | 31 +++++++----- src/api-doc/api-doc.yaml | 49 +++++++++---------- .../userRole/userRole.spec.js | 9 +--- 3 files changed, 42 insertions(+), 47 deletions(-) diff --git a/src/api-doc/MentorED-Users.postman_collection.json b/src/api-doc/MentorED-Users.postman_collection.json index 438a99e56..e64b4323b 100644 --- a/src/api-doc/MentorED-Users.postman_collection.json +++ b/src/api-doc/MentorED-Users.postman_collection.json @@ -1626,9 +1626,6 @@ "item": [ { "name": "List User Roles", - "protocolProfileBehavior": { - "disableBodyPruning": true - }, "request": { "method": "GET", "header": [ @@ -1638,15 +1635,6 @@ "type": "text" } ], - "body": { - "mode": "raw", - "raw": "{\n \"filters\" : { \n\"organization_id\": 1\n} \n}", - "options": { - "raw": { - "language": "json" - } - } - }, "url": { "raw": "{{UserDevBaseUrl}}user/v1/userRole/list?page=1&limit=10&search=system", "host": ["{{UserDevBaseUrl}}user"], @@ -1663,6 +1651,25 @@ { "key": "search", "value": "system" + }, + { + "key": "organization_id", + "value": "1" + }, + { + "key": "user_type", + "value": "2", + "disabled": true + }, + { + "key": "visibility", + "value": "PUBLIC", + "disabled": true + }, + { + "key": "status", + "value": "ACTIVE", + "disabled": true } ] } diff --git a/src/api-doc/api-doc.yaml b/src/api-doc/api-doc.yaml index f212273a3..06a2752cb 100644 --- a/src/api-doc/api-doc.yaml +++ b/src/api-doc/api-doc.yaml @@ -1245,23 +1245,35 @@ paths: schema: type: string - in: query - name: '' - description: '' - schema: &ref_1 - type: string - - in: path name: page description: Please add page number schema: &ref_0 - type: number - - in: path + type: integer + - in: query name: limit description: Number of records to limit schema: *ref_0 - - in: path + - in: query name: search - description: Please search for information such as 'code' names + description: Please search for information such as 'title' names + schema: &ref_1 + type: string + - in: query + name: user_type + description: filtering based on the user_type + schema: *ref_0 + - in: query + name: visibility + description: filtering based on the visibility + schema: *ref_1 + - in: query + name: status + description: filtering based on the status schema: *ref_1 + - in: query + name: organization_id + description: filtering based on the organization_id + schema: *ref_0 responses: '200': description: OK @@ -1331,24 +1343,7 @@ paths: $ref: '#/components/schemas/profile/Unauthorized401Response' requestBody: description: '' - content: - application/json: - schema: - $schema: http://json-schema.org/draft-04/schema# - type: object - properties: - filters: - type: object - properties: - organization_id: - type: number - required: - - filters - examples: - example1: - value: - filters: - organization_id: 1 + content: {} /user/v1/entity-type/create: post: summary: Create Entity Type diff --git a/src/integration-test/userRole/userRole.spec.js b/src/integration-test/userRole/userRole.spec.js index bd197a34c..333e47d26 100644 --- a/src/integration-test/userRole/userRole.spec.js +++ b/src/integration-test/userRole/userRole.spec.js @@ -44,14 +44,7 @@ describe('/user/v1/userRole', function () { }) it('/list', async () => { - let res = await request - .get('/user/v1/userRole/list') - .send({ - filters: { - organization_id: 1, - }, - }) - .query({ page: 1, limit: 10, code: 'system' }) + let res = await request.get('/user/v1/userRole/list').query({ page: 1, limit: 10, code: 'system' }) logError(res) expect(res.statusCode).toBe(200) From 5436967c09cb2ed3e66b8e2a75e8cd446fc1ee54 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Wed, 3 Jan 2024 13:21:00 +0530 Subject: [PATCH 047/109] merge changes --- src/integration-test/userRole/userRole.spec.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/integration-test/userRole/userRole.spec.js b/src/integration-test/userRole/userRole.spec.js index 333e47d26..17a6fd260 100644 --- a/src/integration-test/userRole/userRole.spec.js +++ b/src/integration-test/userRole/userRole.spec.js @@ -44,7 +44,9 @@ describe('/user/v1/userRole', function () { }) it('/list', async () => { - let res = await request.get('/user/v1/userRole/list').query({ page: 1, limit: 10, code: 'system' }) + let res = await request + .get('/user/v1/userRole/list') + .query({ page: 1, limit: 10, code: 'system', organization_id: 1 }) logError(res) expect(res.statusCode).toBe(200) From 5e3571846329eaad969377f3a70ced0611d4a1e5 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Wed, 3 Jan 2024 16:51:44 +0530 Subject: [PATCH 048/109] Modified InviteQueue Handler Function To Use Encrypted EmailId (Unoptimized) + Decryption Function Fix --- src/generics/kafka-communication.js | 1 + src/services/userInvite.js | 35 +++++++++++++---------------- src/utils/emailEncryption.js | 2 +- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/src/generics/kafka-communication.js b/src/generics/kafka-communication.js index 9644b0753..f1f975e54 100644 --- a/src/generics/kafka-communication.js +++ b/src/generics/kafka-communication.js @@ -10,6 +10,7 @@ const pushEmailToKafka = async (message) => { const payload = { topic: process.env.NOTIFICATION_KAFKA_TOPIC, messages: [{ value: JSON.stringify(message) }] } return await pushPayloadToKafka(payload) } catch (error) { + console.log(error) return error } } diff --git a/src/services/userInvite.js b/src/services/userInvite.js index 92ac24f0d..c72c98648 100644 --- a/src/services/userInvite.js +++ b/src/services/userInvite.js @@ -37,15 +37,12 @@ module.exports = class UserInviteHelper { const filePath = data.fileDetails.input_path // download file to local directory const response = await this.downloadCSV(filePath) - if (!response.success) { - throw new Error('FAILED_TO_DOWNLOAD') - } + if (!response.success) throw new Error('FAILED_TO_DOWNLOAD') // extract data from csv const parsedFileData = await this.extractDataFromCSV(response.result.downloadPath) - if (!parsedFileData.success) { - throw new Error('FAILED_TO_READ_CSV') - } + if (!parsedFileData.success) throw new Error('FAILED_TO_READ_CSV') + const invitees = parsedFileData.result.data // create outPut file and create invites @@ -167,21 +164,23 @@ module.exports = class UserInviteHelper { }) //get all existing user - const emailArray = _.uniq(_.map(csvData, 'email')).map((email) => emailEncryption.encrypt(email)) + const emailArray = _.uniq(_.map(csvData, 'email')).map((email) => + emailEncryption.encrypt(email.toLowerCase()) + ) const userCredentials = await UserCredentialQueries.findAll( { email: { [Op.in]: emailArray } }, { attributes: ['user_id'], } - ) + ) //This is valid since UserCredentials Already Store The Encrypted Email ID const userIds = _.map(userCredentials, 'user_id') const existingUsers = await userQueries.findAll( { id: userIds }, { attributes: ['id', 'email', 'organization_id', 'roles'], } - ) - const existingEmailsMap = new Map(existingUsers.map((eachUser) => [eachUser.email, eachUser])) + ) //Get All The Users From Database based on UserIds From UserCredentials + const existingEmailsMap = new Map(existingUsers.map((eachUser) => [eachUser.email, eachUser])) //Figure Out Who Are The Existing Users //find default org id const defaultOrg = await organizationQueries.findOne({ code: process.env.DEFAULT_ORGANISATION_CODE }) @@ -209,11 +208,7 @@ module.exports = class UserInviteHelper { [common.MENTEE_ROLE]: menteeTemplateData, } - //get existing invitees - const allEmails = _.uniq( - _.map(csvData, 'email').map((userEmail) => emailEncryption.encrypt(userEmail.toLowerCase())) - ) - const emailList = await userInviteQueries.findAll({ email: allEmails }) + const emailList = await userInviteQueries.findAll({ email: emailArray }) const existingInvitees = {} emailList.forEach((userInvitee) => { existingInvitees[userInvitee.email] = [userInvitee.id] @@ -245,7 +240,7 @@ module.exports = class UserInviteHelper { } //update user details if the user exist and in default org - const existingUser = existingEmailsMap.get(invitee.email) + const existingUser = existingEmailsMap.get(emailEncryption.encrypt(invitee.email.toLowerCase())) if (existingUser) { invitee.statusOrUserId = 'USER_ALREADY_EXISTS' @@ -279,13 +274,13 @@ module.exports = class UserInviteHelper { if (isOrgUpdate || userUpdateData.roles) { const userCredentials = await UserCredentialQueries.findOne({ - email: invitee.email, + email: emailEncryption.encrypt(invitee.email.toLowerCase()), }) await userQueries.updateUser({ id: userCredentials.user_id }, userUpdateData) await UserCredentialQueries.updateUser( { - email: invitee.email, + email: emailEncryption.encrypt(invitee.email.toLowerCase()), }, { organization_id: user.organization_id } ) @@ -323,8 +318,9 @@ module.exports = class UserInviteHelper { file_id: fileUploadId, roles: roleTitlesToIds[invitee.roles] || [], } + inviteeData.email = emailEncryption.encrypt(inviteeData.email.toLowerCase()) - if (existingInvitees.hasOwnProperty(invitee.email)) { + if (existingInvitees.hasOwnProperty(emailEncryption.encrypt(invitee.email.toLowerCase()))) { invitee.statusOrUserId = 'USER_ALREADY_EXISTS' input.push(invitee) continue @@ -445,6 +441,7 @@ module.exports = class UserInviteHelper { success: true, } } catch (error) { + console.log(error) throw error } } diff --git a/src/utils/emailEncryption.js b/src/utils/emailEncryption.js index f8572ad43..772ce56a2 100644 --- a/src/utils/emailEncryption.js +++ b/src/utils/emailEncryption.js @@ -17,7 +17,7 @@ const encrypt = (plainTextEmail) => { const decrypt = (encryptedEmail) => { try { - const decipher = crypto.createDecipheriv(algorithm, secretKey, 'hex', fixedIV) + const decipher = crypto.createDecipheriv(algorithm, secretKey, fixedIV) return decipher.update(encryptedEmail, 'hex', 'utf-8') + decipher.final('utf-8') } catch (err) { console.log(err) From c0dc8fe40e0b354cbf191eff13f6a5a56dad6411 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Wed, 3 Jan 2024 20:06:56 +0530 Subject: [PATCH 049/109] Minor Optimisation --- src/services/userInvite.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/services/userInvite.js b/src/services/userInvite.js index c72c98648..9f79ff2a5 100644 --- a/src/services/userInvite.js +++ b/src/services/userInvite.js @@ -219,6 +219,7 @@ module.exports = class UserInviteHelper { //convert the fields to lower case invitee.roles = invitee.roles.toLowerCase() invitee.email = invitee.email.toLowerCase() + invitee.encryptedEmail = emailEncryption.encrypt(invitee.email.toLowerCase()) //validate the fields if (!utils.isValidName(invitee.name)) { @@ -240,7 +241,7 @@ module.exports = class UserInviteHelper { } //update user details if the user exist and in default org - const existingUser = existingEmailsMap.get(emailEncryption.encrypt(invitee.email.toLowerCase())) + const existingUser = existingEmailsMap.get(invitee.encryptedEmail) if (existingUser) { invitee.statusOrUserId = 'USER_ALREADY_EXISTS' @@ -274,13 +275,13 @@ module.exports = class UserInviteHelper { if (isOrgUpdate || userUpdateData.roles) { const userCredentials = await UserCredentialQueries.findOne({ - email: emailEncryption.encrypt(invitee.email.toLowerCase()), + email: invitee.encryptedEmail, }) await userQueries.updateUser({ id: userCredentials.user_id }, userUpdateData) await UserCredentialQueries.updateUser( { - email: emailEncryption.encrypt(invitee.email.toLowerCase()), + email: invitee.encryptedEmail, }, { organization_id: user.organization_id } ) @@ -318,9 +319,9 @@ module.exports = class UserInviteHelper { file_id: fileUploadId, roles: roleTitlesToIds[invitee.roles] || [], } - inviteeData.email = emailEncryption.encrypt(inviteeData.email.toLowerCase()) + inviteeData.email = inviteeData.encryptedEmail - if (existingInvitees.hasOwnProperty(emailEncryption.encrypt(invitee.email.toLowerCase()))) { + if (existingInvitees.hasOwnProperty(invitee.encryptedEmail)) { invitee.statusOrUserId = 'USER_ALREADY_EXISTS' input.push(invitee) continue From b37fc587db13fb1c485f86ad772fbf67690c6ab9 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Wed, 3 Jan 2024 20:15:08 +0530 Subject: [PATCH 050/109] Modified Admin Create & Login APIs to Use Encrypted Passwords --- src/services/admin.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/services/admin.js b/src/services/admin.js index cf554d2c5..ab6e7af2f 100644 --- a/src/services/admin.js +++ b/src/services/admin.js @@ -18,6 +18,7 @@ const { eventBroadcaster } = require('@helpers/eventBroadcaster') const { Op } = require('sequelize') const UserCredentialQueries = require('@database/queries/userCredential') const adminService = require('../generics/materializedViews') +const emailEncryption = require('@utils/emailEncryption') module.exports = class AdminHelper { /** @@ -70,8 +71,9 @@ module.exports = class AdminHelper { */ static async create(bodyData) { try { - const email = bodyData.email.toLowerCase() - const user = await UserCredentialQueries.findOne({ email: email }) + const plaintextEmailId = bodyData.email.toLowerCase() + const encryptedEmailId = emailEncryption.encrypt(plaintextEmailId) + const user = await UserCredentialQueries.findOne({ email: encryptedEmailId }) if (user) { return common.failureResponse({ @@ -99,8 +101,8 @@ module.exports = class AdminHelper { ) bodyData.organization_id = organization.id } - bodyData.password = utils.hashPassword(bodyData.password) + bodyData.email = encryptedEmailId const createdUser = await userQueries.create(bodyData) const userCredentialsBody = { email: bodyData.email, @@ -121,6 +123,7 @@ module.exports = class AdminHelper { message: 'USER_CREATED_SUCCESSFULLY', }) } catch (error) { + console.log(error) throw error } } @@ -136,7 +139,9 @@ module.exports = class AdminHelper { */ static async login(bodyData) { try { - const userCredentials = await UserCredentialQueries.findOne({ email: bodyData.email.toLowerCase() }) + const plaintextEmailId = bodyData.email.toLowerCase() + const encryptedEmailId = emailEncryption.encrypt(plaintextEmailId) + const userCredentials = await UserCredentialQueries.findOne({ email: encryptedEmailId }) if (!userCredentials) { return common.failureResponse({ message: 'USER_DOESNOT_EXISTS', @@ -204,6 +209,7 @@ module.exports = class AdminHelper { result, }) } catch (error) { + console.log(error) throw error } } From 9d8c2af1d30524e5958f5bc47003da2d1a37d40f Mon Sep 17 00:00:00 2001 From: Priyanka Pradeep Date: Wed, 3 Jan 2024 20:33:20 +0530 Subject: [PATCH 051/109] org filter list changes --- src/constants/common.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/constants/common.js b/src/constants/common.js index 58341b1b4..a29feb507 100644 --- a/src/constants/common.js +++ b/src/constants/common.js @@ -58,6 +58,7 @@ module.exports = { '/user/v1/admin/triggerViewRebuildInternal', '/user/v1/admin/triggerPeriodicViewRefreshInternal', '/user/v1/account/search', + '/user/v1/organization/list', ], notificationEmailType: 'email', accessTokenExpiry: `${process.env.ACCESS_TOKEN_EXPIRY}d`, From 8893b3b489b922a463774354862455e26486c4d4 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Wed, 3 Jan 2024 21:05:39 +0530 Subject: [PATCH 052/109] Added Script To Bulk Encrypt Decrypt Emails In Tables --- src/scripts/encryptDecryptEmails.js | 66 +++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/scripts/encryptDecryptEmails.js diff --git a/src/scripts/encryptDecryptEmails.js b/src/scripts/encryptDecryptEmails.js new file mode 100644 index 000000000..3050fd6a8 --- /dev/null +++ b/src/scripts/encryptDecryptEmails.js @@ -0,0 +1,66 @@ +'use strict' +const { Sequelize } = require('sequelize') +require('dotenv').config({ path: '../.env' }) +const emailEncryption = require('../utils/emailEncryption') + +const nodeEnv = process.env.NODE_ENV || 'development' + +let databaseUrl + +switch (nodeEnv) { + case 'production': + databaseUrl = process.env.PROD_DATABASE_URL + break + case 'test': + databaseUrl = process.env.TEST_DATABASE_URL + break + default: + databaseUrl = process.env.DEV_DATABASE_URL +} + +if (!databaseUrl) { + console.error(`${nodeEnv} DATABASE_URL not found in environment variables.`) + process.exit(1) +} + +const sequelize = new Sequelize(databaseUrl, { + dialect: 'postgres', + logging: process.env.NODE_ENV === 'development' ? console.log : false, +}) + +const processTable = async (tableName, operation) => { + const records = await sequelize.query(`SELECT * FROM ${tableName};`, { + type: Sequelize.QueryTypes.SELECT, + }) + + for (const record of records) { + const columnValue = + operation === 'encrypt' ? emailEncryption.encrypt(record.email) : emailEncryption.decrypt(record.email) + await sequelize.query(`UPDATE ${tableName} SET email = '${columnValue}' WHERE id = ${record.id};`) + } + + console.log(`Finished processing ${tableName} table.`) +} + +const main = async () => { + const operation = process.argv[2] + + if (operation !== 'encrypt' && operation !== 'decrypt') { + console.error('Invalid operation. Please use "encrypt" or "decrypt".') + process.exit(1) + } + + try { + await processTable('organization_user_invites', operation) + await processTable('users', operation) + await processTable('users_credentials', operation) + } catch (err) { + console.error(err) + process.exit(1) + } + + console.log('Script completed successfully.') + process.exit(0) +} + +main() From 0c3d0dca10c3f854f8493072e19e88a481f87695 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Thu, 4 Jan 2024 18:15:50 +0530 Subject: [PATCH 053/109] Modified Organization Create API To Work With Encrypted Email --- src/services/organization.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/services/organization.js b/src/services/organization.js index 75a529d57..59e98d544 100644 --- a/src/services/organization.js +++ b/src/services/organization.js @@ -12,6 +12,7 @@ const { Op } = require('sequelize') const _ = require('lodash') const { eventBroadcaster } = require('@helpers/eventBroadcaster') const UserCredentialQueries = require('@database/queries/userCredential') +const emailEncryption = require('@utils/emailEncryption') module.exports = class OrganizationsHelper { /** @@ -54,6 +55,8 @@ module.exports = class OrganizationsHelper { // Send an invitation to the admin if an email is provided. if (bodyData.admin_email) { + const plaintextEmailId = bodyData.admin_email.toLowerCase() + const encryptedEmailId = emailEncryption.encrypt(plaintextEmailId) const role = await roleQueries.findOne( { title: common.ORG_ADMIN_ROLE }, { @@ -70,7 +73,7 @@ module.exports = class OrganizationsHelper { } const inviteeData = { - email: bodyData.admin_email, + email: encryptedEmailId, name: common.USER_ROLE, organization_id: createdOrganization.id, roles: [role.id], @@ -79,7 +82,7 @@ module.exports = class OrganizationsHelper { const createdInvite = await userInviteQueries.create(inviteeData) const userCred = await UserCredentialQueries.create({ - email: bodyData.admin_email, + email: encryptedEmailId, organization_id: createdOrganization.id, organization_user_invite_id: createdInvite.id, }) @@ -100,7 +103,7 @@ module.exports = class OrganizationsHelper { const payload = { type: common.notificationEmailType, email: { - to: bodyData.admin_email, + to: plaintextEmailId, subject: templateData.subject, body: utils.composeEmailBody(templateData.body, { name: inviteeData.name, @@ -126,6 +129,7 @@ module.exports = class OrganizationsHelper { result: createdOrganization, }) } catch (error) { + console.log(error) throw error } } From 003c86cfa0c32865527e7a6d85cf0833ff81ac51 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Thu, 4 Jan 2024 18:34:12 +0530 Subject: [PATCH 054/109] Modified Admin AddOrgAdmin API To Work With Encrypted Email --- src/services/admin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/services/admin.js b/src/services/admin.js index ab6e7af2f..4b794933a 100644 --- a/src/services/admin.js +++ b/src/services/admin.js @@ -226,8 +226,10 @@ module.exports = class AdminHelper { try { let userCredentials if (emailId) { + const plaintextEmailId = emailId.toLowerCase() + const encryptedEmailId = emailEncryption.encrypt(plaintextEmailId) userCredentials = await UserCredentialQueries.findOne({ - email: emailId.toLowerCase(), + email: encryptedEmailId, }) } else { userCredentials = await UserCredentialQueries.findOne({ From 0d8b197d3d3f18631ff6ea005b8952cb04fc7da0 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Thu, 4 Jan 2024 18:42:34 +0530 Subject: [PATCH 055/109] Modified Org-admin DeactivateUser API To Make Use Of Encrypted Email --- src/services/org-admin.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/services/org-admin.js b/src/services/org-admin.js index 2ea7efa9f..7a9aef0be 100644 --- a/src/services/org-admin.js +++ b/src/services/org-admin.js @@ -305,8 +305,10 @@ module.exports = class OrgAdminHelper { let userIds = [] if (bodyData.email) { + const encryptedEmailIds = bodyData.email.map((email) => emailEncryption.encrypt(email.toLowerCase())) + console.log('ENCRYPTEEEEEEEEEEEEEED EMAIL IDS: ', encryptedEmailIds) const userCredentials = await UserCredentialQueries.findAll( - { email: { [Op.in]: bodyData.email } }, + { email: { [Op.in]: encryptedEmailIds } }, { attributes: ['user_id'], } @@ -342,6 +344,7 @@ module.exports = class OrgAdminHelper { message: 'USER_DEACTIVATED', }) } catch (error) { + console.log(error) throw error } } From 5a47ecc2ba414f78fc288d4673f17e00cadc8409 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Thu, 4 Jan 2024 18:54:26 +0530 Subject: [PATCH 056/109] Modified Admin DeactivateUser API To Use Encrypted Email --- src/services/admin.js | 6 +++++- src/services/org-admin.js | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/services/admin.js b/src/services/admin.js index 4b794933a..325cfd655 100644 --- a/src/services/admin.js +++ b/src/services/admin.js @@ -452,6 +452,7 @@ module.exports = class AdminHelper { */ static async deactivateUser(bodyData, loggedInUserId) { try { + let filterQuery = {} for (let item in bodyData) { filterQuery[item] = { [Op.in]: bodyData[item], @@ -461,8 +462,9 @@ module.exports = class AdminHelper { let userIds = [] if (bodyData.email) { + const encryptedEmailIds = bodyData.email.map((email) => emailEncryption.encrypt(email.toLowerCase())) const userCredentials = await UserCredentialQueries.findAll( - { email: { [Op.in]: bodyData.email } }, + { email: { [Op.in]: encryptedEmailIds } }, { attributes: ['user_id'], } @@ -499,9 +501,11 @@ module.exports = class AdminHelper { message: 'USER_DEACTIVATED', }) } catch (error) { + console.log(error) throw error } } + static async triggerViewRebuild(decodedToken) { try { const result = await adminService.triggerViewBuild() diff --git a/src/services/org-admin.js b/src/services/org-admin.js index 7a9aef0be..ef583ddb2 100644 --- a/src/services/org-admin.js +++ b/src/services/org-admin.js @@ -306,7 +306,6 @@ module.exports = class OrgAdminHelper { if (bodyData.email) { const encryptedEmailIds = bodyData.email.map((email) => emailEncryption.encrypt(email.toLowerCase())) - console.log('ENCRYPTEEEEEEEEEEEEEED EMAIL IDS: ', encryptedEmailIds) const userCredentials = await UserCredentialQueries.findAll( { email: { [Op.in]: encryptedEmailIds } }, { From 46e3f019cc540f6191eb363a35063a96000d872d Mon Sep 17 00:00:00 2001 From: rakeshSgr Date: Fri, 5 Jan 2024 18:02:14 +0530 Subject: [PATCH 057/109] docker changes --- dev-ops/docker-compose.yml | 45 ++++++++++++++++++++------------------ src/configs/index.js | 2 +- 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/dev-ops/docker-compose.yml b/dev-ops/docker-compose.yml index bce024b7f..2e1f0b20a 100644 --- a/dev-ops/docker-compose.yml +++ b/dev-ops/docker-compose.yml @@ -1,35 +1,39 @@ version: '3' services: zookeeper: - image: 'bitnami/zookeeper:3.8.0' + image: 'confluentinc/cp-zookeeper:7.3.0' + ports: + - '2181:2181' environment: - ALLOW_ANONYMOUS_LOGIN=yes + - ZOOKEEPER_CLIENT_PORT=2181 + - ZOOKEEPER_TICK_TIME=2000 networks: - elevate_net logging: - driver: none + driver: json-file kafka: - image: 'bitnami/kafka:3.1.0' + image: 'confluentinc/cp-kafka:7.3.0' + ports: + - '9092:9092' environment: - - KAFKA_BROKER_ID=1 - - KAFKA_CFG_LISTENERS=CLIENT://:9092,EXTERNAL://:9093 - - KAFKA_CFG_ADVERTISED_LISTENERS=CLIENT://kafka:9092,EXTERNAL://localhost:9093 - - KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181 - - ALLOW_PLAINTEXT_LISTENER=yes - - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CLIENT:PLAINTEXT,EXTERNAL:PLAINTEXT - - KAFKA_CFG_INTER_BROKER_LISTENER_NAME=CLIENT + KAFKA_BROKER_ID: 1 + KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181 + KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:9093 + KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT + KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT + KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 depends_on: - zookeeper networks: - elevate_net - logging: - driver: none - mongo: - image: 'mongo:4.4.14' + driver: json-file + postgres: + image: 'postgres:16' restart: 'always' ports: - - '27017:27017' + - '5432:5432' networks: - elevate_net logging: @@ -42,24 +46,23 @@ services: networks: - elevate_net logging: - driver: none - user_test: + driver: json-file + user_elevate_2.5: build: '../' - image: elevate/user:1.0 + # image: elevate/user:1.0 volumes: - ../src/:/var/src ports: - - '3001:3001' + - '5001:5001' command: [ 'nodemon', 'app.js' ] environment: - - MONGODB_URL=mongodb://mongo:27017/elevate-mentoring - KAFKA_URL=kafka:9092 - REDIS_HOST=redis://redis:6379 env_file: - integration_test.env depends_on: - kafka - - mongo + - postgres - redis networks: - elevate_net diff --git a/src/configs/index.js b/src/configs/index.js index dbf0e6e1c..9d3d97f6b 100644 --- a/src/configs/index.js +++ b/src/configs/index.js @@ -6,7 +6,7 @@ */ //Dependencies -require('./mongodb')() +// require('./mongodb')() require('./kafka')() require('./cache')() require('./aes256cbc')() From c8c5761a2e25350efe56c05b7dc91b83fe7b0538 Mon Sep 17 00:00:00 2001 From: adithya_dinesh Date: Fri, 5 Jan 2024 19:36:29 +0530 Subject: [PATCH 058/109] enabled full/partial search for email --- src/database/queries/users.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/database/queries/users.js b/src/database/queries/users.js index 21b522838..ecd8773e4 100644 --- a/src/database/queries/users.js +++ b/src/database/queries/users.js @@ -186,7 +186,7 @@ exports.listUsersFromView = async (roleId, organization_id, page, limit, search, filterConditions.push(`users.id IN (:userIds)`) } if (email) { - filterConditions.push(`users.email IN (:email)`) + filterConditions.push(`users.email ILIKE :email`) } if (name) { filterConditions.push(`users.name ILIKE :name`) @@ -228,7 +228,7 @@ exports.listUsersFromView = async (roleId, organization_id, page, limit, search, offset: parseInt(offset, 10), limit: parseInt(limit, 10), userIds: userIds, - email: email, + email: '%' + email + '%', name: '%' + name + '%', } From dc6da3660f096caf3149da1e72006ebddbf612f2 Mon Sep 17 00:00:00 2001 From: rakeshSgr Date: Mon, 8 Jan 2024 14:54:30 +0530 Subject: [PATCH 059/109] env added --- dev-ops/integration_test.env | 220 +++++++++++++++-------------------- 1 file changed, 93 insertions(+), 127 deletions(-) diff --git a/dev-ops/integration_test.env b/dev-ops/integration_test.env index 2365ba6d1..592f7da07 100644 --- a/dev-ops/integration_test.env +++ b/dev-ops/integration_test.env @@ -1,127 +1,93 @@ -#User Service Config - -# Port on which service runs -APPLICATION_PORT = 3001 - -# Service environment -APPLICATION_ENV = development - -# Database connectivity url -MONGODB_URL = mongodb://mongo:27017/elevate-mentoring - - -# Number of rounds for encryption -SALT_ROUNDS = 10 - -# Token secret to generate access token -ACCESS_TOKEN_SECRET = 'test' - -# Token secret to generate refresh token -REFRESH_TOKEN_SECRET = 'refresh-token-secret' - -# Kafka hosted server url -KAFKA_URL = localhost:9092 - -# Kafka group to which consumer belongs -KAFKA_GROUP_ID = userservice - -# Kafka topic to consume data from -KAFKA_TOPIC = 'testTopic' - -# Kafka topic to push notification data -NOTIFICATION_KAFKA_TOPIC = 'testTopic' - -# Any one of three features available for cloud storage -CLOUD_STORAGE = 'AWS' - -# Gcp json config file path -GCP_PATH = 'gcp.json' - -# Gcp bucket name which stores files -DEFAULT_GCP_BUCKET_NAME = 'gcp-bucket-storage-name' - -# Gcp project id -GCP_PROJECT_ID = 'project-id' - -# Aws access key id -AWS_ACCESS_KEY_ID = 'aws-access-key-id' - -# Aws secret access key -AWS_SECRET_ACCESS_KEY = 'aws-secret-access-key' - -# Aws region where bucket will be located -AWS_BUCKET_REGION = 'ap-south-1' - -# Aws end point -AWS_BUCKET_ENDPOINT = 's3.ap-south-1.amazonaws.com' - -# Aws bucket name which stores files -DEFAULT_AWS_BUCKET_NAME = 'aws-bucket-storage-name' - -# Azure storage account name -AZURE_ACCOUNT_NAME = 'account-name' - -# Azure storage account key -AZURE_ACCOUNT_KEY = 'azure-account-key' - -# Azure storage container which stores files -DEFAULT_AZURE_CONTAINER_NAME = 'azure-container-storage-name' - -# Internal access token for communicationcation between services via network call -INTERNAL_ACCESS_TOKEN = 'internal-access-token' - -# Mentor screct code for registering -MENTOR_SECRET_CODE = 'secret-code' - -#Enable logging of network request -ENABLE_LOG = true - -# JWT Access Token expiry In Days -ACCESS_TOKEN_EXPIRY = '1' - -# JWT Refresh Token expiry In Days -REFRESH_TOKEN_EXPIRY = '183' - -# Redis Host connectivity url -REDIS_HOST = 'redis://localhost:6379' - -# Otp expiration time for forgetpassword or registration process -OTP_EXP_TIME = 86400 - -# Enable email based otp verification for registration process -ENABLE_EMAIL_OTP_VERIFICATION = false - -# Api doc url -API_DOC_URL = '/api-doc' - -#Enable email for reported issue. -ENABLE_EMAIL_FOR_REPORT_ISSUE = true - -#Email id of the support team. -SUPPORT_EMAIL_ID = 'support@xyz.com,team@xyz.com' - -#Email template code for reported issue. -REPORT_ISSUE_EMAIL_TEMPLATE_CODE = 'user_issue_reported' -#kafka rating topic -RATING_KAFKA_TOPIC = 'Rating' - -#Internal cache expiry time -INTERNAL_CACHE_EXP_TIME = 86400 - -#Kafka internal communicationcation -CLEAR_INTERNAL_CACHE = 'userInternal' - -APP_NAME = 'user' - -REGISTRATION_EMAIL_TEMPLATE_CODE = 'code' - -OTP_EMAIL_TEMPLATE_CODE = 'ssss' -REDIS_CACHE_EXP_TIME = 11 - -KEY="g5MQ7HG/r5gPCPQQCwfBBEduAt72ewJIY/gWc0RNoak=" -IV="2lIctRkqzYMWbwlW1jCC9A==" - -ERROR_LOG_LEVEL='silly' -DISABLE_LOG=false - -ADMIN_SECRET_CODE=W5bF7gesuS0xsNWmpsKy \ No newline at end of file +ACCESS_TOKEN_EXPIRY=1 +ACCESS_TOKEN_SECRET=bsj82AHBxahusub12yexlashsbxAXADHBlaj +API_DOC_URL = /user/api-doc +APP_NAME=MentorED +APPLICATION_ENV=development + +#APPLICATION_PORT=3001 + +AWS_ACCESS_KEY_ID= "test" +AWS_BUCKET_ENDPOINT= "s3.ap-south-1.amazonaws.com" +AWS_BUCKET_REGION= "ap-south-1" +AWS_SECRET_ACCESS_KEY= "/0UfS/0ooVQAwQMcwaW9yi" +AZURE_ACCOUNT_KEY=test +AZURE_ACCOUNT_NAME=mentoring +CLEAR_INTERNAL_CACHE=userinternal +CLOUD_STORAGE=AWS +DEFAULT_AWS_BUCKET_NAME=mentoring-dev-storage +DEFAULT_AZURE_CONTAINER_NAME=mentoring-images +DEFAULT_GCP_BUCKET_NAME=mentoring-dev-storage +ENABLE_EMAIL_OTP_VERIFICATION=false +ENABLE_LOG=true +GCP_PATH=gcp.json +GCP_PROJECT_ID=sl-dev-project +INTERNAL_ACCESS_TOKEN=internal_access_token +INTERNAL_CACHE_EXP_TIME=86400 +IV=LHYOA5YnTonqcgrm15k3/Q== +KAFKA_GROUP_ID=mentoring +KAFKA_TOPIC= mentoring +#KAFKA_URL= localhost:9092 +KEY=E/m3RD/aM3Ed3lLfYVcKizakG9R+bFybAPZSLjIP2hY= +MENTOR_SECRET_CODE=4567 +MONGODB_URL=mongodb://localhost:27017/elevate-users +NOTIFICATION_KAFKA_TOPIC=dev.notifications +OTP_EMAIL_TEMPLATE_CODE=emailotp +OTP_EXP_TIME=86400 +RATING_KAFKA_TOPIC=dev.mentor_rating +#REDIS_HOST=redis://localhost:6379 +REFRESH_TOKEN_EXPIRY=183 +REFRESH_TOKEN_SECRET=371hkjkjady2y3ihdkajshdkiq23iuekw71yekhaskdvkvegavy23t78veqwexqvxveit6ttxyeeytt62tx236vv +REGISTRATION_EMAIL_TEMPLATE_CODE=registration +REGISTRATION_OTP_EMAIL_TEMPLATE_CODE=registrationotp +SALT_ROUNDS=10 + +DEFAULT_OCI_BUCKET_NAME= dev-mentoring +OCI_ACCESS_KEY_ID= 23b90f80de10cc226f7a4d617e0f4012a544d01d +OCI_BUCKET_ENDPOINT= https://axgqmpkrpmt5.compat.objectstorage.ap-hyderabad-1.oraclecloud.com +OCI_BUCKET_REGION= ap-hyderabad-1 +OCI_SECRET_ACCESS_KEY= 22levMw5Cinz6/NsAKXXakZMpzCet9yu6nn4dVeSmNE= + +#REPLICA_SET_NAME = mongo-rs +#REPLICA_SET_READ_PREFERENCE = secondaryPreferred +#MONGODB_URL= mongodb://localhost:27017/elevate-users + +ERROR_LOG_LEVEL= silly +DISABLE_LOG= false +DEFAULT_ORGANISATION_CODE=default_code + +#new +DEV_DATABASE_URL=postgres://postgres:postgres@localhost:5432/user-local +ADMIN_SECRET_CODE=W5bF7gesuS0xsNWmpsKy +MENTORING_SERVICE_URL= test +DEFAULT_QUEUE="test" + +INVITEE_EMAIL_TEMPLATE_CODE='test' +ADMIN_INVITEE_UPLOAD_EMAIL_TEMPLATE_CODE='test' +MENTOR_INVITATION_EMAIL_TEMPLATE_CODE="test" +MENTEE_INVITATION_EMAIL_TEMPLATE_CODE="test" +#Default role +DEFAULT_ROLE="mentee" + +#sample file upload path +SAMPLE_CSV_FILE_PATH=sample/bulk_user_creation.csv + +#Email template for org admin invitation +ORG_ADMIN_INVITATION_EMAIL_TEMPLATE_CODE=invite_org_admin +DEFAULT_ORG_ID=1 +MENTORING_SERVICE_URL=http://mentoring:3002 +#Email template for mentor role request accepted +MENTOR_REQUEST_ACCEPTED_EMAIL_TEMPLATE_CODE=mentor_request_accepted + +#Email template for mentor role request rejected +MENTOR_REQUEST_REJECTED_EMAIL_TEMPLATE_CODE=mentor_request_rejected +DEFAULT_ROLE=mentee +PORTAL_URL = 'https://mentored.shikshalokam.org/auth/login' + +#Host name for scheduler service +SCHEDULER_SERVICE_HOST="http://localhost:4000" + +#base URL for scheduler service +SCHEDULER_SERVICE_BASE_URL= /scheduler/ + +#Refresh interval for materialized views +REFRESH_VIEW_INTERVAL= 540000 \ No newline at end of file From 75d99d15f00eaeefb8c93df1ffcb1287a1552e5e Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Mon, 8 Jan 2024 16:44:12 +0530 Subject: [PATCH 060/109] Issue:1157 Modified RestructureBody And ProcessDbResponse Function To Avoid Other:Other Bug & Duplicate Entities --- src/generics/utils.js | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/generics/utils.js b/src/generics/utils.js index 656e30a0d..3c7253870 100644 --- a/src/generics/utils.js +++ b/src/generics/utils.js @@ -240,10 +240,13 @@ function restructureBody(requestBody, entityData, allowedKeys) { requestBody.custom_entity_text = {} if (!requestBody.meta) requestBody.meta = {} for (const currentFieldName in requestBody) { - const currentFieldValue = requestBody[currentFieldName] + const [currentFieldValue, isFieldValueAnArray] = Array.isArray(requestBody[currentFieldName]) + ? [[...requestBody[currentFieldName]], true] //If the requestBody[currentFieldName] is array, make a copy in currentFieldValue than a reference + : [requestBody[currentFieldName], false] const entityType = entityTypeMap.get(currentFieldName) if (entityType && entityType.get('allow_custom_entities')) { - if (Array.isArray(currentFieldValue)) { + if (isFieldValueAnArray) { + requestBody[currentFieldName] = [] const recognizedEntities = [] const customEntities = [] for (const value of currentFieldValue) { @@ -303,19 +306,8 @@ function processDbResponse(responseBody, entityType) { value: entity.value, label: entity.label, })) - if (matchingValues.length > 0) { - output[key] = Array.isArray(output[key]) - ? matchingValues - : matchingValues.find((entity) => entity.value === output[key]) - } else if (Array.isArray(output[key])) { - output[key] = output[key].map((item) => { - if (item.value && item.label) return item - return { - value: item, - label: item, - } - }) - } + if (matchingValues.length > 0) output[key] = Array.isArray(output[key]) ? matchingValues : matchingValues[0] + else if (Array.isArray(output[key])) output[key] = output[key].filter((item) => item.value && item.label) } if (output.meta && output.meta[key] && entityType.some((entity) => entity.value === output.meta[key].value)) { From 6e7fcaf2cb82294a16c3b46440faf2b02ec5b2aa Mon Sep 17 00:00:00 2001 From: Nevil Date: Mon, 8 Jan 2024 17:40:32 +0530 Subject: [PATCH 061/109] added event workflow for name update --- src/constants/eventEndpoints.js | 7 +++++++ src/services/user.js | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/constants/eventEndpoints.js b/src/constants/eventEndpoints.js index e47b5783b..366840630 100644 --- a/src/constants/eventEndpoints.js +++ b/src/constants/eventEndpoints.js @@ -28,5 +28,12 @@ module.exports = { route: '/mentoring/v1/org-admin/updateRelatedOrgs', }, ], + updateName: [ + { + method: 'POST', + baseUrl: `${process.env.MENTORING_SERVICE_URL}`, + route: '/mentoring/v1/sessions/bulkUpdateMentorNames', + }, + ], }, } diff --git a/src/services/user.js b/src/services/user.js index ea1534503..000e94564 100644 --- a/src/services/user.js +++ b/src/services/user.js @@ -17,6 +17,7 @@ const organizationQueries = require('@database/queries/organization') const { removeDefaultOrgEntityTypes } = require('@generics/utils') const _ = require('lodash') const { Op } = require('sequelize') +const { eventBroadcaster } = require('@helpers/eventBroadcaster') module.exports = class UserHelper { /** @@ -87,6 +88,19 @@ module.exports = class UserHelper { bodyData ) + const currentUser = updatedData[0] + + const currentName = currentUser.dataValues.name // Assuming name is a direct property, adjust as needed + const previousName = currentUser._previousDataValues?.name || null + + if (currentName !== previousName) { + eventBroadcaster('updateName', { + requestBody: { + mentor_name: currentName, + mentor_id: id, + }, + }) + } const redisUserKey = common.redisUserPrefix + id.toString() if (await utils.redisGet(redisUserKey)) { await utils.redisDel(redisUserKey) From a7483154fbf469f7449f6a4e91c2fdb086a76947 Mon Sep 17 00:00:00 2001 From: Nevil Date: Mon, 8 Jan 2024 19:01:22 +0530 Subject: [PATCH 062/109] removed a comment --- src/services/user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/user.js b/src/services/user.js index 000e94564..e0eb1282d 100644 --- a/src/services/user.js +++ b/src/services/user.js @@ -90,7 +90,7 @@ module.exports = class UserHelper { const currentUser = updatedData[0] - const currentName = currentUser.dataValues.name // Assuming name is a direct property, adjust as needed + const currentName = currentUser.dataValues.name const previousName = currentUser._previousDataValues?.name || null if (currentName !== previousName) { From 59fdf0361c68a68b6e08ad029126bec0bfa606d8 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 9 Jan 2024 14:55:06 +0530 Subject: [PATCH 063/109] Added Readme For Script --- src/scripts/readme.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/scripts/readme.md b/src/scripts/readme.md index ae1b1fe4d..060c6fc3f 100644 --- a/src/scripts/readme.md +++ b/src/scripts/readme.md @@ -8,3 +8,23 @@ ```bash node -r module-alias/register uploadSampleCSV.js ``` + +## Email Encryption/Decryption Script + +- Navigate to the script folder using the following command + ```bash + cd src/script + ``` +- Run the **encryptDecryptEmails.js** using the following commands for encryption and decryption respectively. + + Encryption: + + ``` + node ./encryptDecryptEmails.js encrypt + ``` + + Decryption: + + ``` + node ./encryptDecryptEmails.js decrypt + ``` From 02a396f987ce75b75ece8a9901487915cbf298af Mon Sep 17 00:00:00 2001 From: adithya_dinesh Date: Tue, 9 Jan 2024 15:13:37 +0530 Subject: [PATCH 064/109] user search added email in response --- src/database/queries/users.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/database/queries/users.js b/src/database/queries/users.js index ecd8773e4..c9f2e6ec9 100644 --- a/src/database/queries/users.js +++ b/src/database/queries/users.js @@ -198,6 +198,7 @@ exports.listUsersFromView = async (roleId, organization_id, page, limit, search, SELECT users.id, users.name, + users.email, users.about, users.image, jsonb_build_object( From f58ae23dc2dcf2b340e93014f17d9f2b2f71eb89 Mon Sep 17 00:00:00 2001 From: adithya_dinesh Date: Tue, 9 Jan 2024 17:35:50 +0530 Subject: [PATCH 065/109] account search email regex --- src/database/queries/users.js | 15 +++++---------- src/generics/utils.js | 10 ++++++++++ src/middlewares/pagination.js | 2 +- src/services/account.js | 8 +++++--- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/database/queries/users.js b/src/database/queries/users.js index c9f2e6ec9..d7bc9a300 100644 --- a/src/database/queries/users.js +++ b/src/database/queries/users.js @@ -165,13 +165,15 @@ exports.findUserWithOrganization = async (filter, options = {}) => { return error } } -exports.listUsersFromView = async (roleId, organization_id, page, limit, search, userIds, email, name) => { +exports.listUsersFromView = async (roleId, organization_id, page, limit, search, userIds, email) => { try { const offset = (page - 1) * limit const filterConditions = [] - if (search) { + if (email) { + filterConditions.push(`users.email ILIKE :email`) + } else if (search) { filterConditions.push(`users.name ILIKE :search`) } @@ -185,12 +187,6 @@ exports.listUsersFromView = async (roleId, organization_id, page, limit, search, if (userIds) { filterConditions.push(`users.id IN (:userIds)`) } - if (email) { - filterConditions.push(`users.email ILIKE :email`) - } - if (name) { - filterConditions.push(`users.name ILIKE :name`) - } const filterClause = filterConditions.length > 0 ? `WHERE ${filterConditions.join(' AND ')}` : '' @@ -229,8 +225,7 @@ exports.listUsersFromView = async (roleId, organization_id, page, limit, search, offset: parseInt(offset, 10), limit: parseInt(limit, 10), userIds: userIds, - email: '%' + email + '%', - name: '%' + name + '%', + email: email, } const users = await Sequelize.query(filterQuery, { diff --git a/src/generics/utils.js b/src/generics/utils.js index 7ad1dec6a..420a8ea45 100644 --- a/src/generics/utils.js +++ b/src/generics/utils.js @@ -427,6 +427,15 @@ const generateWhereClause = (tableName) => { return whereClause } + +function isEmail(input) { + // Regular expression for matching email addresses + const emailRegex = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/ + + // Test the input string against the email regex + return emailRegex.test(input) +} + module.exports = { generateToken, hashPassword, @@ -456,4 +465,5 @@ module.exports = { isValidEmail, isValidName, generateWhereClause, + isEmail, } diff --git a/src/middlewares/pagination.js b/src/middlewares/pagination.js index 9aa449861..fffd8efc5 100644 --- a/src/middlewares/pagination.js +++ b/src/middlewares/pagination.js @@ -7,7 +7,7 @@ const common = require('@constants/common') const httpStatus = require('@generics/http-status') function containsSpecialChars(str) { - const specialChars = /[`!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?~]/ + const specialChars = /[`!#$%^&*()_+\-=\[\]{};':"\\|,<>\/?~]/ return specialChars.test(str) } module.exports = (req, res, next) => { diff --git a/src/services/account.js b/src/services/account.js index 874ad2e13..3d2d8043a 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -1215,7 +1215,10 @@ module.exports = class AccountHelper { attributes: ['id'], } ) - + let email = false + if (utils.isEmail(params.searchText)) { + email = params.searchText + } let users = await userQueries.listUsersFromView( role && role.id ? role.id : '', params.query.organization_id ? params.query.organization_id : '', @@ -1223,8 +1226,7 @@ module.exports = class AccountHelper { params.pageSize, params.searchText, params.body.user_ids ? params.body.user_ids : false, - params.body.email ? params.body.email : false, - params.body.name ? params.body.name : false + email ? email : false ) /* Required to resolve all promises first before preparing response object else sometime From 762d345144f374512c36de11031f7758bd751ee4 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 9 Jan 2024 17:55:41 +0530 Subject: [PATCH 066/109] Added Languages EntityType DataType Fix Migration --- ...0240109122038-fix-entity-type-data-type.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 src/database/migrations/20240109122038-fix-entity-type-data-type.js diff --git a/src/database/migrations/20240109122038-fix-entity-type-data-type.js b/src/database/migrations/20240109122038-fix-entity-type-data-type.js new file mode 100644 index 000000000..2f8942bf5 --- /dev/null +++ b/src/database/migrations/20240109122038-fix-entity-type-data-type.js @@ -0,0 +1,20 @@ +'use strict' + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + up: async (queryInterface, Sequelize) => { + await queryInterface.sequelize.query(` + UPDATE "entity_types" + SET "data_type" = 'ARRAY[STRING]' + WHERE "value" = 'languages'; + `) + }, + + down: async (queryInterface, Sequelize) => { + await queryInterface.sequelize.query(` + UPDATE "entity_types" + SET "data_type" = 'STRING' + WHERE "value" = 'languages'; + `) + }, +} From 0478021b41ff6ade2c2f72fa4d509efdc0acc12e Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 9 Jan 2024 18:10:01 +0530 Subject: [PATCH 067/109] Added Preferred Language EntityType And Entities Migration --- ...referred-languages-entity-type-entities.js | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 src/database/migrations/20240109123510-add-preferred-languages-entity-type-entities.js diff --git a/src/database/migrations/20240109123510-add-preferred-languages-entity-type-entities.js b/src/database/migrations/20240109123510-add-preferred-languages-entity-type-entities.js new file mode 100644 index 000000000..2a5700409 --- /dev/null +++ b/src/database/migrations/20240109123510-add-preferred-languages-entity-type-entities.js @@ -0,0 +1,66 @@ +'use strict' + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + up: async (queryInterface, Sequelize) => { + const defaultOrgId = queryInterface.sequelize.options.defaultOrgId + await queryInterface.bulkInsert( + 'entity_types', + [ + { + value: 'preferred_language', + label: 'Preferred Language', + created_by: 0, + updated_by: 0, + allow_filtering: true, + data_type: 'STRING', + organization_id: defaultOrgId, + parent_id: null, + allow_custom_entities: false, + has_entities: true, + model_names: ['User'], + created_at: new Date(), + updated_at: new Date(), + }, + ], + {} + ) + const [preferredLanguageEntityType] = await queryInterface.sequelize.query( + "SELECT id FROM entity_types WHERE value = 'preferred_language'" + ) + const preferredLanguageEntityTypeId = preferredLanguageEntityType[0].id + await queryInterface.bulkInsert( + 'entities', + [ + { + entity_type_id: preferredLanguageEntityTypeId, + value: 'en', + label: 'English', + status: 'ACTIVE', + type: 'SYSTEM', + created_by: 0, + updated_by: 0, + created_at: new Date(), + updated_at: new Date(), + }, + { + entity_type_id: preferredLanguageEntityTypeId, + value: 'hi', + label: 'Hindi', + status: 'ACTIVE', + type: 'SYSTEM', + created_by: 0, + updated_by: 0, + created_at: new Date(), + updated_at: new Date(), + }, + ], + {} + ) + }, + + down: async (queryInterface, Sequelize) => { + await queryInterface.bulkDelete('entities', { value: ['en', 'hi'] }) + await queryInterface.bulkDelete('entity_types', { value: 'preferred_language' }) + }, +} From ddfb088f7f983816d2318b70504ced5bbcf61f6c Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 9 Jan 2024 18:15:47 +0530 Subject: [PATCH 068/109] Fixed The EntityType Seeder --- .../seeders/20230802144103-add-entity-and-entity-types.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/database/seeders/20230802144103-add-entity-and-entity-types.js b/src/database/seeders/20230802144103-add-entity-and-entity-types.js index b7ea934e1..b3610ad04 100644 --- a/src/database/seeders/20230802144103-add-entity-and-entity-types.js +++ b/src/database/seeders/20230802144103-add-entity-and-entity-types.js @@ -149,8 +149,10 @@ module.exports = { if (key === 'location') { entityTypeRow.allow_custom_entities = false + entityTypeRow.data_type = 'STRING' } else { entityTypeRow.allow_custom_entities = true + entityTypeRow.data_type = 'ARRAY[STRING]' } return entityTypeRow }) From aa74cf16dca13d5e8bbc9211dc59d044db1c6672 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 9 Jan 2024 18:16:33 +0530 Subject: [PATCH 069/109] Made the Datafix Migration As Non-blocking As It Is Likely To Cause An Exception During Fresh Setup --- ...0240109122038-fix-entity-type-data-type.js | 28 ++++++++++++------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/database/migrations/20240109122038-fix-entity-type-data-type.js b/src/database/migrations/20240109122038-fix-entity-type-data-type.js index 2f8942bf5..f3f0921bd 100644 --- a/src/database/migrations/20240109122038-fix-entity-type-data-type.js +++ b/src/database/migrations/20240109122038-fix-entity-type-data-type.js @@ -3,18 +3,26 @@ /** @type {import('sequelize-cli').Migration} */ module.exports = { up: async (queryInterface, Sequelize) => { - await queryInterface.sequelize.query(` - UPDATE "entity_types" - SET "data_type" = 'ARRAY[STRING]' - WHERE "value" = 'languages'; - `) + try { + await queryInterface.sequelize.query(` + UPDATE "entity_types" + SET "data_type" = 'ARRAY[STRING]' + WHERE "value" = 'languages'; + `) + } catch (error) { + console.error('Error during migration:', error.message) + } }, down: async (queryInterface, Sequelize) => { - await queryInterface.sequelize.query(` - UPDATE "entity_types" - SET "data_type" = 'STRING' - WHERE "value" = 'languages'; - `) + try { + await queryInterface.sequelize.query(` + UPDATE "entity_types" + SET "data_type" = 'STRING' + WHERE "value" = 'languages'; + `) + } catch (error) { + console.error('Error during migration:', error.message) + } }, } From 51f6260f006521b80ad72b77d0ad07efd0cdc514 Mon Sep 17 00:00:00 2001 From: rakeshSgr Date: Tue, 9 Jan 2024 18:41:31 +0530 Subject: [PATCH 070/109] ansible fix --- deployment/ansible.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deployment/ansible.yml b/deployment/ansible.yml index 9313ec21c..87eee4af8 100644 --- a/deployment/ansible.yml +++ b/deployment/ansible.yml @@ -80,6 +80,9 @@ - name: Delete release folder shell: rm -rf {{ release_path }} + + - name: Run Migrations + command: "chdir={{current_path}}/src npx sequelize-cli db:migrate" - name: Start pm2 command: "chdir={{current_path}}/src pm2 start app.js -i 2 --name elevate-user" From d67fe201571301fbce99db2baa30f56790e3503b Mon Sep 17 00:00:00 2001 From: adithya_dinesh Date: Tue, 9 Jan 2024 19:28:07 +0530 Subject: [PATCH 071/109] user search with multiple emails --- src/database/queries/users.js | 15 ++++++++++----- src/generics/utils.js | 9 --------- src/middlewares/pagination.js | 2 +- src/services/account.js | 18 +++++++++++++----- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/database/queries/users.js b/src/database/queries/users.js index d7bc9a300..ee491419f 100644 --- a/src/database/queries/users.js +++ b/src/database/queries/users.js @@ -3,6 +3,7 @@ const database = require('@database/models/index') const Organization = require('@database/models/index').Organization const { Op, QueryTypes } = require('sequelize') const Sequelize = require('@database/models/index').sequelize +const emailEncryption = require('@utils/emailEncryption') exports.getColumns = async () => { try { @@ -165,14 +166,14 @@ exports.findUserWithOrganization = async (filter, options = {}) => { return error } } -exports.listUsersFromView = async (roleId, organization_id, page, limit, search, userIds, email) => { +exports.listUsersFromView = async (roleId, organization_id, page, limit, search, userIds, emailIds) => { try { const offset = (page - 1) * limit const filterConditions = [] - if (email) { - filterConditions.push(`users.email ILIKE :email`) + if (emailIds) { + filterConditions.push(`users.email IN ('${emailIds.join("','")}')`) } else if (search) { filterConditions.push(`users.name ILIKE :search`) } @@ -225,14 +226,18 @@ exports.listUsersFromView = async (roleId, organization_id, page, limit, search, offset: parseInt(offset, 10), limit: parseInt(limit, 10), userIds: userIds, - email: email, } - const users = await Sequelize.query(filterQuery, { + let users = await Sequelize.query(filterQuery, { type: QueryTypes.SELECT, replacements: replacements, }) + users = users.filter((user) => { + user.email = emailEncryption.decrypt(user.email) + return user + }) + return { count: users.length, data: users } } catch (error) { throw error diff --git a/src/generics/utils.js b/src/generics/utils.js index 420a8ea45..8316c5bfe 100644 --- a/src/generics/utils.js +++ b/src/generics/utils.js @@ -428,14 +428,6 @@ const generateWhereClause = (tableName) => { return whereClause } -function isEmail(input) { - // Regular expression for matching email addresses - const emailRegex = /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/ - - // Test the input string against the email regex - return emailRegex.test(input) -} - module.exports = { generateToken, hashPassword, @@ -465,5 +457,4 @@ module.exports = { isValidEmail, isValidName, generateWhereClause, - isEmail, } diff --git a/src/middlewares/pagination.js b/src/middlewares/pagination.js index fffd8efc5..66590a997 100644 --- a/src/middlewares/pagination.js +++ b/src/middlewares/pagination.js @@ -7,7 +7,7 @@ const common = require('@constants/common') const httpStatus = require('@generics/http-status') function containsSpecialChars(str) { - const specialChars = /[`!#$%^&*()_+\-=\[\]{};':"\\|,<>\/?~]/ + const specialChars = /[`!#$%^&*()_+\-=\[\]{};':"\\|<>\/?~]/ return specialChars.test(str) } module.exports = (req, res, next) => { diff --git a/src/services/account.js b/src/services/account.js index acb0d0032..d7a363551 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -1126,18 +1126,26 @@ module.exports = class AccountHelper { attributes: ['id'], } ) - let email = false - if (utils.isEmail(params.searchText)) { - email = params.searchText + let emailIds = [] + let searchText = [] + + if (params.searchText) { + searchText = params.searchText.split(',') } + searchText.forEach((element) => { + if (utils.isValidEmail(element)) { + emailIds.push(emailEncryption.encrypt(element.toLowerCase())) + } + }) + let users = await userQueries.listUsersFromView( role && role.id ? role.id : '', params.query.organization_id ? params.query.organization_id : '', params.pageNo, params.pageSize, - params.searchText, + emailIds.length == 0 ? params.searchText : false, params.body.user_ids ? params.body.user_ids : false, - email ? email : false + emailIds.length > 0 ? emailIds : false ) /* Required to resolve all promises first before preparing response object else sometime From 92fc838d0b77368f57aec63b454fcce946a621d8 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Wed, 10 Jan 2024 11:55:00 +0530 Subject: [PATCH 072/109] Added Email Encryption Migration --- .../20240110052934-encrypt-emails.js | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/database/migrations/20240110052934-encrypt-emails.js diff --git a/src/database/migrations/20240110052934-encrypt-emails.js b/src/database/migrations/20240110052934-encrypt-emails.js new file mode 100644 index 000000000..e8fec6fcc --- /dev/null +++ b/src/database/migrations/20240110052934-encrypt-emails.js @@ -0,0 +1,76 @@ +// Migration for encrypting and decrypting emails + +'use strict' + +const emailEncryption = require('../../utils/emailEncryption') +const { Sequelize } = require('sequelize') + +module.exports = { + up: async (queryInterface, Sequelize) => { + await processTable(queryInterface, 'organization_user_invites', 'encrypt') + await processTable(queryInterface, 'users', 'encrypt') + await processTable(queryInterface, 'users_credentials', 'encrypt') + }, + + down: async (queryInterface, Sequelize) => { + await processTable(queryInterface, 'organization_user_invites', 'decrypt') + await processTable(queryInterface, 'users', 'decrypt') + await processTable(queryInterface, 'users_credentials', 'decrypt') + }, +} + +const processTable = async (queryInterface, tableName, operation) => { + const greenColor = '\x1b[32m' + const yellowColor = '\x1b[33m' + const resetColor = '\x1b[0m' + const redColor = '\x1b[31m' + + const records = await queryInterface.sequelize.query(`SELECT * FROM ${tableName};`, { + type: Sequelize.QueryTypes.SELECT, + }) + + const updates = records.map(async (record) => { + const isEmailValid = validateEmail(record.email) + + if (operation === 'encrypt') { + if (isEmailValid) { + const encryptedEmail = emailEncryption.encrypt(record.email) + await queryInterface.sequelize.query( + `UPDATE ${tableName} SET email = '${encryptedEmail}' WHERE id = ${record.id};` + ) + } else { + console.warn( + `${redColor}Skipping encryption of invalid email in ${yellowColor}${tableName}${resetColor} table with id ${yellowColor}${record.id}${resetColor}: ${yellowColor}${record.email}${resetColor}` + ) + } + } else if (operation === 'decrypt') { + if (!isEmailValid) { + const decryptedEmail = emailEncryption.decrypt(record.email) + const isDecryptedEmailValid = validateEmail(decryptedEmail) + if (isDecryptedEmailValid) { + await queryInterface.sequelize.query( + `UPDATE ${tableName} SET email = '${decryptedEmail}' WHERE id = ${record.id};` + ) + } else { + console.warn( + `${redColor}Skipping decryption of email in ${yellowColor}${tableName}${resetColor} table with id ${yellowColor}${record.id}${resetColor} because decrypted emailId wasn't a valid emailId.${resetColor}` + ) + } + } else { + console.warn( + `${redColor}Skipping decryption of email in ${yellowColor}${tableName}${resetColor} table with id ${yellowColor}${record.id}${resetColor} because current emailId is in valid emailId format.${resetColor}` + ) + } + } + }) + + await Promise.all(updates) + console.log( + `${greenColor}Finished processing ${resetColor}${yellowColor}${tableName}${resetColor} ${greenColor}table.${resetColor}\n` + ) +} + +const validateEmail = (email) => { + const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/ + return emailRegex.test(email) +} From 46603780d9a8f240f5d1d44017a4257db24c7d19 Mon Sep 17 00:00:00 2001 From: rakeshSgr Date: Wed, 10 Jan 2024 12:05:12 +0530 Subject: [PATCH 073/109] ansible fix --- deployment/ansible.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deployment/ansible.yml b/deployment/ansible.yml index 87eee4af8..c3c832567 100644 --- a/deployment/ansible.yml +++ b/deployment/ansible.yml @@ -57,6 +57,9 @@ # src={{ release_path }} # dest={{ current_path }} # state=link + + - name: Run Migrations + command: "chdir={{current_path}}/src npx sequelize-cli db:migrate" - name: Delete old pm2 process command: pm2 delete elevate-user @@ -80,9 +83,6 @@ - name: Delete release folder shell: rm -rf {{ release_path }} - - - name: Run Migrations - command: "chdir={{current_path}}/src npx sequelize-cli db:migrate" - name: Start pm2 command: "chdir={{current_path}}/src pm2 start app.js -i 2 --name elevate-user" From de3cf325d4563f26b1d19f241eafb3c4127be485 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Wed, 10 Jan 2024 12:36:08 +0530 Subject: [PATCH 074/109] Added 2.6.0 Release Note File --- release-notes/2.6.0.md | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 release-notes/2.6.0.md diff --git a/release-notes/2.6.0.md b/release-notes/2.6.0.md new file mode 100644 index 000000000..feca2dcd9 --- /dev/null +++ b/release-notes/2.6.0.md @@ -0,0 +1,59 @@ +# Elevate-User Service Release Note + +## Version: 2.6.0 + +### New Features: + +1. **Encrypted storage of Email Ids in Database:** + + - All emails will be stored in an encrypted format with aes-256-cbc encryption algorithm. + - Affected tables: **users**, **users_credentials** and **organization_user_invites**. + - Added migration to automatically encrypt existing email Ids in deployed databases. + - Added script to encrypt/decrypt emails without running migrations. + + **Steps to enable email Id encryption:** + + - Navigate to the src/scripts directory. + - Run the generateEncryptionKeys.js script + + ``` + src/scripts$ node generateEncyrptionKeys.js + Email Id Encryption Key: f3f079bf7f3d215805722cc43131ddf7b25bbe0d6a455945fb10cfc90f9c1e2b + Email Id Encryption IV: 0deef78e20868f278af00903236227e5 + ``` + + - Add following env keys to the .env file (source the keys from script output as shown above) + + ``` + EMAIL_ID_ENCRYPTION_KEY=f3f079bf7f3d215805722cc43131ddf7b25bbe0d6a455945fb10cfc90f9c1e2b + EMAIL_ID_ENCRYPTION_IV=0deef78e20868f278af00903236227e5 + EMAIL_ID_ENCRYPTION_ALGORITHM='aes-256-cbc' + ``` + + - Encryption + + - Using migration + ``` + src$ npx sequelize-cli db:migrate + ``` + - Using standalone script + - Navigate to the scripts directory and run the following command + ``` + src/scripts$ node encryptDecryptEmails.js encrypt + ``` + - In-order to decrypt the email Ids, run: + ``` + src/scripts$ node encryptDecryptEmails.js decrypt + ``` + +### Enhancements: + +### Bug Fixes: + +### Infrastructure: + +### Documentation: + +### Deprecation Notice: + +### Known Issues: From 041b6310cfcc64e9317063a3a018a8ae10bd89dd Mon Sep 17 00:00:00 2001 From: rakeshSgr Date: Wed, 10 Jan 2024 14:26:45 +0530 Subject: [PATCH 075/109] ansible fix --- deployment/ansible.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/deployment/ansible.yml b/deployment/ansible.yml index c3c832567..db29f885c 100644 --- a/deployment/ansible.yml +++ b/deployment/ansible.yml @@ -58,13 +58,6 @@ # dest={{ current_path }} # state=link - - name: Run Migrations - command: "chdir={{current_path}}/src npx sequelize-cli db:migrate" - - - name: Delete old pm2 process - command: pm2 delete elevate-user - ignore_errors: yes - - name: set permission shell: chmod 744 {{ current_path }}/src/scripts/json2env.sh @@ -81,6 +74,14 @@ register: apiDocResponse - debug: msg=" Api-doc {{ apiDocResponse }} " + + - name: Run Migrations + command: "chdir={{current_path}}/src npx sequelize-cli db:migrate" + + - name: Delete old pm2 process + command: pm2 delete elevate-user + ignore_errors: yes + - name: Delete release folder shell: rm -rf {{ release_path }} From b13b736393771601b326836fda6faaba315d8d4b Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Wed, 10 Jan 2024 18:39:08 +0530 Subject: [PATCH 076/109] Removed Encrypted Email From Output CSV --- src/services/userInvite.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/services/userInvite.js b/src/services/userInvite.js index 9f79ff2a5..782368ce4 100644 --- a/src/services/userInvite.js +++ b/src/services/userInvite.js @@ -219,7 +219,7 @@ module.exports = class UserInviteHelper { //convert the fields to lower case invitee.roles = invitee.roles.toLowerCase() invitee.email = invitee.email.toLowerCase() - invitee.encryptedEmail = emailEncryption.encrypt(invitee.email.toLowerCase()) + const encryptedEmail = emailEncryption.encrypt(invitee.email.toLowerCase()) //validate the fields if (!utils.isValidName(invitee.name)) { @@ -241,7 +241,7 @@ module.exports = class UserInviteHelper { } //update user details if the user exist and in default org - const existingUser = existingEmailsMap.get(invitee.encryptedEmail) + const existingUser = existingEmailsMap.get(encryptedEmail) if (existingUser) { invitee.statusOrUserId = 'USER_ALREADY_EXISTS' @@ -275,13 +275,13 @@ module.exports = class UserInviteHelper { if (isOrgUpdate || userUpdateData.roles) { const userCredentials = await UserCredentialQueries.findOne({ - email: invitee.encryptedEmail, + email: encryptedEmail, }) await userQueries.updateUser({ id: userCredentials.user_id }, userUpdateData) await UserCredentialQueries.updateUser( { - email: invitee.encryptedEmail, + email: encryptedEmail, }, { organization_id: user.organization_id } ) @@ -319,9 +319,9 @@ module.exports = class UserInviteHelper { file_id: fileUploadId, roles: roleTitlesToIds[invitee.roles] || [], } - inviteeData.email = inviteeData.encryptedEmail + inviteeData.email = encryptedEmail - if (existingInvitees.hasOwnProperty(invitee.encryptedEmail)) { + if (existingInvitees.hasOwnProperty(encryptedEmail)) { invitee.statusOrUserId = 'USER_ALREADY_EXISTS' input.push(invitee) continue From 9abc5073580a8eaa0efc69aab6acf8f09569e38e Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Thu, 11 Jan 2024 15:22:31 +0530 Subject: [PATCH 077/109] Fix For Single Select Entity Type --- src/generics/utils.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/generics/utils.js b/src/generics/utils.js index 3c7253870..1bea81ece 100644 --- a/src/generics/utils.js +++ b/src/generics/utils.js @@ -306,7 +306,10 @@ function processDbResponse(responseBody, entityType) { value: entity.value, label: entity.label, })) - if (matchingValues.length > 0) output[key] = Array.isArray(output[key]) ? matchingValues : matchingValues[0] + if (matchingValues.length > 0) + output[key] = Array.isArray(output[key]) + ? matchingValues + : matchingValues.find((entity) => entity.value === output[key]) else if (Array.isArray(output[key])) output[key] = output[key].filter((item) => item.value && item.label) } From 955c4c0713f54bf5cd8152cbc9e4f9b9cd7a8482 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Thu, 11 Jan 2024 17:08:23 +0530 Subject: [PATCH 078/109] Migration Fix For Email Encryption --- .../20240110052934-encrypt-emails.js | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/database/migrations/20240110052934-encrypt-emails.js b/src/database/migrations/20240110052934-encrypt-emails.js index e8fec6fcc..0978e5d12 100644 --- a/src/database/migrations/20240110052934-encrypt-emails.js +++ b/src/database/migrations/20240110052934-encrypt-emails.js @@ -35,9 +35,20 @@ const processTable = async (queryInterface, tableName, operation) => { if (operation === 'encrypt') { if (isEmailValid) { const encryptedEmail = emailEncryption.encrypt(record.email) - await queryInterface.sequelize.query( - `UPDATE ${tableName} SET email = '${encryptedEmail}' WHERE id = ${record.id};` - ) + if (tableName === 'users_credentials') { + const existingRow = await queryInterface.sequelize.query( + `SELECT * FROM ${tableName} WHERE id = ${record.id};`, + { + type: Sequelize.QueryTypes.SELECT, + } + ) + await queryInterface.sequelize.query(`DELETE FROM ${tableName} WHERE id = ${record.id};`) + const modifiedRow = { ...existingRow[0], email: encryptedEmail } + await queryInterface.bulkInsert(tableName, [modifiedRow]) + } else + await queryInterface.sequelize.query( + `UPDATE ${tableName} SET email = '${encryptedEmail}' WHERE id = ${record.id};` + ) } else { console.warn( `${redColor}Skipping encryption of invalid email in ${yellowColor}${tableName}${resetColor} table with id ${yellowColor}${record.id}${resetColor}: ${yellowColor}${record.email}${resetColor}` @@ -48,9 +59,20 @@ const processTable = async (queryInterface, tableName, operation) => { const decryptedEmail = emailEncryption.decrypt(record.email) const isDecryptedEmailValid = validateEmail(decryptedEmail) if (isDecryptedEmailValid) { - await queryInterface.sequelize.query( - `UPDATE ${tableName} SET email = '${decryptedEmail}' WHERE id = ${record.id};` - ) + if (tableName === 'users_credentials') { + const existingRow = await queryInterface.sequelize.query( + `SELECT * FROM ${tableName} WHERE id = ${record.id};`, + { + type: Sequelize.QueryTypes.SELECT, + } + ) + await queryInterface.sequelize.query(`DELETE FROM ${tableName} WHERE id = ${record.id};`) + const modifiedRow = { ...existingRow[0], email: decryptedEmail } + await queryInterface.bulkInsert(tableName, [modifiedRow]) + } else + await queryInterface.sequelize.query( + `UPDATE ${tableName} SET email = '${decryptedEmail}' WHERE id = ${record.id};` + ) } else { console.warn( `${redColor}Skipping decryption of email in ${yellowColor}${tableName}${resetColor} table with id ${yellowColor}${record.id}${resetColor} because decrypted emailId wasn't a valid emailId.${resetColor}` From 64af0a20649c744f86d268e1f2f29d8e8fcef02f Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Thu, 11 Jan 2024 19:14:56 +0530 Subject: [PATCH 079/109] Added Transcation Rollbacks --- .../20240110052934-encrypt-emails.js | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/database/migrations/20240110052934-encrypt-emails.js b/src/database/migrations/20240110052934-encrypt-emails.js index 0978e5d12..680c38ac9 100644 --- a/src/database/migrations/20240110052934-encrypt-emails.js +++ b/src/database/migrations/20240110052934-encrypt-emails.js @@ -60,15 +60,24 @@ const processTable = async (queryInterface, tableName, operation) => { const isDecryptedEmailValid = validateEmail(decryptedEmail) if (isDecryptedEmailValid) { if (tableName === 'users_credentials') { - const existingRow = await queryInterface.sequelize.query( - `SELECT * FROM ${tableName} WHERE id = ${record.id};`, - { - type: Sequelize.QueryTypes.SELECT, - } - ) - await queryInterface.sequelize.query(`DELETE FROM ${tableName} WHERE id = ${record.id};`) - const modifiedRow = { ...existingRow[0], email: decryptedEmail } - await queryInterface.bulkInsert(tableName, [modifiedRow]) + const t = await queryInterface.sequelize.transaction() + try { + const existingRow = await queryInterface.sequelize.query( + `SELECT * FROM ${tableName} WHERE id = ${record.id};`, + { + type: Sequelize.QueryTypes.SELECT, + transaction: t, + } + ) + await queryInterface.sequelize.query(`DELETE FROM ${tableName} WHERE id = ${record.id};`, { + transaction: t, + }) + const modifiedRow = { ...existingRow[0], email: decryptedEmail } + await queryInterface.bulkInsert(tableName, [modifiedRow], { transaction: t }) + await t.commit() + } catch (error) { + await t.rollback() + } } else await queryInterface.sequelize.query( `UPDATE ${tableName} SET email = '${decryptedEmail}' WHERE id = ${record.id};` From b5eb129aacfe79e396fd53bcaf1c476a3ae30f7e Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Thu, 11 Jan 2024 19:20:00 +0530 Subject: [PATCH 080/109] Added console log --- src/database/migrations/20240110052934-encrypt-emails.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/database/migrations/20240110052934-encrypt-emails.js b/src/database/migrations/20240110052934-encrypt-emails.js index 680c38ac9..33416915a 100644 --- a/src/database/migrations/20240110052934-encrypt-emails.js +++ b/src/database/migrations/20240110052934-encrypt-emails.js @@ -76,6 +76,7 @@ const processTable = async (queryInterface, tableName, operation) => { await queryInterface.bulkInsert(tableName, [modifiedRow], { transaction: t }) await t.commit() } catch (error) { + console.log('ENCRYPTION ERROR: ', error) await t.rollback() } } else From 7504c6da0fda731672500b406788e149bca78c57 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Thu, 11 Jan 2024 19:59:26 +0530 Subject: [PATCH 081/109] Fixed Migration - Ignores Offending Rows --- .../20240110052934-encrypt-emails.js | 94 +++++++++++-------- 1 file changed, 56 insertions(+), 38 deletions(-) diff --git a/src/database/migrations/20240110052934-encrypt-emails.js b/src/database/migrations/20240110052934-encrypt-emails.js index 33416915a..0c41128fc 100644 --- a/src/database/migrations/20240110052934-encrypt-emails.js +++ b/src/database/migrations/20240110052934-encrypt-emails.js @@ -36,15 +36,25 @@ const processTable = async (queryInterface, tableName, operation) => { if (isEmailValid) { const encryptedEmail = emailEncryption.encrypt(record.email) if (tableName === 'users_credentials') { - const existingRow = await queryInterface.sequelize.query( - `SELECT * FROM ${tableName} WHERE id = ${record.id};`, - { - type: Sequelize.QueryTypes.SELECT, - } - ) - await queryInterface.sequelize.query(`DELETE FROM ${tableName} WHERE id = ${record.id};`) - const modifiedRow = { ...existingRow[0], email: encryptedEmail } - await queryInterface.bulkInsert(tableName, [modifiedRow]) + const t = await queryInterface.sequelize.transaction() + try { + const existingRow = await queryInterface.sequelize.query( + `SELECT * FROM ${tableName} WHERE id = ${record.id};`, + { + type: Sequelize.QueryTypes.SELECT, + transaction: t, + } + ) + await queryInterface.sequelize.query(`DELETE FROM ${tableName} WHERE id = ${record.id};`, { + transaction: t, + }) + const modifiedRow = { ...existingRow[0], email: encryptedEmail } + await queryInterface.bulkInsert(tableName, [modifiedRow], { transaction: t }) + await t.commit() + } catch (error) { + console.log('ENCRYPTION ERROR: ', error) + await t.rollback() + } } else await queryInterface.sequelize.query( `UPDATE ${tableName} SET email = '${encryptedEmail}' WHERE id = ${record.id};` @@ -56,37 +66,45 @@ const processTable = async (queryInterface, tableName, operation) => { } } else if (operation === 'decrypt') { if (!isEmailValid) { - const decryptedEmail = emailEncryption.decrypt(record.email) - const isDecryptedEmailValid = validateEmail(decryptedEmail) - if (isDecryptedEmailValid) { - if (tableName === 'users_credentials') { - const t = await queryInterface.sequelize.transaction() - try { - const existingRow = await queryInterface.sequelize.query( - `SELECT * FROM ${tableName} WHERE id = ${record.id};`, - { - type: Sequelize.QueryTypes.SELECT, - transaction: t, - } + try { + const decryptedEmail = emailEncryption.decrypt(record.email) + const isDecryptedEmailValid = validateEmail(decryptedEmail) + if (isDecryptedEmailValid) { + if (tableName === 'users_credentials') { + const t = await queryInterface.sequelize.transaction() + try { + const existingRow = await queryInterface.sequelize.query( + `SELECT * FROM ${tableName} WHERE id = ${record.id};`, + { + type: Sequelize.QueryTypes.SELECT, + transaction: t, + } + ) + await queryInterface.sequelize.query( + `DELETE FROM ${tableName} WHERE id = ${record.id};`, + { + transaction: t, + } + ) + const modifiedRow = { ...existingRow[0], email: decryptedEmail } + await queryInterface.bulkInsert(tableName, [modifiedRow], { transaction: t }) + await t.commit() + } catch (error) { + console.log('DECRYPTION ERROR: ', error) + await t.rollback() + } + } else + await queryInterface.sequelize.query( + `UPDATE ${tableName} SET email = '${decryptedEmail}' WHERE id = ${record.id};` ) - await queryInterface.sequelize.query(`DELETE FROM ${tableName} WHERE id = ${record.id};`, { - transaction: t, - }) - const modifiedRow = { ...existingRow[0], email: decryptedEmail } - await queryInterface.bulkInsert(tableName, [modifiedRow], { transaction: t }) - await t.commit() - } catch (error) { - console.log('ENCRYPTION ERROR: ', error) - await t.rollback() - } - } else - await queryInterface.sequelize.query( - `UPDATE ${tableName} SET email = '${decryptedEmail}' WHERE id = ${record.id};` + } else { + console.warn( + `${redColor}Skipping decryption of email in ${yellowColor}${tableName}${resetColor} table with id ${yellowColor}${record.id}${resetColor} because decrypted emailId wasn't a valid emailId.${resetColor}` ) - } else { - console.warn( - `${redColor}Skipping decryption of email in ${yellowColor}${tableName}${resetColor} table with id ${yellowColor}${record.id}${resetColor} because decrypted emailId wasn't a valid emailId.${resetColor}` - ) + } + } catch (error) { + console.log('Something went wrong: ', error) + console.log('EMAIL: ', record.email) } } else { console.warn( From 5eb4f2ad1c643d762f3e030e6d45c3099180b290 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Fri, 12 Jan 2024 18:12:38 +0530 Subject: [PATCH 082/109] New APi default list --- src/constants/common.js | 4 +++- src/controllers/v1/userRole.js | 9 +++++++ src/services/userRole.js | 43 ++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/src/constants/common.js b/src/constants/common.js index 84b729162..4531a7df9 100644 --- a/src/constants/common.js +++ b/src/constants/common.js @@ -50,7 +50,7 @@ module.exports = { '/user/v1/account/registrationOtp', '/user/v1/account/resetPassword', '/user/v1/admin/login', - '/user/v1/userRole/list', + , ], internalAccessUrls: [ '/user/v1/profile/details', @@ -63,6 +63,8 @@ module.exports = { '/user/v1/admin/triggerPeriodicViewRefreshInternal', '/user/v1/account/search', '/user/v1/organization/list', + '/user/v1/userRole/default', + '/user/v1/userRole/list', ], notificationEmailType: 'email', accessTokenExpiry: `${process.env.ACCESS_TOKEN_EXPIRY}d`, diff --git a/src/controllers/v1/userRole.js b/src/controllers/v1/userRole.js index e776f9a1e..b1e5c8cce 100644 --- a/src/controllers/v1/userRole.js +++ b/src/controllers/v1/userRole.js @@ -85,4 +85,13 @@ module.exports = class userRole { return error } } + + async default(req) { + try { + const defaultRoleList = await roleService.defaultList(req.query, req.pageNo, req.pageSize, req.searchText) + return defaultRoleList + } catch (error) { + return error + } + } } diff --git a/src/services/userRole.js b/src/services/userRole.js index 6aeccc110..f4394448b 100644 --- a/src/services/userRole.js +++ b/src/services/userRole.js @@ -171,4 +171,47 @@ module.exports = class userRoleHelper { throw error } } + + static async defaultList(filters, page, limit, search) { + try { + delete filters.search + const offset = common.getPaginationOffset(page, limit) + const options = { + offset, + limit, + } + let defaultOrg = await organizationQueries.findOne( + { code: process.env.DEFAULT_ORGANISATION_CODE }, + { attributes: ['id'] } + ) + let defaultOrgId = defaultOrg.id + const filter = { + organization_id: defaultOrgId, + title: { [Op.iLike]: `%${search}%` }, + ...filters, + } + const attributes = ['id', 'title', 'user_type', 'visibility', 'status', 'organization_id'] + const roles = await roleQueries.findAllRoles(filter, attributes, options) + + if (roles.rows == 0 || roles.count == 0) { + return common.failureResponse({ + message: 'ROLES_HAS_EMPTY_LIST', + statusCode: httpStatusCode.bad_request, + responseCode: 'CLIENT_ERROR', + }) + } + const results = { + data: roles.rows, + count: roles.count, + } + + return common.successResponse({ + statusCode: httpStatusCode.ok, + message: 'ROLES_FETCHED_SUCCESSFULLY', + result: results, + }) + } catch (error) { + throw error + } + } } From ce505c99d17dff4f409229d97e966c4288e1f5fb Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Fri, 12 Jan 2024 19:30:32 +0530 Subject: [PATCH 083/109] DefaultList API DOC AND COLLECTION --- .../MentorED-Users.postman_collection.json | 57 ++++++++++++++++++- src/api-doc/api-doc.yaml | 17 ++++++ src/constants/common.js | 1 - src/controllers/v1/userRole.js | 21 +++++++ .../userRole/userRole.spec.js | 10 ++++ src/services/userRole.js | 11 ++++ src/validators/v1/userRole.js | 5 ++ 7 files changed, 119 insertions(+), 3 deletions(-) diff --git a/src/api-doc/MentorED-Users.postman_collection.json b/src/api-doc/MentorED-Users.postman_collection.json index e64b4323b..4e61e8434 100644 --- a/src/api-doc/MentorED-Users.postman_collection.json +++ b/src/api-doc/MentorED-Users.postman_collection.json @@ -1,10 +1,10 @@ { "info": { - "_postman_id": "6e5cb5db-0364-4c41-b8bf-09689233f1f9", + "_postman_id": "4b5d5720-bd48-4145-afb9-8661f40c17e5", "name": "MentorED-Users", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "24204448", - "_collection_link": "https://dark-astronaut-764227.postman.co/workspace/Elevate-Workspace~39b977d8-9e5b-4232-87f3-3da4bed3a67c/collection/24204448-6e5cb5db-0364-4c41-b8bf-09689233f1f9?action=share&source=collection_link&creator=24204448" + "_collection_link": "https://dark-astronaut-764227.postman.co/workspace/Elevate-Workspace~39b977d8-9e5b-4232-87f3-3da4bed3a67c/collection/24204448-4b5d5720-bd48-4145-afb9-8661f40c17e5?action=share&source=collection_link&creator=24204448" }, "item": [ { @@ -1676,6 +1676,59 @@ }, "response": [] }, + { + "name": "Default List User Roles", + "request": { + "method": "GET", + "header": [ + { + "key": "X-auth-token", + "value": "bearer {{token}}", + "type": "text" + } + ], + "url": { + "raw": "{{UserDevBaseUrl}}user/v1/userRole/default?page=1&limit=10&search=a", + "host": ["{{UserDevBaseUrl}}user"], + "path": ["v1", "userRole", "default"], + "query": [ + { + "key": "page", + "value": "1" + }, + { + "key": "limit", + "value": "10" + }, + { + "key": "search", + "value": "a" + }, + { + "key": "organization_id", + "value": "1", + "disabled": true + }, + { + "key": "user_type", + "value": "2", + "disabled": true + }, + { + "key": "visibility", + "value": "PUBLIC", + "disabled": true + }, + { + "key": "status", + "value": "ACTIVE", + "disabled": true + } + ] + } + }, + "response": [] + }, { "name": "Create Roles", "request": { diff --git a/src/api-doc/api-doc.yaml b/src/api-doc/api-doc.yaml index 06a2752cb..f7c9fa7c6 100644 --- a/src/api-doc/api-doc.yaml +++ b/src/api-doc/api-doc.yaml @@ -2629,6 +2629,23 @@ paths: meta: formsVersion: [] correlation: 645c901e-a7db-49a3-8d4c-dfc4f0b6dadb + /user/v1/userRole/default: + get: + summary: Get User Default Roles + tags: + description: > + Retrieve the list of user roles. + + + - Endpoint: `/user/v1/userRole/default` + + - It is mandatory to provide values for parameters marked as `required`. + + - The X-auth-token obtained from the login API is required in the + header. + parameters: + responses: + requestBody: components: schemas: user: diff --git a/src/constants/common.js b/src/constants/common.js index 4531a7df9..4a5981e76 100644 --- a/src/constants/common.js +++ b/src/constants/common.js @@ -50,7 +50,6 @@ module.exports = { '/user/v1/account/registrationOtp', '/user/v1/account/resetPassword', '/user/v1/admin/login', - , ], internalAccessUrls: [ '/user/v1/profile/details', diff --git a/src/controllers/v1/userRole.js b/src/controllers/v1/userRole.js index b1e5c8cce..28c7cd4a2 100644 --- a/src/controllers/v1/userRole.js +++ b/src/controllers/v1/userRole.js @@ -71,6 +71,17 @@ module.exports = class userRole { } } + /** + * Get all available roles. + * @method + * @name defaultlist + * @param {Array(String)} req.body.filters - Filters. + * @param {String} req.pageNo - Page number. + * @param {String} req.pageSize - Page size limit. + * @param {String} req.searchText - Search text. + * @param {Integer} req.decodedToken.organization_id - user organization_id. + * @returns {JSON} - Role list. + */ async list(req) { try { const roleList = await roleService.list( @@ -86,6 +97,16 @@ module.exports = class userRole { } } + /** + * Get all available roles. + * @method + * @name default + * @param {Array(String)} req.body.filters - Filters. + * @param {String} req.pageNo - Page number. + * @param {String} req.pageSize - Page size limit. + * @param {String} req.searchText - Search text. + * @returns {JSON} - Role list. + */ async default(req) { try { const defaultRoleList = await roleService.defaultList(req.query, req.pageNo, req.pageSize, req.searchText) diff --git a/src/integration-test/userRole/userRole.spec.js b/src/integration-test/userRole/userRole.spec.js index 17a6fd260..ec9d589fe 100644 --- a/src/integration-test/userRole/userRole.spec.js +++ b/src/integration-test/userRole/userRole.spec.js @@ -52,4 +52,14 @@ describe('/user/v1/userRole', function () { expect(res.statusCode).toBe(200) expect(res.body).toMatchSchema(responseSchema.listSchema) }) + + it('/default', async () => { + let res = await request + .get('/user/v1/userRole/default') + .query({ page: 1, limit: 10, code: 'system', organization_id: 1 }) + + logError(res) + expect(res.statusCode).toBe(200) + expect(res.body).toMatchSchema(responseSchema.listSchema) + }) }) diff --git a/src/services/userRole.js b/src/services/userRole.js index f4394448b..264702815 100644 --- a/src/services/userRole.js +++ b/src/services/userRole.js @@ -126,6 +126,7 @@ module.exports = class userRoleHelper { * @param {String} req.pageNo - Page number. * @param {String} req.pageSize - Page size limit. * @param {String} req.searchText - Search text. + * @param {Integer} req.decodedToken.organization_id - user organization_id. * @returns {JSON} - Role list. */ @@ -172,6 +173,16 @@ module.exports = class userRoleHelper { } } + /** + * Get all available roles. + * @method + * @name defaultlist + * @param {Array(String)} req.body.filters - Filters. + * @param {String} req.pageNo - Page number. + * @param {String} req.pageSize - Page size limit. + * @param {String} req.searchText - Search text. + * @returns {JSON} - Role list. + */ static async defaultList(filters, page, limit, search) { try { delete filters.search diff --git a/src/validators/v1/userRole.js b/src/validators/v1/userRole.js index 71e955f16..db654cb72 100644 --- a/src/validators/v1/userRole.js +++ b/src/validators/v1/userRole.js @@ -80,4 +80,9 @@ module.exports = { const allowedVariables = ['title', 'user_type', 'visibility', 'organization_id', 'status'] validateList(req, allowedVariables) }, + + default: (req) => { + const allowedVariables = ['title', 'user_type', 'visibility', 'organization_id', 'status'] + validateList(req, allowedVariables) + }, } From 37f8f5081631a65648afc3b01bc8b39ee3758da1 Mon Sep 17 00:00:00 2001 From: "priyanka@TL" Date: Sun, 14 Jan 2024 10:00:31 +0530 Subject: [PATCH 084/109] added session manger role in sample csv --- src/sample.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sample.csv b/src/sample.csv index 98b1e86ee..af92aa785 100644 --- a/src/sample.csv +++ b/src/sample.csv @@ -1,3 +1,4 @@ name,email,roles Sarah,sarah@tunerlabs.com,mentee John,john@tunerlabs.com,mentor +Pradeep,pradeep@tunerlabs.com,session_manager From c78ece0e69cd6dcb9c20e7c6968918684e520a82 Mon Sep 17 00:00:00 2001 From: Nevil Date: Tue, 16 Jan 2024 17:54:35 +0530 Subject: [PATCH 085/109] updated search to handle multiple roles --- src/database/queries/users.js | 5 ++++- src/services/account.js | 11 +++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/database/queries/users.js b/src/database/queries/users.js index ee491419f..bfbbd1f8f 100644 --- a/src/database/queries/users.js +++ b/src/database/queries/users.js @@ -178,8 +178,11 @@ exports.listUsersFromView = async (roleId, organization_id, page, limit, search, filterConditions.push(`users.name ILIKE :search`) } - if (roleId) { + if (!Array.isArray(roleId)) { filterConditions.push(`users.roles @> ARRAY[:roleId]::integer[]`) + } else { + // If roleId is an array, use the '&&' operator to check if there is an overlap between roleId and users.roles arrays + filterConditions.push(`ARRAY[:roleId] && users.roles`) } if (organization_id) { diff --git a/src/services/account.js b/src/services/account.js index d7a363551..d68b06e6a 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -1120,13 +1120,16 @@ module.exports = class AccountHelper { */ static async search(params) { try { - let role = await roleQueries.findOne( - { title: params.query.type.toLowerCase() }, + const types = params.query.type.toLowerCase().split(',') + const roles = await roleQueries.findAll( + { title: types }, { attributes: ['id'], } ) - let emailIds = [] + + const roleIds = roles.map((role) => role.id) + let searchText = [] if (params.searchText) { @@ -1139,7 +1142,7 @@ module.exports = class AccountHelper { }) let users = await userQueries.listUsersFromView( - role && role.id ? role.id : '', + roleIds ? roleIds : [], params.query.organization_id ? params.query.organization_id : '', params.pageNo, params.pageSize, From ffad89888f5a6116a9f20e3fbdf91b84569dccb7 Mon Sep 17 00:00:00 2001 From: Nevil Date: Tue, 16 Jan 2024 21:02:21 +0530 Subject: [PATCH 086/109] fixed an issue with search API --- src/services/account.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/account.js b/src/services/account.js index d68b06e6a..ec807d666 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -1129,7 +1129,7 @@ module.exports = class AccountHelper { ) const roleIds = roles.map((role) => role.id) - + let emailIds = [] let searchText = [] if (params.searchText) { From 4872598012e8d85090178af06a095a97f7965c7d Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Wed, 17 Jan 2024 18:52:21 +0530 Subject: [PATCH 087/109] Fixed CSV Upload Issue --- src/services/userInvite.js | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/services/userInvite.js b/src/services/userInvite.js index 782368ce4..9fddb2e34 100644 --- a/src/services/userInvite.js +++ b/src/services/userInvite.js @@ -394,14 +394,26 @@ module.exports = class UserInviteHelper { const filePath = `${folderPath}/${fileName}` const fileData = fs.readFileSync(filePath, 'utf-8') - await request({ - url: fileUploadUrl, - method: 'put', - headers: { - 'x-ms-blob-type': common.azureBlobType, - 'Content-Type': 'multipart/form-data', - }, - body: fileData, + const result = await new Promise((resolve, reject) => { + try { + request( + { + url: fileUploadUrl, + method: 'put', + headers: { + 'x-ms-blob-type': common.azureBlobType, + 'Content-Type': 'multipart/form-data', + }, + body: fileData, + }, + (error, response, body) => { + if (error) reject(error) + else resolve(response.statusCode) + } + ) + } catch (error) { + reject(error) + } }) return { From 7513acc898f2dd3519b66d6c26b01bd6298724a4 Mon Sep 17 00:00:00 2001 From: Nevil Date: Thu, 18 Jan 2024 18:16:52 +0530 Subject: [PATCH 088/109] fixed an issue with viewsScript --- src/scripts/viewsScript.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/scripts/viewsScript.js b/src/scripts/viewsScript.js index f425f0b56..9a997ff9f 100644 --- a/src/scripts/viewsScript.js +++ b/src/scripts/viewsScript.js @@ -1,8 +1,9 @@ // Dependencies +require('module-alias/register') + const request = require('request') require('dotenv').config({ path: '../.env' }) const entityTypeQueries = require('../database/queries/entityType') - // Data const schedulerServiceUrl = process.env.SCHEDULER_SERVICE_HOST // Port address on which the scheduler service is running const mentoringBaseurl = `http://localhost:${process.env.APPLICATION_PORT}` From 443cbb060003462de58b8890028e56bc5f3d48f4 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Thu, 18 Jan 2024 19:25:41 +0530 Subject: [PATCH 089/109] Modified Validation --- src/generics/utils.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/generics/utils.js b/src/generics/utils.js index bf97d2bbf..11732bf7e 100644 --- a/src/generics/utils.js +++ b/src/generics/utils.js @@ -189,12 +189,14 @@ function validateInput(input, validationData, modelName) { case 'ARRAY[STRING]': if (Array.isArray(fieldValue)) { fieldValue.forEach((element) => { - if (typeof element !== 'string' || /[^A-Za-z0-9_]/.test(element)) { + if (typeof element !== 'string') { + addError(field, element, dataType, 'It should be a string') + } else if (field.allow_custom_entities && /[^A-Za-z0-9\s_]/.test(element)) { addError( field, element, dataType, - 'It should not contain spaces or special characters except underscore.' + 'It should not contain special characters except underscore.' ) } }) @@ -204,12 +206,14 @@ function validateInput(input, validationData, modelName) { break case 'STRING': - if (typeof fieldValue !== 'string' || /[^A-Za-z0-9_]/.test(fieldValue)) { + if (typeof element !== 'string') { + addError(field, element, dataType, 'It should be a string') + } else if (field.allow_custom_entities && /[^A-Za-z0-9\s_]/.test(element)) { addError( field, fieldValue, dataType, - 'It should not contain spaces or special characters except underscore.' + 'It should not contain special characters except underscore.' ) } break From b54814622fddd0905882931eeb8f12a792bc5db3 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Thu, 18 Jan 2024 20:13:52 +0530 Subject: [PATCH 090/109] Minor Fix --- src/generics/utils.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/generics/utils.js b/src/generics/utils.js index 11732bf7e..d4fa18620 100644 --- a/src/generics/utils.js +++ b/src/generics/utils.js @@ -167,7 +167,6 @@ function validateInput(input, validationData, modelName) { const errors = [] for (const field of validationData) { const fieldValue = input[field.value] - if (modelName && !field.model_names.includes(modelName) && input[field.value]) { errors.push({ param: field.value, @@ -206,9 +205,9 @@ function validateInput(input, validationData, modelName) { break case 'STRING': - if (typeof element !== 'string') { - addError(field, element, dataType, 'It should be a string') - } else if (field.allow_custom_entities && /[^A-Za-z0-9\s_]/.test(element)) { + if (typeof fieldValue !== 'string') { + addError(field, fieldValue, dataType, 'It should be a string') + } else if (field.allow_custom_entities && /[^A-Za-z0-9\s_]/.test(fieldValue)) { addError( field, fieldValue, From e9255c47ad6f4d219849cc2b7c9a28428dfc2aa8 Mon Sep 17 00:00:00 2001 From: adithya_dinesh Date: Fri, 19 Jan 2024 11:14:02 +0530 Subject: [PATCH 091/109] count issue fix --- src/database/queries/users.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/database/queries/users.js b/src/database/queries/users.js index bfbbd1f8f..fa1413f4c 100644 --- a/src/database/queries/users.js +++ b/src/database/queries/users.js @@ -196,6 +196,7 @@ exports.listUsersFromView = async (roleId, organization_id, page, limit, search, const filterQuery = ` SELECT + COUNT(*) OVER () as total_count, users.id, users.name, users.email, @@ -216,7 +217,7 @@ exports.listUsersFromView = async (roleId, organization_id, page, limit, search, ${filterClause} ORDER BY users.name ASC - OFFSET + OFFSET :offset LIMIT :limit; @@ -241,7 +242,7 @@ exports.listUsersFromView = async (roleId, organization_id, page, limit, search, return user }) - return { count: users.length, data: users } + return { count: users.length > 0 ? Number(users[0].total_count) : 0, data: users } } catch (error) { throw error } From 40ba5d409f434bb09de470aaf0fbf44ae7a33356 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Fri, 19 Jan 2024 17:57:36 +0530 Subject: [PATCH 092/109] api-doc changes --- src/api-doc/api-doc.yaml | 17 - src/api-doc/index.html | 92097 ------------------------------------- 2 files changed, 92114 deletions(-) delete mode 100644 src/api-doc/index.html diff --git a/src/api-doc/api-doc.yaml b/src/api-doc/api-doc.yaml index f7c9fa7c6..06a2752cb 100644 --- a/src/api-doc/api-doc.yaml +++ b/src/api-doc/api-doc.yaml @@ -2629,23 +2629,6 @@ paths: meta: formsVersion: [] correlation: 645c901e-a7db-49a3-8d4c-dfc4f0b6dadb - /user/v1/userRole/default: - get: - summary: Get User Default Roles - tags: - description: > - Retrieve the list of user roles. - - - - Endpoint: `/user/v1/userRole/default` - - - It is mandatory to provide values for parameters marked as `required`. - - - The X-auth-token obtained from the login API is required in the - header. - parameters: - responses: - requestBody: components: schemas: user: diff --git a/src/api-doc/index.html b/src/api-doc/index.html deleted file mode 100644 index a0b891bc4..000000000 --- a/src/api-doc/index.html +++ /dev/null @@ -1,92097 +0,0 @@ - - - - - Elevate User - - - - - - - - - -
    -
    - -
    -
    - - - - - - - - -
    -
    -
    -
    -
    -
    -

    - Elevate User - (1.0.0) -

    -

    - Download OpenAPI specification:Download -

    -
    -
    -
    - E-mail: - info@sunbird.org - - - Terms of Service -
    -
    -
    -
    -
    -
      -
    • - The Users Service is a centralized Service to support other services. Apis - perform operations related to mentoring entities notification etc -
    • -
    • - The URL for Users API(s) is {context}/user/v1 - - Note: These resources can be used in other services -
    • -
    -
    -
    -
    -
    -
    -
    -
    -

    - User Roles APIs -

    -
    -
    -
    -
    -
    -
    -
    -

    - Get User Roles -

    -
    -
    -

    Retrieve the list of user roles.

    -
      -
    • Endpoint: /user/v1/userRole/list
    • -
    • - It is mandatory to provide values for parameters marked as - required. -
    • -
    • - The X-auth-token obtained from the login API is required in the header. -
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - - - - - - - - - -
    - page - -
    -
    - number -
    -
    -
    -

    Please add page number

    -
    -
    -
    -
    - limit - -
    -
    - number -
    -
    -
    -

    Number of records to limit

    -
    -
    -
    -
    - search - -
    -
    - string -
    -
    -
    -

    - Please search for information such as 'code' - names -

    -
    -
    -
    -
    -
    -
    -
    - query - Parameters -
    - - - - - - - -
    - - -
    -
    - string -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - X-auth-token obtained from the login API response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - -
    - -
    required
    -
    -
    -
    - object -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "filters": - { -
        -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Roles fetched - successfully", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      - }, -
      -
    • -
    • -
      - "meta": - { -
        -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Create User Role -

    -
    -
    -

    Create roles for users.

    -
      -
    • Endpoint: /user/v1/userRole/Create.
    • -
    • - It is mandatory to provide values for parameters marked with - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Access token of the user

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    - title -
    required
    -
    -
    -
    - string -
    -
    -
    -
    - user_type -
    required
    -
    -
    -
    - number -
    -
    -
    -
    - status -
    required
    -
    -
    -
    - string -
    -
    -
    -
    - visibility -
    required
    -
    -
    -
    - string -
    -
    -
    -
    - organization_id -
    required
    -
    -
    -
    - number -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "title": - "system_admin", -
      -
    • -
    • -
      - "user_type": 1, -
      -
    • -
    • -
      - "status": - "ACTIVE", -
      -
    • -
    • -
      - "visibility": - "PUBLIC", -
      -
    • -
    • -
      - "organization_id": 1 -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Roles added - successfully", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - }, -
      -
    • -
    • -
      - "meta": - { -
        -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Update User Roles -

    -
    -
    -

    Use this API to update an user Role.

    -
      -
    • Endpoint: /user/v1/userRole/update/{id}
    • -
    • Provide values for parameters marked as required.
    • -
    • The X-auth-token is mandatory and cannot be empty or null.
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - id -
    required
    -
    -
    -
    - integer -
    -
    - - Example: - - 1 -
    -
    -
    -

    Please append a valid user ID to the request URL.

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - Access token obtained from the login API response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    - title -
    required
    -
    -
    -
    - string -
    -
    -
    -
    - user_type -
    required
    -
    -
    -
    - number -
    -
    -
    -
    - status -
    required
    -
    -
    -
    - string -
    -
    -
    -
    - visibility -
    required
    -
    -
    -
    - string -
    -
    -
    -
    - organization_id -
    required
    -
    -
    -
    - number -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "title": - "system_", -
      -
    • -
    • -
      - "user_type": 1, -
      -
    • -
    • -
      - "status": - "ACTIVE", -
      -
    • -
    • -
      - "visibility": - "PUBLIC", -
      -
    • -
    • -
      - "organization_id": 3 -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Roles updated - successfully", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - }, -
      -
    • -
    • -
      - "meta": - { -
        -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Delete User Role -

    -
    -
    -

    This API is associated with deleting an role.

    -
      -
    • - Endpoint for deleting a user role: - /user/v1/userRole/delete/{id}. -
    • -
    • - It is mandatory to provide values for parameters marked with - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - id -
    required
    -
    -
    -
    - integer -
    -
    - - Example: - - 31 -
    -
    -
    -

    - Please append a valid user role ID to the request - URL. -

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To use the API, include X-auth-token. This is - available in the login API response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Module deleted - successfully", -
      -
    • -
    • -
      - "result": - { }, -
      -
    • -
    • -
      - "meta": - { -
        -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - User APIs -

    -
    -
    -
    -
    -
    -
    -

    - Create user -

    -
    -
    -

    This Api is associated with Create User on mentoring

    -
      -
    • - Then Endpoint for creating user /user/v1/account/create -
    • -
    • - It is mandatory to provide values for parameter marked with - required -
    • -
    • Mandatory parameter cannot be empty or null
    • -
    -
    -
    -
    - Request Body schema: application/json -
    -
    -

    Request body consist of metadata and accepts payload as JSON

    -
    - - - - - - - - - - - - - - - - - - - - - - - -
    - name -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Name of the user

    -
    -
    -
    -
    - email -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Email Id of user

    -
    -
    -
    -
    - password -
    required
    -
    -
    -
    - string - <password> - -
    -
    -
    -

    Password of user

    -
    -
    -
    -
    - otp - -
    -
    - string -
    -
    -
    -

    Email OTP for verification

    -
    -
    -
    -
    - has_accepted_terms_and_conditions - -
    -
    - boolean -
    -
    -
    -

    - Flag specifiying if user has accepted the terms & - conditions -

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "name": - "John Deo", -
      -
    • -
    • -
      - "email": - "example@mail.com", -
      -
    • -
    • -
      - "password": - "Password", -
      -
    • -
    • -
      - "otp": - 6845975, -
      -
    • -
    • -
      - "has_accepted_terms_and_conditions": - true -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Sign-up successful Please - wait while logging in.", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Login -

    -
    -
    -

    This API is associated with logging in a user.

    -
      -
    • Endpoint for logging in a user: /user/v1/account/login
    • -
    • - It is mandatory to provide values for parameters marked as - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    - Request Body schema: application/json -
    -

    Request body for user login

    - - - - - - - - - - - -
    - email -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Email address of the user

    -
    -
    -
    -
    - password -
    required
    -
    -
    -
    - string -
    -
    -
    -

    User password

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "email": - "example@mail.com", -
      -
    • -
    • -
      - "password": - "Password" -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "User logged in - successfully.", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Generate Access Token -

    -
    -
    -

    - This API is for re-login and generating an access token from a refresh - token. -

    -
      -
    • - Endpoint for generating token - /user/v1/account/generateToken -
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To use the API, you require X-auth-token, available - in the login API response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - -
    - refresh_token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Refresh token.

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "refresh_token": - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyODMyNTMxYTA1Y2JkNTdiMjczYWViYiIsImVtYWlsIjoiYW5raXQuc0BwYWNld2lzZG9tLmNvbSIsIm5hbWUiOiJBbmtpdCIsImlzQU1lbnRvciI6dHJ1ZX0sImlhdCI6MTY1MzAxMDYxNCwiZXhwIjoxNjY4ODIxODE0fQ.hrIiKz3envHDPauVXSmA_BO_KKzWJAePsP3xD8l851s" -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Access token generated - successfully", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Generate OTP -

    -
    -
    -

    This API is for generating OTP.

    -
      -
    • Endpoint: /user/v1/account/generateOtp
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - -
    - email -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Email address of the user

    -
    -
    -
    -
    - password -
    required
    -
    -
    -
    - string -
    -
    -
    -

    User password

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "email": - "example@mail.com", -
      -
    • -
    • -
      - "password": - "Password" -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "OTP has been sent to your - registered email ID. Please enter - the number to update your - password.", -
      -
    • -
    • -
      - "result": - [ ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Reset Password -

    -
    -
    -

    This API is for resetting the user password.

    -
      -
    • Endpoint: /user/v1/account/resetPassword
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - -
    - email -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Email address of the user

    -
    -
    -
    -
    - password -
    required
    -
    -
    -
    - string -
    -
    -
    -

    New password of the user

    -
    -
    -
    -
    - otp -
    required
    -
    -
    -
    - number -
    -
    -
    -

    OTP sent to the user's email

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "email": - "example@mail.com", -
      -
    • -
    • -
      - "password": - "New password", -
      -
    • -
    • -
      - "otp": - 123456 -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Password reset - successfully.", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Logout -

    -
    -
    -

    This API is for logging out a user.

    -
      -
    • Endpoint: /user/v1/account/logout
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - -
    - refresh_token - -
    -
    - string -
    -
    -
    -

    Refresh token.

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "refresh_token": - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7Il9pZCI6IjYyODMyNTMxYTA1Y2JkNTdiMjczYWViYiIsImVtYWlsIjoiYW5raXQuc0BwYWNld2lzZG9tLmNvbSIsIm5hbWUiOiJBbmtpdCIsImlzQU1lbnRvciI6dHJ1ZX0sImlhdCI6MTY1MzAxMDYxNCwiZXhwIjoxNjY4ODIxODE0fQ.hrIiKz3envHDPauVXSmA_BO_KKzWJAePsP3xD8l851s" -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "User logged out - successfully.", -
      -
    • -
    • -
      - "result": - [ ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Registration OTP -

    -
    -
    -

    This API is for registration OTP.

    -
      -
    • Endpoint: /user/v1/account/registrationOtp
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - -
    - name - -
    -
    - string -
    -
    -
    -
    - email - -
    -
    - string -
    -
    -
    -
    - password - -
    -
    - string -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "name": - "Anu", -
      -
    • -
    • -
      - "email": - "anu@gmail.com", -
      -
    • -
    • -
      - "password": - "password" -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "OTP has been sent to your - registered email ID. Please enter - the otp to complete the registration - process.", -
      -
    • -
    • -
      - "result": - [ ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Depreciated APIs -

    -
    -
    -
    -
    -
    -
    -

    - Terms & Condition -

    -
    -
    -

    - This API sets the 'email_verified' field to true using only the - X-auth-token. -

    -
      -
    • Endpoint: /user/v1/account/acceptTermsAndCondition
    • -
    • Requires a valid X-auth-token from the login API response.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "User successfully - updated.", -
      -
    • -
    • -
      - "result": - [ ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Users APIs -

    -
    -
    -
    -
    -
    -
    -

    - List user -

    -
    -
    -

    This API lists users based on specified conditions.

    -
      -
    • Endpoint: /user/v1/account/list
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - query - Parameters -
    - - - - - - - - - - - - - - - - - - - -
    - userType -
    required
    -
    -
    -
    - string -
    -
    - - Example: - - userType=mentor -
    -
    -
    -

    Type of user

    -
    -
    -
    -
    - page - -
    -
    - number -
    -
    - - Example: - - page=1 -
    -
    -
    -

    Page number for pagination.

    -
    -
    -
    -
    - limit - -
    -
    - number -
    -
    - - Example: - - limit=2 -
    -
    -
    -

    Number of records to limit.

    -
    -
    -
    -
    - search - -
    -
    - string -
    -
    - - Example: - - search=john -
    -
    -
    -

    Search for name or title of user, etc.

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { - - } -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - User Details -

    -
    -
    -

    This API retrieves details of a user's profile.

    -
      -
    • Endpoint: /user/v1/user/read/{userId}
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - userId -
    required
    -
    -
    -
    - integer -
    -
    - - Example: - - 1 -
    -
    -
    -

    Please append a valid User ID to the Request URL.

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Profile fetched - successfully.", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Update User Profile -

    -
    -
    -

    This API updates a user's profile.

    -
      -
    • Endpoint: /user/v1/user/update
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - name - -
    -
    - string -
    -
    -
    -

    The user's name.

    -
    -
    -
    -
    - location - -
    -
    - Array of strings -
    -
    -
    -
    - about - -
    -
    - string -
    -
    -
    -

    A brief description about the user.

    -
    -
    -
    -
    - has_accepted_terms_and_conditions - -
    -
    - boolean -
    -
    -
    -

    - Indicates whether the user has accepted terms and - conditions. -

    -
    -
    -
    -
    - gender - -
    -
    - string -
    -
    -
    -

    The user's gender.

    -
    -
    -
    -
    - image - -
    -
    - string -
    -
    -
    -

    URL of the user's profile image.

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "name": - "John", -
      -
    • -
    • -
      - "location": - [ -
        -
      • - -
      • -
      - ], -
      -
    • -
    • -
      - "about": - "Experienced - Teacher", -
      -
    • -
    • -
      - "has_accepted_terms_and_conditions": - true, -
      -
    • -
    • -
      - "gender": - "male", -
      -
    • -
    • - -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Profile updated - successfully.", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Share Mentor Profile -

    -
    -
    -

    This API is associated with sharing a mentor's profile.

    -
      -
    • - Endpoint for sharing a mentor's profile: - /user/v1/user/share/{userId} -
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - userId -
    required
    -
    -
    -
    - string -
    -
    - - Example: - - 1 -
    -
    -
    -

    Please append a valid User ID to the Request URL.

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Profile share link generated - successfully.", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Cloud Services APIs -

    -
    -
    -
    -
    -
    -
    -

    - Cloud Services - Get Signed URL -

    -
    -
    -

    This API is associated with cloud services for obtaining a signed URL.

    -
      -
    • - Endpoint for cloud services: - /user/v1/cloud-services/file/getSignedUrl -
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - file_name -
    required
    -
    -
    -
    - string -
    -
    - - Example: - - image.jpg -
    -
    -
    -

    - Please append a valid file name to the URL, - indicating the file to be uploaded. -

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { - - } -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Cloud Services - Get Downloadable URL -

    -
    -
    -

    - This API is associated with cloud services for obtaining a downloadable URL. -

    -
      -
    • - Endpoint for cloud services: - /user/v1/cloud-services/file/getDownloadableUrl -
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - file_path -
    required
    -
    -
    -
    - string -
    -
    - - Example: - - users/62832531a05cbd57b273aebb-1654149589875-image.jpg -
    -
    -
    -

    - Please append a valid file path to the URL, - indicating the file to be downloaded. -

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { - - } -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Cloud Services - Get Sample CSV -

    -
    -
    -

    - This API is associated with cloud services for obtaining a sample CSV file - for bulk user create. -

    -
      -
    • - Endpoint for cloud services: - /user/v1/cloud-services/file/getSampleCSV -
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { - - } -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Form APIs -

    -
    -
    -
    -
    -
    -
    -

    - Create Form -

    -
    -
    -

    This API is associated with creating a form.

    -
      -
    • Endpoint for creating a form: /user/v1/form/create
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - -
    - type -
    required
    -
    -
    -
    - string -
    -
    -
    -

    The type of the form.

    -
    -
    -
    -
    - sub_type -
    required
    -
    -
    -
    - string -
    -
    -
    -

    The sub-type or category of the form.

    -
    -
    -
    -
    - -
    required
    -
    -
    -
    - object -
    -
    -
    -

    The main data structure for the form.

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "type": - "profile", -
      -
    • -
    • -
      - "sub_type": - "profileForm", -
      -
    • -
    • -
      - "data": - { -
        -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Form created - successfully", -
      -
    • -
    • -
      - "result": - [ ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Update Form -

    -
    -
    -

    This API is associated with updating a form.

    -
      -
    • - Endpoint for updating a form: /user/v1/form/update/{formId} -
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - formId -
    required
    -
    -
    -
    - string -
    -
    - - Example: - - 1 -
    -
    -
    -

    Please append a valid form ID to the request URL.

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - -
    - type -
    required
    -
    -
    -
    - string -
    -
    -
    -

    The type of the form.

    -
    -
    -
    -
    - sub_type -
    required
    -
    -
    -
    - string -
    -
    -
    -

    The sub-type or category of the form.

    -
    -
    -
    -
    - -
    required
    -
    -
    -
    - object -
    -
    -
    -

    The main data structure for the form.

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "type": - "profile", -
      -
    • -
    • -
      - "sub_type": - "profileForm", -
      -
    • -
    • -
      - "data": - { -
        -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Form updated - successfully", -
      -
    • -
    • -
      - "result": - [ ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Get Form Details -

    -
    -
    -

    This API is associated with retrieving form details.

    -
      -
    • - Endpoint for retrieving form details: - /user/v1/form/read/{formId} -
    • -
    • - It is mandatory to provide values for parameters marked with - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - formId -
    required
    -
    -
    -
    - integer -
    -
    - - Example: - - 2 -
    -
    -
    -

    Please append a valid form Id to the Request URL.

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - -
    - type - -
    -
    - string -
    -
    -
    -

    Type of form.

    -
    -
    -
    -
    - sub_type - -
    -
    - string -
    -
    -
    -

    Subtype of the form.

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "type": - "profile", -
      -
    • -
    • -
      - "sub_type": - "profileForm" -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Form fetched - successfully", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Admin APIs -

    -
    -
    -
    -
    -
    -
    -

    - Create Admin User -

    -
    -
    -

    API associated with creating a new admin user.

    -
      -
    • - Endpoint for creating a system user: /user/v1/admin/create -
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - - - - - -
    - name -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Name of the system user.

    -
    -
    -
    -
    - email -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Email of the system user.

    -
    -
    -
    -
    - password -
    required
    -
    -
    -
    - string - <password> - -
    -
    -
    -

    Password for the system user.

    -
    -
    -
    -
    - secret_code -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Secret code for system user creation.

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "name": - "John Deo", -
      -
    • -
    • -
      - "email": - "systemuser@mail.com", -
      -
    • -
    • -
      - "password": - "password", -
      -
    • -
    • -
      - "secret_code": - "secret_code" -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Sign-up successful, Please - wait while logging in.", -
      -
    • -
    • -
      - "result": - [ ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Admin Login -

    -
    -
    -

    This API is associated with the login of the system user.

    -
      -
    • Endpoint for login system user: /user/v1/admin/login
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - -
    - email -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Email of the system user.

    -
    -
    -
    -
    - password -
    required
    -
    -
    -
    - string - <password> - -
    -
    -
    -

    Password of the system user.

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "email": - "systemuser@mail.com", -
      -
    • -
    • -
      - "password": - "password" -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "User logged in - successfully.", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Delete User -

    -
    -
    -

    Delete a user.

    -
      -
    • Endpoint: /user/v1/admin/deleteUser
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - id -
    required
    -
    -
    -
    - string -
    -
    - - Example: - - 1 -
    -
    -
    -

    - User ID to be deleted. Please append a valid user ID - to the request URL. -

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - X-auth-token required for API access. Available in - login API Response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "User deleted - successfully", -
      -
    • -
    • -
      - "result": - [ -
        -
      • - -
      • -
      - ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Add Organization Admin -

    -
    -
    -

    Assigns a user as the Org-Admin.

    -
      -
    • Endpoint: /user/v1/admin/addOrgAdmin
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - X-auth-token required for API access. Available in - login API Response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - -
    - user_id - -
    -
    - integer -
    -
    -
    -

    The ID of the user to be assigned as Org-Admin.

    -
    -
    -
    -
    - organization_id - -
    -
    - integer -
    -
    -
    -

    - The ID of the organization to which the user will be - assigned as Org-Admin. -

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "user_id": 12, -
      -
    • -
    • -
      - "organization_id": 55 -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "User Assigned As The - Org-Admin Successfully", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Deactivate Organization -

    -
    -
    -

    Deactivates an organization.

    -
      -
    • Endpoint: /user/v1/admin/deactivateOrg
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - id -
    required
    -
    -
    -
    - string -
    -
    - - Example: - - 1 -
    -
    -
    -

    - Please append a valid organization ID to the request - URL. -

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - X-auth-token required for API access. Available in - login API Response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Organization deactivated - Successfully.", -
      -
    • -
    • -
      - "result": - [ -
        -
      • - -
      • -
      - ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Deactivate User -

    -
    -
    -

    Deactivates one or more users.

    -
      -
    • Endpoint: /user/v1/admin/deactivateUser
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - X-auth-token required for API access. Available in - login API Response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - -
    - id - -
    -
    - Array of integers -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "id": - [ -
        -
      • - -
      • -
      • - -
      • -
      - ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "User deactivated - Successfully.", -
      -
    • -
    • -
      - "result": - [ ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Organization -

    -
    -
    -
    -
    -
    -
    -

    - Create Organization -

    -
    -
    -

    Creates a new organization.

    -
      -
    • Endpoint: /user/v1/organization/create
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - X-auth-token required for API access. Available in - the login API Response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - -
    - name -
    required
    -
    -
    -
    - string -
    -
    -
    -

    The name of the organization.

    -
    -
    -
    -
    - code -
    required
    -
    -
    -
    - string -
    -
    -
    -

    A unique code representing the organization.

    -
    -
    -
    -
    - description -
    required
    -
    -
    -
    - string -
    -
    -
    -

    A brief description of the organization.

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "name": - "MentorEd", -
      -
    • -
    • -
      - "code": - "mentor112", -
      -
    • -
    • -
      - "description": - "testing" -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Organization created - successfully", -
      -
    • -
    • -
      - "result": - [ ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Update Organization -

    -
    -
    -

    This API is associated with updating an organization.

    -
      -
    • - Endpoint for updating organization: - /user/v1/organization/update -
    • -
    • - It is mandatory to provide values for parameters marked with - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - id -
    required
    -
    -
    -
    - integer -
    -
    - - Example: - - 1 -
    -
    -
    -

    - Please append a valid organization ID to the request - URL. -

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is available in the login API response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - -
    - name -
    required
    -
    -
    -
    - string -
    -
    -
    -

    The name of the organization.

    -
    -
    -
    -
    - code -
    required
    -
    -
    -
    - string -
    -
    -
    -

    A unique code representing the organization.

    -
    -
    -
    -
    - description -
    required
    -
    -
    -
    - string -
    -
    -
    -

    A brief description of the organization.

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "name": - "MentorEd", -
      -
    • -
    • -
      - "code": - "mentor112", -
      -
    • -
    • -
      - "description": - "testing" -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Organization updated - successfully", -
      -
    • -
    • -
      - "result": - [ ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - List Organization -

    -
    -
    -

    - This API is associated with listing organizations based on specified - conditions. -

    -
      -
    • - Endpoint for listing organizations: - /user/v1/organization/list -
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - query - Parameters -
    - - - - - - - - - - - - - - - -
    - page - -
    -
    - number -
    -
    - - Example: - - page=1 -
    -
    -
    -

    Please specify the page number.

    -
    -
    -
    -
    - limit - -
    -
    - number -
    -
    - - Example: - - limit=2 -
    -
    -
    -

    Specify the number of records to limit.

    -
    -
    -
    -
    - search - -
    -
    - string -
    -
    - - Example: - - search=john -
    -
    -
    -

    Search for organizations based on name or title.

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is available in the login API response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Organization fetched - successfully.", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Request Org Role -

    -
    -
    -

    - This API is associated with requesting a specific role within an - organization. -

    -
      -
    • Endpoint: /user/v1/organization/requestOrgRole
    • -
    • - Mandatory parameters marked as required must have valid - values. -
    • -
    • Parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - User's access token, which already recognizes - the user as the organization's mentee. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    -

    Request body containing role information.

    -
    - - - - - - - - - - - -
    - role - -
    -
    - integer -
    -
    -
    -

    The specific role being requested.

    -
    -
    -
    -
    - - -
    -
    - object -
    -
    -
    -

    - Additional data related to the organization-specific - fields. -

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "role": 2, -
      -
    • -
    • -
      - "form_data": - { -
        -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Mentor role requested - successfully", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - EntityType APIs -

    -
    -
    -
    -
    -
    -
    -

    - Create Entity Type -

    -
    -
    -

    Use this API to create a user entity.

    -
      -
    • Endpoint: /mentoring/v1/entity-type/create
    • -
    • Provide values for parameters marked as required.
    • -
    • The X-auth-token is mandatory and cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - Access token of the user who is already a mentee of - the organization. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - value - -
    -
    - string -
    -
    -
    -

    Unique identifier for the entity type.

    -
    -
    -
    -
    - label - -
    -
    - string -
    -
    -
    -

    Descriptive label for the entity type.

    -
    -
    -
    -
    - type - -
    -
    - string -
    -
    -
    -

    Type of the entity (e.g., SYSTEM, USER).

    -
    -
    -
    -
    - allow_filtering - -
    -
    - boolean -
    -
    -
    -

    - Indicates whether filtering is allowed for this entity - type. -

    -
    -
    -
    -
    - data_type - -
    -
    - string -
    -
    -
    -

    Data type of the entity.

    -
    -
    -
    -
    - has_entities - -
    -
    - boolean -
    -
    -
    -

    - Indicates whether the entity type has associated - entities. -

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "value": - "ln", -
      -
    • -
    • -
      - "label": - "Languages", -
      -
    • -
    • -
      - "type": - "SYSTEM", -
      -
    • -
    • -
      - "allow_filtering": - true, -
      -
    • -
    • -
      - "data_type": - "string", -
      -
    • -
    • -
      - "has_entities": - "STRING" -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Entity type created - successfully.", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Read Entity Type -

    -
    -
    -

    Use this API to retrieve a list of entity types.

    -
      -
    • Endpoint: /user/v1/entity-type/read
    • -
    • Provide values for parameters marked as required.
    • -
    • The X-auth-token is mandatory and cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - -
    - value - -
    -
    - Array of strings -
    -
    -
    -
    - read_user_entity - -
    -
    - boolean -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "value": - [ -
        -
      • - -
      • -
      - ], -
      -
    • -
    • -
      - "read_user_entity": - false -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application.json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Entity type fetched - successfully", -
      -
    • -
    • -
      - "result": - [ -
        -
      • - -
      • -
      - ], -
      -
    • -
    • -
      - "meta": - { -
        -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Delete Entity Type -

    -
    -
    -

    - This API is associated with deleting an entity type. - Endpoint for deleting - a user entity: /user/v1/entity-type/delete - It is mandatory to - provide values for parameters marked with required. - Mandatory - parameters cannot be empty or null. -

    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - id -
    required
    -
    -
    -
    - integer -
    -
    - - Example: - - 31 -
    -
    -
    -

    - Please append a valid user entity ID to the request - URL. -

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To use the API, include X-auth-token. This is - available in the login API response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Entity deleted - successfully", -
      -
    • -
    • -
      - "result": - [ ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Update Entity Type -

    -
    -
    -

    Use this API to update an entity type.

    -
      -
    • Endpoint: /user/v1/entity-type/update/{id}
    • -
    • Provide values for parameters marked as required.
    • -
    • The X-auth-token is mandatory and cannot be empty or null.
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - id -
    required
    -
    -
    -
    - integer -
    -
    - - Example: - - 1 -
    -
    -
    -

    Please append a valid user ID to the request URL.

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - Access token obtained from the login API response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - value - -
    -
    - string -
    -
    -
    -

    Unique identifier for the entity type.

    -
    -
    -
    -
    - label - -
    -
    - string -
    -
    -
    -

    Descriptive label for the entity type.

    -
    -
    -
    -
    - type - -
    -
    - string -
    -
    -
    -

    Type of the entity (e.g., SYSTEM, USER).

    -
    -
    -
    -
    - allow_filtering - -
    -
    - boolean -
    -
    -
    -

    - Indicates whether filtering is allowed for this entity - type. -

    -
    -
    -
    -
    - data_type - -
    -
    - string -
    -
    -
    -

    Data type of the entity.

    -
    -
    -
    -
    - has_entities - -
    -
    - boolean -
    -
    -
    -

    - Indicates whether the entity type has associated - entities. -

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "value": - "ln", -
      -
    • -
    • -
      - "label": - "Languages", -
      -
    • -
    • -
      - "type": - "SYSTEM", -
      -
    • -
    • -
      - "allow_filtering": - true, -
      -
    • -
    • -
      - "data_type": - "string", -
      -
    • -
    • -
      - "has_entities": - "STRING" -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "string", -
      -
    • -
    • -
      - "message": - "string", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - }, -
      -
    • -
    • -
      - "meta": - { -
        -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Delete Entity -

    -
    -
    -

    This API is associated with deleting an entity.

    -
      -
    • - Endpoint for deleting a user entity: - /user/v1/entity/delete. -
    • -
    • - It is mandatory to provide values for parameters marked with - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - id -
    required
    -
    -
    -
    - integer -
    -
    - - Example: - - 31 -
    -
    -
    -

    - Please append a valid user entity ID to the request - URL. -

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To use the API, include X-auth-token. This is - available in the login API response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Entity deleted - successfully", -
      -
    • -
    • -
      - "result": - [ ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Bulk User Create -

    -
    -
    -

    Create multiple users in bulk using a CSV file.

    -
      -
    • Endpoint: /user/v1/org-admin/bulkUserCreate.
    • -
    • - It is mandatory to provide values for parameters marked with - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Access token of the org admin.

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - -
    - file_path - -
    -
    - string -
    -
    -
    -

    - The path to the uploaded CSV file containing user data. -

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "file_path": - "path/to/uploaded-csv-file" -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Bulk User Invites CSV - Uploaded Successfully", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Entity APIs -

    -
    -
    -
    -
    -
    -
    -

    - Create Entity -

    -
    -
    -

    This API is associated with entity creation.

    -
      -
    • - Endpoint for creating an entity: /user/v1/entity/create. -
    • -
    • - It is mandatory to provide values for parameters marked with - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - - - - - -
    - value -
    required
    -
    -
    -
    - string -
    -
    -
    -
    - label -
    required
    -
    -
    -
    - string -
    -
    -
    -
    - type -
    required
    -
    -
    -
    - string -
    -
    -
    -
    - entity_type_id -
    required
    -
    -
    -
    - integer -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "value": - "AP", -
      -
    • -
    • -
      - "label": - "Andhra Pradesh", -
      -
    • -
    • -
      - "type": - "string", -
      -
    • -
    • -
      - "entity_type_id": 4 -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application.json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Entity created - successfully", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - }, -
      -
    • -
    • -
      - "meta": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Update Entity -

    -
    -
    -

    This API is associated with updating an entity.

    -
      -
    • - Endpoint for updating an entity: /user/v1/entity/update. -
    • -
    • - It is mandatory to provide values for parameters marked with - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - id -
    required
    -
    -
    -
    - integer -
    -
    - - Example: - - 2 -
    -
    -
    -

    - Please append a valid user entity ID to the request - URL. -

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To make use of the API, you require X-auth-token. - This is Available in login API Response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application.json -
    -
    - - - - - - - - - - - - - - - - - - - -
    - value - -
    -
    - string -
    -
    -
    -

    The value of the entity.

    -
    -
    -
    -
    - label - -
    -
    - string -
    -
    -
    -

    The label of the entity.

    -
    -
    -
    -
    - status - -
    -
    - string -
    -
    -
    -

    The status of the entity.

    -
    -
    -
    -
    - entity_type_id - -
    -
    - number -
    -
    -
    -

    The ID of the entity type.

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application.json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "value": - "en", -
      -
    • -
    • -
      - "label": - "English", -
      -
    • -
    • -
      - "status": - "ACTIVE", -
      -
    • -
    • -
      - "entity_type_id": 1 -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application.json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Entity updated - successfully", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - }, -
      -
    • -
    • -
      - "meta": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Read User Entity -

    -
    -
    -

    - This API is associated with retrieving a user entity based on ID or value. -

    -
      -
    • - Endpoint for retrieving a user entity: - /user/v1/entity/read. -
    • -
    • - It is mandatory to provide values for parameters marked with - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - query - Parameters -
    - - - - - - - -
    - id -
    required
    -
    -
    -
    - integer -
    -
    - - Example: - - id=1 -
    -
    -
    -

    Please append a valid ID.

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - To use the API, include X-auth-token. This is - available in the login API response. -

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Entity fetched - successfully", -
      -
    • -
    • -
      - "result": - [ -
        -
      • - -
      • -
      - ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Org Admin APIs -

    -
    -
    -
    -
    -
    -
    -

    - Get Requests -

    -
    -
    -

    Get a list of organization requests based on specified filters

    -
      -
    • Endpoint: /user/v1/org-admin/getRequests.
    • -
    • - It is mandatory to provide values for parameters marked with - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - query - Parameters -
    - - - - - - - - - - - -
    - page -
    required
    -
    -
    -
    - integer -
    -
    -
    -

    Page number for pagination.

    -
    -
    -
    -
    - limit -
    required
    -
    -
    -
    - integer -
    -
    -
    -

    Number of items per page.

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Access token of the org admin.

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    -

    Request body for filtering organization requests.

    -
      -
    • role: An array of role IDs.
    • -
    • status: An array of request statuses.
    • -
    • handled_by: An array of user IDs who handled the requests.
    • -
    -
    - - - - - - - -
    - - -
    -
    - object -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "filters": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Organization requests fetched - successfully", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Update Request Status -

    -
    -
    -

    Update the status of an organization request.

    -
      -
    • Endpoint: /user/v1/org-admin/updateRequestStatus.
    • -
    • - It is mandatory to provide values for parameters marked with - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Access token of the org admin.

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - -
    - request_id - -
    -
    - integer -
    -
    -
    -

    The ID of the organization request to be updated.

    -
    -
    -
    -
    - comments - -
    -
    - Array of strings -
    -
    -
    -

    Comments related to the request status update.

    -
    -
    -
    -
    - status - -
    -
    - string -
    -
    - Enum: - "APPROVED" - "REJECTED" - "UNDER_REVIEW" -
    -
    -
    -

    The new status for the organization request.

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "request_id": 12, -
      -
    • -
    • -
      - "comments": - [ -
        -
      • - -
      • -
      - ], -
      -
    • -
    • -
      - "status": - "APPROVED" -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Successfully updated - organization request - status", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Get Request Details -

    -
    -
    -

    Get details of a specific organization request.

    -
      -
    • Endpoint: /user/v1/org-admin/getRequestDetails.
    • -
    • - It is mandatory to provide values for parameters marked with - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - query - Parameters -
    - - - - - - - -
    - request_id -
    required
    -
    -
    -
    - integer -
    -
    - - Example: - - request_id=12 -
    -
    -
    -

    ID of the request to get details for.

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Access token of the org admin.

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Organisation request details - fetched successfully", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Get Bulk Invite Files List -

    -
    -
    -

    Get a list of uploaded bulk invite CSV files.

    -
      -
    • Endpoint: /user/v1/org-admin/getBulkInvitesFilesList.
    • -
    • - It is mandatory to provide values for parameters marked with - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - query - Parameters -
    - - - - - - - - - - - - - - - -
    - page -
    required
    -
    -
    -
    - integer -
    -
    -
    -

    Page number for pagination.

    -
    -
    -
    -
    - limit -
    required
    -
    -
    -
    - integer -
    -
    -
    -

    Number of items per page.

    -
    -
    -
    -
    - status -
    required
    -
    -
    -
    - string -
    -
    - Enum: - "uploaded" - "processed" - "failed" -
    -
    - - Example: - - status=uploaded -
    -
    -
    -

    - Status of the bulk invite files - (uploaded/processed/failed). -

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Access token of the org admin.

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Bulk Invites CSV List Fetched - Successfully", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Deactivate User -

    -
    -
    -

    Deactivate a user

    -
      -
    • Endpoint: /user/v1/org-admin/deactivateUser.
    • -
    • - It is mandatory to provide values for parameters marked with - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - path - Parameters -
    - - - - - - - -
    - id -
    required
    -
    -
    -
    - integer -
    -
    - - Example: - - 12 -
    -
    -
    -

    ID of the user.

    -
    -
    -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Access token of the org admin.

    -
    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "User deactivated - Successfully.", -
      -
    • -
    • -
      - "result": - [ ] -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Inherit Entity Type -

    -
    -
    -

    Inherit entity type.

    -
      -
    • Endpoint: /user/v1/org-admin/inheritEntityType.
    • -
    • - It is mandatory to provide values for parameters marked with - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    Access token of the org admin.

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - -
    - entity_type_value - -
    -
    - string -
    -
    -
    -
    - target_entity_type_label - -
    -
    - string -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "entity_type_value": - "categories", -
      -
    • -
    • -
      - "target_entity_type_label": - "training" -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Entity type created - successfully", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    - Notification APIs -

    -
    -
    -
    -
    -
    -
    -

    - Create, Update, and Delete Notification -

    -
    -
    -

    This API is associated with notification create or update.

    -
      -
    • Endpoint: /user/v1/notification/template.
    • -
    • - It is mandatory to provide values for parameters marked with - required. -
    • -
    • Mandatory parameters cannot be empty or null.
    • -
    -
    -
    -
    -
    - header - Parameters -
    - - - - - - - -
    - X-auth-token -
    required
    -
    -
    -
    - string -
    -
    -
    -

    - Access token required to use the API. Available in - the login API response. -

    -
    -
    -
    -
    -
    -
    - Request Body schema: application/json -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - type - -
    -
    - string -
    -
    -
    -

    Type of email

    -
    -
    -
    -
    - code - -
    -
    - string -
    -
    -
    -

    Unique code for the email configuration

    -
    -
    -
    -
    - subject - -
    -
    - string -
    -
    -
    -

    Subject of the email

    -
    -
    -
    -
    - body - -
    -
    - string -
    -
    -
    -

    Body of the email

    -
    -
    -
    -
    - email_header - -
    -
    - string -
    -
    -
    -

    Email header content

    -
    -
    -
    -
    - email_footer - -
    -
    - string -
    -
    -
    -

    Email footer content

    -
    -
    -
    -
    -
    -

    Responses

    -
    - -
    -
    - -
    -
    -
    -
    -
    - - -
    -
    -

    Request samples

    -
    -
      - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "type": - "email", -
      -
    • -
    • -
      - "code": - "tl-email-invite", -
      -
    • -
    • -
      - "subject": - "Hi Welcome Back", -
      -
    • -
    • -
      - "body": - "<p>Dear User,</p> - Welcome back to mentorEd", -
      -
    • -
    • -
      - "email_header": - "email_header", -
      -
    • -
    • -
      - "email_footer": - "email_footer" -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -

    Response samples

    -
    -
      - - -
    -
    -
    -
    - Content type -
    application/json
    -
    -
    -
    -
    - -
    -
    -
    - { -
      -
    • -
      - "responseCode": - "OK", -
      -
    • -
    • -
      - "message": - "Notification template created - successfully", -
      -
    • -
    • -
      - "result": - { -
        -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      • - -
      • -
      - } -
      -
    • -
    - }
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - From 16429cf5e51bf00dc6245a70e215ca47348ecac4 Mon Sep 17 00:00:00 2001 From: sumanvpacewisdom Date: Fri, 19 Jan 2024 19:59:33 +0530 Subject: [PATCH 093/109] Migration Changes --- .../20240119142709-add-role-session-manager.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/database/{seeders/20231221080334-add_system_manager_role.js => migrations/20240119142709-add-role-session-manager.js} (100%) diff --git a/src/database/seeders/20231221080334-add_system_manager_role.js b/src/database/migrations/20240119142709-add-role-session-manager.js similarity index 100% rename from src/database/seeders/20231221080334-add_system_manager_role.js rename to src/database/migrations/20240119142709-add-role-session-manager.js From 8fdb5751255db901834080f1b19f1ead29df986b Mon Sep 17 00:00:00 2001 From: "priyanka@TL" Date: Sat, 20 Jan 2024 20:01:00 +0530 Subject: [PATCH 094/109] mutiple role assignment through csv and new notification template creation --- src/.env.sample | 3 + src/constants/common.js | 2 + src/database/queries/orgUserInvite.js | 2 +- src/database/queries/userCredential.js | 3 +- ...0-add_generic_invitation_email_template.js | 30 +++ src/envVariables.js | 4 + src/generics/utils.js | 8 + src/sample.csv | 2 +- src/services/account.js | 31 +-- src/services/org-admin.js | 18 +- src/services/userInvite.js | 232 ++++++++++++------ 11 files changed, 237 insertions(+), 98 deletions(-) create mode 100644 src/database/seeders/20240118145750-add_generic_invitation_email_template.js diff --git a/src/.env.sample b/src/.env.sample index da4e42b3e..35d04d684 100644 --- a/src/.env.sample +++ b/src/.env.sample @@ -182,3 +182,6 @@ SCHEDULER_SERVICE_BASE_URL= '/scheduler/' #Refresh interval for materialized views REFRESH_VIEW_INTERVAL= 540000 + +#Generic Email template for new users +GENERIC_INVITATION_EMAIL_TEMPLATE_CODE=generic_invite diff --git a/src/constants/common.js b/src/constants/common.js index 84b729162..cb67b64a6 100644 --- a/src/constants/common.js +++ b/src/constants/common.js @@ -95,6 +95,7 @@ module.exports = { INACTIVE_STATUS: 'INACTIVE', MENTOR_ROLE: 'mentor', MENTEE_ROLE: 'mentee', + SESSION_MANAGER_ROLE: 'session_manager', redisUserPrefix: 'user_', redisOrgPrefix: 'org_', location: 'location', @@ -120,4 +121,5 @@ module.exports = { materializedViewsPrefix: 'm_', DELETED_STATUS: 'DELETED', DEFAULT_ORG_VISIBILITY: 'PUBLIC', + ROLE_TYPE_NON_SYSTEM: 0, } diff --git a/src/database/queries/orgUserInvite.js b/src/database/queries/orgUserInvite.js index ce812b53e..eebed553a 100644 --- a/src/database/queries/orgUserInvite.js +++ b/src/database/queries/orgUserInvite.js @@ -1,6 +1,6 @@ 'use strict' const organizationUserInvite = require('../models/index').OrganizationUserInvite -const { UniqueConstraintError, ValidationError } = require('sequelize') +const { ValidationError } = require('sequelize') exports.create = async (data) => { try { diff --git a/src/database/queries/userCredential.js b/src/database/queries/userCredential.js index e941f4f4c..64a724af7 100644 --- a/src/database/queries/userCredential.js +++ b/src/database/queries/userCredential.js @@ -1,5 +1,6 @@ 'use strict' const UserCredential = require('@database/models/index').UserCredential +const { UniqueConstraintError, ValidationError } = require('sequelize') exports.create = async (data) => { try { @@ -7,7 +8,7 @@ exports.create = async (data) => { return res.get({ plain: true }) } catch (error) { if (error instanceof UniqueConstraintError) { - return 'USER_ALREADY_EXISTS' + return 'User already exist' } else if (error instanceof ValidationError) { let message error.errors.forEach((err) => { diff --git a/src/database/seeders/20240118145750-add_generic_invitation_email_template.js b/src/database/seeders/20240118145750-add_generic_invitation_email_template.js new file mode 100644 index 000000000..4af1445da --- /dev/null +++ b/src/database/seeders/20240118145750-add_generic_invitation_email_template.js @@ -0,0 +1,30 @@ +const moment = require('moment') + +module.exports = { + up: async (queryInterface, Sequelize) => { + const defaultOrgId = queryInterface.sequelize.options.defaultOrgId + if (!defaultOrgId) { + throw new Error('Default org ID is undefined. Please make sure it is set in sequelize options.') + } + let notificationTemplateData = [ + { + code: 'generic_invite', + subject: 'Welcome Aboard as a {roles}', + body: '

    Dear {name},

    We are delighted to inform you that you have been successfully onboarded as a {roles} for {orgName}. You can now explore {appName}.
    We request you to register on our Mentoring Platform (if not already), to start your journey with us as a organization admin.

    Click to register: {portalURL}', + status: 'ACTIVE', + type: 'email', + created_at: moment().format(), + updated_at: moment().format(), + email_header: 'email_header', + email_footer: 'email_footer', + organization_id: defaultOrgId, + }, + ] + + await queryInterface.bulkInsert('notification_templates', notificationTemplateData, {}) + }, + + down: async (queryInterface, Sequelize) => { + await queryInterface.bulkDelete('notification_templates', null, {}) + }, +} diff --git a/src/envVariables.js b/src/envVariables.js index fbcc51fac..44d5f78da 100644 --- a/src/envVariables.js +++ b/src/envVariables.js @@ -252,6 +252,10 @@ let enviromentVariables = { optional: false, default: 'aes-256-cbc', }, + GENERIC_INVITATION_EMAIL_TEMPLATE_CODE: { + message: 'Required generic invitation email template code', + optional: false, + }, } let success = true diff --git a/src/generics/utils.js b/src/generics/utils.js index bf97d2bbf..df2658c34 100644 --- a/src/generics/utils.js +++ b/src/generics/utils.js @@ -423,6 +423,13 @@ const generateWhereClause = (tableName) => { return whereClause } +const getRoleTitlesFromId = (roleIds = [], roleList = []) => { + return roleIds.map((roleId) => { + const role = roleList.find((r) => r.id === roleId) + return role ? role.title : null + }) +} + module.exports = { generateToken, hashPassword, @@ -452,4 +459,5 @@ module.exports = { isValidEmail, isValidName, generateWhereClause, + getRoleTitlesFromId, } diff --git a/src/sample.csv b/src/sample.csv index af92aa785..f1c308291 100644 --- a/src/sample.csv +++ b/src/sample.csv @@ -1,4 +1,4 @@ name,email,roles Sarah,sarah@tunerlabs.com,mentee John,john@tunerlabs.com,mentor -Pradeep,pradeep@tunerlabs.com,session_manager +Pradeep,pradeep@tunerlabs.com,"mentor,session_manager" diff --git a/src/services/account.js b/src/services/account.js index d7a363551..724f670aa 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -104,7 +104,7 @@ module.exports = class AccountHelper { if (invitedUserMatch) { bodyData.organization_id = invitedUserMatch.organization_id roles = invitedUserMatch.roles - role = await roleQueries.findOne( + role = await roleQueries.findAll( { id: invitedUserMatch.roles }, { attributes: { @@ -113,7 +113,7 @@ module.exports = class AccountHelper { } ) - if (!role) { + if (!role.length > 0) { return common.failureResponse({ message: 'ROLE_NOT_FOUND', statusCode: httpStatusCode.not_acceptable, @@ -121,20 +121,21 @@ module.exports = class AccountHelper { }) } - if (role.title === common.ORG_ADMIN_ROLE) { - isOrgAdmin = true - - const defaultRole = await roleQueries.findOne( - { title: process.env.DEFAULT_ROLE }, - { - attributes: { - exclude: ['created_at', 'updated_at', 'deleted_at'], - }, - } - ) + role.forEach(async (eachRole) => { + if (eachRole.title === common.ORG_ADMIN_ROLE) { + const defaultRole = await roleQueries.findOne( + { title: process.env.DEFAULT_ROLE }, + { + attributes: { + exclude: ['created_at', 'updated_at', 'deleted_at'], + }, + } + ) - roles.push(defaultRole.id) - } + roles.push(defaultRole.id) + isOrgAdmin = true + } + }) bodyData.roles = roles } else { //find organization from email domain diff --git a/src/services/org-admin.js b/src/services/org-admin.js index ef583ddb2..c53e5e5b8 100644 --- a/src/services/org-admin.js +++ b/src/services/org-admin.js @@ -55,6 +55,7 @@ module.exports = class OrgAdminHelper { } const result = await fileUploadQueries.create(creationData) + if (!result?.id) { return common.successResponse({ responseCode: 'CLIENT_ERROR', @@ -421,12 +422,6 @@ function updateRoleForApprovedRequest(requestDetails, user) { { attributes: ['title', 'id', 'user_type', 'status'] } ) - const systemRoleIds = userRoles - .filter((role) => role.user_type === common.ROLE_TYPE_SYSTEM) - .map((role) => role.id) - - let rolesToUpdate = [...systemRoleIds] - const newRole = await roleQueries.findOne( { id: requestDetails.role, status: common.ACTIVE_STATUS }, { attributes: ['title', 'id', 'user_type', 'status'] } @@ -440,7 +435,16 @@ function updateRoleForApprovedRequest(requestDetails, user) { }, }) - rolesToUpdate.push(requestDetails.role) + let rolesToUpdate = [...requestDetails.role] + let currentUserRoleIds = _.map(userRoles, 'id') + + //remove mentee role from roles array + const menteeRoleId = userRoles.find((role) => role.title === common.MENTEE_ROLE)?.id + if (menteeRoleId && currentUserRoleIds.includes(menteeRoleId)) { + _.pull(currentUserRoleIds, menteeRoleId) + } + rolesToUpdate.push(...currentUserRoleIds) + const roles = _.uniq(rolesToUpdate) await userQueries.updateUser( diff --git a/src/services/userInvite.js b/src/services/userInvite.js index 782368ce4..816912c6c 100644 --- a/src/services/userInvite.js +++ b/src/services/userInvite.js @@ -42,7 +42,6 @@ module.exports = class UserInviteHelper { // extract data from csv const parsedFileData = await this.extractDataFromCSV(response.result.downloadPath) if (!parsedFileData.success) throw new Error('FAILED_TO_READ_CSV') - const invitees = parsedFileData.result.data // create outPut file and create invites @@ -51,8 +50,8 @@ module.exports = class UserInviteHelper { // upload output file to cloud const uploadRes = await this.uploadFileToCloud(outputFilename, inviteeFileDir, data.user.id) - const output_path = uploadRes.result.uploadDest + const update = { output_path, updated_by: data.user.id, @@ -60,7 +59,7 @@ module.exports = class UserInviteHelper { createResponse.result.isErrorOccured == true ? common.FAILED_STATUS : common.PROCESSED_STATUS, } - // //update output path in file uploads + //update output path in file uploads const rowsAffected = await fileUploadQueries.update( { id: data.fileDetails.id, organization_id: data.user.organization_id }, update @@ -69,7 +68,7 @@ module.exports = class UserInviteHelper { throw new Error('FILE_UPLOAD_MODIFY_ERROR') } - // // send email to admin + // send email to admin const templateCode = process.env.ADMIN_INVITEE_UPLOAD_EMAIL_TEMPLATE_CODE if (templateCode) { const templateData = await notificationTemplateQueries.findOneEmailTemplate( @@ -92,6 +91,7 @@ module.exports = class UserInviteHelper { message: 'CSV_UPLOADED_SUCCESSFULLY', }) } catch (error) { + console.log(error, 'CSV PROCESSING ERROR') return reject({ success: false, message: error.message, @@ -139,6 +139,15 @@ module.exports = class UserInviteHelper { static async extractDataFromCSV(csvFilePath) { try { const csvToJsonData = await csv().fromFile(csvFilePath) + const header = Object.keys(csvToJsonData[0]) + + if (header.map((column) => column.toLowerCase()).includes('roles')) { + // Process the data, split roles, and handle unquoted roles + csvToJsonData.forEach((row) => { + const roles = row.roles.replace(/"/g, '').split(',') + row.roles = roles + }) + } return { success: true, result: { @@ -156,30 +165,46 @@ module.exports = class UserInviteHelper { static async createUserInvites(csvData, user, fileUploadId) { try { const outputFileName = utils.generateFileName(common.inviteeOutputFile, common.csvExtension) - const allRoles = _.uniq(_.map(csvData, 'roles').map((role) => role.toLowerCase())) - const roleList = await roleQueries.findAll({ title: allRoles }) + let menteeRoleId, mentorRoleId + + //get all the roles and map title and id + const roleList = await roleQueries.findAll({ + user_type: common.ROLE_TYPE_NON_SYSTEM, + status: common.ACTIVE_STATUS, + }) const roleTitlesToIds = {} roleList.forEach((role) => { roleTitlesToIds[role.title] = [role.id] + if (role.title === common.MENTEE_ROLE) { + menteeRoleId = role.id + } + if (role.title === common.MENTOR_ROLE) { + mentorRoleId = role.id + } }) //get all existing user const emailArray = _.uniq(_.map(csvData, 'email')).map((email) => emailEncryption.encrypt(email.toLowerCase()) ) + const userCredentials = await UserCredentialQueries.findAll( { email: { [Op.in]: emailArray } }, { - attributes: ['user_id'], + attributes: ['user_id', 'email'], } - ) //This is valid since UserCredentials Already Store The Encrypted Email ID + ) + + //This is valid since UserCredentials Already Store The Encrypted Email ID const userIds = _.map(userCredentials, 'user_id') const existingUsers = await userQueries.findAll( { id: userIds }, { attributes: ['id', 'email', 'organization_id', 'roles'], } - ) //Get All The Users From Database based on UserIds From UserCredentials + ) + + //Get All The Users From Database based on UserIds From UserCredentials const existingEmailsMap = new Map(existingUsers.map((eachUser) => [eachUser.email, eachUser])) //Figure Out Who Are The Existing Users //find default org id @@ -190,24 +215,13 @@ module.exports = class UserInviteHelper { let isErrorOccured = false let isOrgUpdate = false - //fetch email template - const mentorTemplateCode = process.env.MENTOR_INVITATION_EMAIL_TEMPLATE_CODE || null - const menteeTemplateCode = process.env.MENTEE_INVITATION_EMAIL_TEMPLATE_CODE || null - - const [mentorTemplateData, menteeTemplateData] = await Promise.all([ - mentorTemplateCode - ? notificationTemplateQueries.findOneEmailTemplate(mentorTemplateCode, user.organization_id) - : null, - menteeTemplateCode - ? notificationTemplateQueries.findOneEmailTemplate(menteeTemplateCode, user.organization_id) - : null, - ]) - - const templates = { - [common.MENTOR_ROLE]: mentorTemplateData, - [common.MENTEE_ROLE]: menteeTemplateData, - } + //fetch generic email template + const emailTemplate = await notificationTemplateQueries.findOneEmailTemplate( + process.env.GENERIC_INVITATION_EMAIL_TEMPLATE_CODE, + user.organization_id + ) + //find already invited users const emailList = await userInviteQueries.findAll({ email: emailArray }) const existingInvitees = {} emailList.forEach((userInvitee) => { @@ -216,43 +230,59 @@ module.exports = class UserInviteHelper { // process csv data for (const invitee of csvData) { - //convert the fields to lower case - invitee.roles = invitee.roles.toLowerCase() invitee.email = invitee.email.toLowerCase() const encryptedEmail = emailEncryption.encrypt(invitee.email.toLowerCase()) - //validate the fields + //find the invalid fields and generate error message + let invalidFields = [] if (!utils.isValidName(invitee.name)) { - invitee.statusOrUserId = 'NAME_INVALID' - input.push(invitee) - continue + invalidFields.push('name') } - if (!utils.isValidEmail(invitee.email)) { - invitee.statusOrUserId = 'EMAIL_INVALID' - input.push(invitee) - continue + invalidFields.push('email') + } + + const invalidRoles = invitee.roles.filter((role) => !roleTitlesToIds.hasOwnProperty(role.toLowerCase())) + if (invalidRoles.length > 0) { + invalidFields.push('roles') } - if (!roleTitlesToIds.hasOwnProperty(invitee.roles)) { - invitee.statusOrUserId = 'ROLE_INVALID' + //merge all error message + if (invalidFields.length > 0) { + const errorMessage = `${ + invalidFields.length > 2 + ? invalidFields.slice(0, -1).join(', ') + ', and ' + invalidFields.slice(-1) + : invalidFields.join(' and ') + } ${invalidFields.length > 1 ? 'are' : 'is'} invalid.` + + invitee.statusOrUserId = errorMessage + invitee.roles = invitee.roles.length > 0 ? invitee.roles.join(',') : '' input.push(invitee) continue } - //update user details if the user exist and in default org const existingUser = existingEmailsMap.get(encryptedEmail) + //return error for already invited user + if (!existingUser && existingInvitees.hasOwnProperty(encryptedEmail)) { + invitee.statusOrUserId = 'User already exist' + invitee.roles = invitee.roles.length > 0 ? invitee.roles.join(',') : '' + input.push(invitee) + continue + } + // Update user details if the user exists and belongs to the default organization if (existingUser) { - invitee.statusOrUserId = 'USER_ALREADY_EXISTS' + invitee.statusOrUserId = 'User already exist' isErrorOccured = true const isOrganizationMatch = existingUser.organization_id === defaultOrgId || existingUser.organization_id === user.organization_id + if (isOrganizationMatch) { let userUpdateData = {} + //update user organization if (existingUser.organization_id != user.organization_id) { await userQueries.changeOrganization( existingUser.id, @@ -262,23 +292,44 @@ module.exports = class UserInviteHelper { organization_id: user.organization_id, } ) + isOrgUpdate = true userUpdateData.refresh_tokens = [] } - const areAllElementsInArray = _.every(roleTitlesToIds[invitee.roles], (element) => - _.includes(existingUser.roles, element) + + //find the new roles + const elementsNotInArray = _.difference( + _.map(invitee.roles, (role) => roleTitlesToIds[role.toLowerCase()]).flat(), + existingUser.roles ) - if (!areAllElementsInArray) { - userUpdateData.roles = roleTitlesToIds[invitee.roles] + + //update the user roles and handle downgrade of role + if (elementsNotInArray.length > 0) { + userUpdateData.roles = [] + if (existingUser.roles.includes(menteeRoleId)) { + if (existingUser.roles.length === 1) { + userUpdateData.roles.push(...elementsNotInArray, menteeRoleId) + } else { + userUpdateData.roles.push(...elementsNotInArray, ...existingUser.roles) + } + } else { + userUpdateData.roles.push(...elementsNotInArray, ...existingUser.roles) + } + + if (userUpdateData.roles.includes(mentorRoleId)) { + userUpdateData.roles = _.pull(userUpdateData.roles, menteeRoleId) + } + userUpdateData.refresh_tokens = [] } + //update user and user credentials table with new role organization if (isOrgUpdate || userUpdateData.roles) { - const userCredentials = await UserCredentialQueries.findOne({ + const userCred = await UserCredentialQueries.findOne({ email: encryptedEmail, }) - await userQueries.updateUser({ id: userCredentials.user_id }, userUpdateData) + await userQueries.updateUser({ id: userCred.user_id }, userUpdateData) await UserCredentialQueries.updateUser( { email: encryptedEmail, @@ -286,70 +337,100 @@ module.exports = class UserInviteHelper { { organization_id: user.organization_id } ) - const userRoles = await roleQueries.findAll({ id: existingUser.roles }) - //call event to update in mentoring - if (!userUpdateData?.roles) { + const currentRoles = utils.getRoleTitlesFromId(existingUser.roles, roleList) + let newRoles = [] + newRoles = utils.getRoleTitlesFromId( + _.difference(userUpdateData.roles, existingUser.roles), + roleList + ) + //remove session_manager role because the mentee role is enough to change role in mentoring side + newRoles = newRoles.filter((role) => role !== common.SESSION_MANAGER_ROLE) + + //call event to update organization in mentoring + if (isOrgUpdate) { eventBroadcaster('updateOrganization', { requestBody: { user_id: existingUser.id, organization_id: user.organization_id, - roles: _.map(userRoles, 'title'), + roles: currentRoles, }, }) - } else { + } + + if (newRoles.length > 0) { + //call event to update role and organization in mentoring let requestBody = { user_id: existingUser.id, - new_roles: [invitee.roles], - current_roles: _.map(userRoles, 'title'), + new_roles: newRoles, + current_roles: currentRoles, } if (isOrgUpdate) requestBody.organization_id = user.organization_id eventBroadcaster('roleChange', { requestBody, }) } + + //remove user data from redis const redisUserKey = common.redisUserPrefix + existingUser.id.toString() await utils.redisDel(redisUserKey) + invitee.statusOrUserId = 'success' + } else { + invitee.statusOrUserId = 'No updates needed. User details are already up to date' } + } else { + //user doesn't have access to update user data + invitee.statusOrUserId = 'Unauthorized to update user details in a different organization.' } } else { + //new user invitee creation const inviteeData = { ...invitee, status: common.UPLOADED_STATUS, organization_id: user.organization_id, file_id: fileUploadId, - roles: roleTitlesToIds[invitee.roles] || [], - } - inviteeData.email = encryptedEmail - - if (existingInvitees.hasOwnProperty(encryptedEmail)) { - invitee.statusOrUserId = 'USER_ALREADY_EXISTS' - input.push(invitee) - continue + roles: (invitee.roles || []).map((roleTitle) => roleTitlesToIds[roleTitle.toLowerCase()] || []), + email: encryptedEmail, } + inviteeData.email = encryptedEmail const newInvitee = await userInviteQueries.create(inviteeData) - if (newInvitee.id) { + + if (newInvitee?.id) { + console.log(newInvitee.roles, 'newInvitee.roles') invitee.statusOrUserId = newInvitee.id + + //create user credentials entry const newUserCred = await UserCredentialQueries.create({ email: newInvitee.email, organization_id: newInvitee.organization_id, organization_user_invite_id: newInvitee.id, }) - if (newUserCred.id) { - const { name, email, roles } = invitee + + if (newUserCred?.id) { + const { name, email } = invitee + const roles = utils.getRoleTitlesFromId(newInvitee.roles, roleList) + const roleToString = + roles.length > 0 + ? roles + .map((role) => + role.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase()) + ) + .join(' and ') + : '' + const userData = { name, email, - role: roles, + role: roleToString, org_name: user.org_name, } - const templateData = templates[roles] - //send email invitation for user - if (templateData && Object.keys(templateData).length > 0) { - await this.sendInviteeEmail(templateData, userData) + //send email invitation for new user + if (emailTemplate) { + await this.sendInviteeEmail(emailTemplate, userData, null, { roles: roleToString }) } } else { + //delete invitation entry isErrorOccured = true await userInviteQueries.deleteOne(newInvitee.id) invitee.statusOrUserId = newUserCred @@ -360,12 +441,14 @@ module.exports = class UserInviteHelper { } } + //convert roles array to string + invitee.roles = invitee.roles.length > 0 ? invitee.roles.join(',') : '' input.push(invitee) } + //generate output csv const csvContent = utils.generateCSVContent(input) const outputFilePath = path.join(inviteeFileDir, outputFileName) - fs.writeFileSync(outputFilePath, csvContent) return { @@ -418,13 +501,16 @@ module.exports = class UserInviteHelper { } } - static async sendInviteeEmail(templateData, userData, inviteeUploadURL = null) { + static async sendInviteeEmail(templateData, userData, inviteeUploadURL = null, subjectComposeData = {}) { try { const payload = { type: common.notificationEmailType, email: { to: userData.email, - subject: templateData.subject, + subject: + subjectComposeData && Object.keys(subjectComposeData).length > 0 + ? utils.composeEmailBody(templateData.subject, subjectComposeData) + : templateData.subject, body: utils.composeEmailBody(templateData.body, { name: userData.name, role: userData.role || '', @@ -432,12 +518,12 @@ module.exports = class UserInviteHelper { appName: process.env.APP_NAME, inviteeUploadURL, portalURL: process.env.PORTAL_URL, + roles: userData.roles || '', }), }, } await kafkaCommunication.pushEmailToKafka(payload) - return { success: true, } From 6401d676b7526fb997ed5fb0874c56b0d60ec795 Mon Sep 17 00:00:00 2001 From: "priyanka@TL" Date: Mon, 22 Jan 2024 09:27:55 +0530 Subject: [PATCH 095/109] registration email changes --- ...0122020148-update_registration_template.js | 38 +++++++++++++++++++ src/services/account.js | 18 +++++++++ 2 files changed, 56 insertions(+) create mode 100644 src/database/seeders/20240122020148-update_registration_template.js diff --git a/src/database/seeders/20240122020148-update_registration_template.js b/src/database/seeders/20240122020148-update_registration_template.js new file mode 100644 index 000000000..5ec00d1fa --- /dev/null +++ b/src/database/seeders/20240122020148-update_registration_template.js @@ -0,0 +1,38 @@ +module.exports = { + up: async (queryInterface, Sequelize) => { + const defaultOrgId = queryInterface.sequelize.options.defaultOrgId + if (!defaultOrgId) { + throw new Error('Default org ID is undefined. Please make sure it is set in sequelize options.') + } + + const registrationTemplate = await queryInterface.sequelize.query( + `SELECT * FROM notification_templates WHERE code = :code AND organization_id = :organization_id LIMIT 1`, + { + replacements: { + code: process.env.REGISTRATION_EMAIL_TEMPLATE_CODE, + organization_id: defaultOrgId, + }, + type: Sequelize.QueryTypes.SELECT, + } + ) + + if (registrationTemplate) { + const update = await queryInterface.sequelize.query( + `UPDATE notification_templates SET body = :body WHERE code = :code AND organization_id = :organization_id`, + { + replacements: { + code: process.env.REGISTRATION_EMAIL_TEMPLATE_CODE, + organization_id: defaultOrgId, + body: '

    Dear {name},

    Welcome to {appName} community! . We are excited for you to start your journey as a {roles}.

    Login to MentorED to start your journey
    Click to register: {portalURL}', + }, + type: Sequelize.QueryTypes.UPDATE, + } + ) + console.log(update, 'update') + } else { + console.log('Registration template not found') + } + }, + + down: async (queryInterface, Sequelize) => {}, +} diff --git a/src/services/account.js b/src/services/account.js index 724f670aa..5e1a5e5f6 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -235,6 +235,23 @@ module.exports = class AccountHelper { user.user_roles = roleData + // format the roles for email template + let roleArray = [] + if (roleData.length > 0) { + const mentorRoleExists = roleData.some((role) => role.title === common.MENTOR_ROLE) + if (mentorRoleExists) { + const updatedRoleList = roleData.filter((role) => role.title !== common.MENTEE_ROLE) + roleArray = _.map(updatedRoleList, 'title') + } + } + + let roleToString = + roleArray.length > 0 + ? roleArray + .map((role) => role.replace(/_/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase())) + .join(' and ') + : '' + const accessToken = utilsHelper.generateToken( tokenDetail, process.env.ACCESS_TOKEN_SECRET, @@ -291,6 +308,7 @@ module.exports = class AccountHelper { body: utilsHelper.composeEmailBody(templateData.body, { name: bodyData.name, appName: process.env.APP_NAME, + roles: roleToString || '', }), }, } From d212706b35029fdb33f1673e693ec9a457e66280 Mon Sep 17 00:00:00 2001 From: "priyanka@TL" Date: Mon, 22 Jan 2024 09:34:38 +0530 Subject: [PATCH 096/109] added portal url is registration template --- src/services/account.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/services/account.js b/src/services/account.js index 5e1a5e5f6..0b33be187 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -309,6 +309,7 @@ module.exports = class AccountHelper { name: bodyData.name, appName: process.env.APP_NAME, roles: roleToString || '', + portalURL: process.env.PORTAL_URL, }), }, } From 1b7c7a2c648ffe846f23ff73101b0bc93038b446 Mon Sep 17 00:00:00 2001 From: "priyanka@TL" Date: Mon, 22 Jan 2024 14:58:37 +0530 Subject: [PATCH 097/109] convert seeder to migration file --- .../20240122091311-create-generic-invitation-template.js} | 4 +++- .../20240122092217-update-registration-template.js} | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) rename src/database/{seeders/20240118145750-add_generic_invitation_email_template.js => migrations/20240122091311-create-generic-invitation-template.js} (88%) rename src/database/{seeders/20240122020148-update_registration_template.js => migrations/20240122092217-update-registration-template.js} (91%) diff --git a/src/database/seeders/20240118145750-add_generic_invitation_email_template.js b/src/database/migrations/20240122091311-create-generic-invitation-template.js similarity index 88% rename from src/database/seeders/20240118145750-add_generic_invitation_email_template.js rename to src/database/migrations/20240122091311-create-generic-invitation-template.js index 4af1445da..78ba2a30f 100644 --- a/src/database/seeders/20240118145750-add_generic_invitation_email_template.js +++ b/src/database/migrations/20240122091311-create-generic-invitation-template.js @@ -1,5 +1,7 @@ +'use strict' const moment = require('moment') +/** @type {import('sequelize-cli').Migration} */ module.exports = { up: async (queryInterface, Sequelize) => { const defaultOrgId = queryInterface.sequelize.options.defaultOrgId @@ -25,6 +27,6 @@ module.exports = { }, down: async (queryInterface, Sequelize) => { - await queryInterface.bulkDelete('notification_templates', null, {}) + await queryInterface.bulkDelete('notification_templates', { code: 'generic_invite' }) }, } diff --git a/src/database/seeders/20240122020148-update_registration_template.js b/src/database/migrations/20240122092217-update-registration-template.js similarity index 91% rename from src/database/seeders/20240122020148-update_registration_template.js rename to src/database/migrations/20240122092217-update-registration-template.js index 5ec00d1fa..1a3d6ad31 100644 --- a/src/database/seeders/20240122020148-update_registration_template.js +++ b/src/database/migrations/20240122092217-update-registration-template.js @@ -1,10 +1,12 @@ +'use strict' + +/** @type {import('sequelize-cli').Migration} */ module.exports = { up: async (queryInterface, Sequelize) => { const defaultOrgId = queryInterface.sequelize.options.defaultOrgId if (!defaultOrgId) { throw new Error('Default org ID is undefined. Please make sure it is set in sequelize options.') } - const registrationTemplate = await queryInterface.sequelize.query( `SELECT * FROM notification_templates WHERE code = :code AND organization_id = :organization_id LIMIT 1`, { @@ -34,5 +36,7 @@ module.exports = { } }, - down: async (queryInterface, Sequelize) => {}, + down: async (queryInterface, Sequelize) => { + //not required + }, } From b07dcd04a1aaaad7241c01c777034fedec347da9 Mon Sep 17 00:00:00 2001 From: joffinjoy Date: Tue, 23 Jan 2024 08:59:44 +0530 Subject: [PATCH 098/109] Encryted Email Id Fix --- src/services/account.js | 3 ++- src/services/user.js | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/services/account.js b/src/services/account.js index 066c087ae..e1f2a2f26 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -317,6 +317,7 @@ module.exports = class AccountHelper { await kafkaCommunication.pushEmailToKafka(payload) } + result.user.email = plaintextEmailId return common.successResponse({ statusCode: httpStatusCode.created, message: 'USER_CREATED_SUCCESSFULLY', @@ -463,7 +464,7 @@ module.exports = class AccountHelper { if (user && user.image) { user.image = await utils.getDownloadableUrl(user.image) } - + user.email = plaintextEmailId const result = { access_token: accessToken, refresh_token: refreshToken, user } return common.successResponse({ diff --git a/src/services/user.js b/src/services/user.js index e0eb1282d..9865ad69e 100644 --- a/src/services/user.js +++ b/src/services/user.js @@ -18,6 +18,7 @@ const { removeDefaultOrgEntityTypes } = require('@generics/utils') const _ = require('lodash') const { Op } = require('sequelize') const { eventBroadcaster } = require('@helpers/eventBroadcaster') +const emailEncryption = require('@utils/emailEncryption') module.exports = class UserHelper { /** @@ -111,6 +112,7 @@ module.exports = class UserHelper { ) delete processDbResponse.refresh_tokens delete processDbResponse.password + processDbResponse.email = emailEncryption.decrypt(processDbResponse.email) return common.successResponse({ statusCode: httpStatusCode.accepted, message: 'PROFILE_UPDATED_SUCCESSFULLY', @@ -201,7 +203,7 @@ module.exports = class UserHelper { if (utils.validateRoleAccess(roles, common.MENTOR_ROLE)) { await utils.redisSet(redisUserKey, processDbResponse) } - + processDbResponse.email = emailEncryption.decrypt(processDbResponse.email) return common.successResponse({ statusCode: httpStatusCode.ok, message: 'PROFILE_FETCHED_SUCCESSFULLY', From ad161dc8955a0e1700cb19445b7814d059960e69 Mon Sep 17 00:00:00 2001 From: "priyanka@TL" Date: Tue, 23 Jan 2024 09:16:24 +0530 Subject: [PATCH 099/109] migration for update session manager role --- ...make-session-manager-to-non-system-role.js | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/database/migrations/20240123032543-make-session-manager-to-non-system-role.js diff --git a/src/database/migrations/20240123032543-make-session-manager-to-non-system-role.js b/src/database/migrations/20240123032543-make-session-manager-to-non-system-role.js new file mode 100644 index 000000000..ba5c201fe --- /dev/null +++ b/src/database/migrations/20240123032543-make-session-manager-to-non-system-role.js @@ -0,0 +1,42 @@ +'use strict' + +/** @type {import('sequelize-cli').Migration} */ +module.exports = { + up: async (queryInterface, Sequelize) => { + const defaultOrgId = queryInterface.sequelize.options.defaultOrgId + if (!defaultOrgId) { + throw new Error('Default org ID is undefined. Please make sure it is set in sequelize options.') + } + const userRole = await queryInterface.sequelize.query( + `SELECT * FROM user_roles WHERE title = :title AND organization_id = :organization_id LIMIT 1`, + { + replacements: { + title: 'session_manager', + organization_id: defaultOrgId, + }, + type: Sequelize.QueryTypes.SELECT, + } + ) + + if (userRole) { + const update = await queryInterface.sequelize.query( + `UPDATE user_roles SET user_type = :user_type WHERE title = :title AND organization_id = :organization_id`, + { + replacements: { + title: 'session_manager', + organization_id: defaultOrgId, + user_type: 0, + }, + type: Sequelize.QueryTypes.UPDATE, + } + ) + console.log(update, 'update') + } else { + console.log('role session manager not found') + } + }, + + down: async (queryInterface, Sequelize) => { + //not required + }, +} From a6d5cbd24cbcb43e4704038c6681644a6a683886 Mon Sep 17 00:00:00 2001 From: Nevil Date: Tue, 23 Jan 2024 12:48:53 +0530 Subject: [PATCH 100/109] updated validators to handle new fields --- src/validators/v1/entity-type.js | 38 +++++++++++++++++++++++++------- src/validators/v1/entity.js | 27 ++++++++++++++++++----- 2 files changed, 51 insertions(+), 14 deletions(-) diff --git a/src/validators/v1/entity-type.js b/src/validators/v1/entity-type.js index d265c2819..bad31c781 100644 --- a/src/validators/v1/entity-type.js +++ b/src/validators/v1/entity-type.js @@ -1,5 +1,5 @@ /** - * name : validators/v1/entity-types.js + * name : validators/v1/entity.js * author : Aman Gupta * Date : 04-Nov-2021 * Description : Validations of user entities controller @@ -11,7 +11,7 @@ module.exports = { .trim() .notEmpty() .withMessage('value field is empty') - .matches(/^[A-Za-z]+$/) + .matches(/^[A-Za-z_]+$/) .withMessage('value is invalid, must not contain spaces') req.checkBody('label') @@ -28,6 +28,15 @@ module.exports = { .matches(/^[A-Za-z]+$/) .withMessage('data_type is invalid, must not contain spaces') + req.checkBody('model_names') + .isArray() + .notEmpty() + .withMessage('model_names must be an array with at least one element') + + req.checkBody('model_names.*') + .isIn(['Session', 'MentorExtension', 'UserExtension']) + .withMessage('model_names must be in Session,MentorExtension,UserExtension') + req.checkBody('allow_filtering').optional().isEmpty().withMessage('allow_filtering is not allowed in create') }, @@ -49,24 +58,37 @@ module.exports = { .matches(/^[A-Z]+$/) .withMessage('status is invalid, must be in all caps') + req.checkBody('deleted').optional().isBoolean().withMessage('deleted is invalid') + req.checkBody('allow_filtering').optional().isEmpty().withMessage('allow_filtering is not allowed in create') + req.checkBody('data_type') - .optional() + .trim() + .notEmpty() + .withMessage('data_type field is empty') .matches(/^[A-Za-z]+$/) .withMessage('data_type is invalid, must not contain spaces') - req.checkBody('allow_filtering').optional().isEmpty().withMessage('allow_filtering is not allowed in create') + req.checkBody('model_names') + .isArray() + .notEmpty() + .withMessage('model_names must be an array with at least one element') + + req.checkBody('model_names.*') + .isIn(['Session', 'MentorExtension', 'UserExtension']) + .withMessage('model_names must be in Session,MentorExtension,UserExtension') }, read: (req) => { - console.log() - if (req.query.data_type) { - req.checkQuery('data_type') + if (req.query.type) { + req.checkQuery('type') .trim() .notEmpty() - .withMessage('data_type field is empty') + .withMessage('type field is empty') .matches(/^[A-Za-z]+$/) .withMessage('type is invalid, must not contain spaces') + req.checkQuery('deleted').optional().isBoolean().withMessage('deleted is invalid') + req.checkQuery('status') .optional() .trim() diff --git a/src/validators/v1/entity.js b/src/validators/v1/entity.js index 87c588638..ddaf66a65 100644 --- a/src/validators/v1/entity.js +++ b/src/validators/v1/entity.js @@ -21,12 +21,11 @@ module.exports = { .matches(/^[A-Za-z0-9 ]+$/) .withMessage('label is invalid') - req.checkBody('type') - .trim() + req.checkBody('entity_type_id') .notEmpty() - .withMessage('type field is empty') - .matches(/^[A-Za-z]+$/) - .withMessage('type is invalid, must not contain spaces') + .withMessage('entity_type_id field is empty') + .isNumeric() + .withMessage('entity_type_id is invalid, must be numeric') }, update: (req) => { @@ -55,7 +54,23 @@ module.exports = { .withMessage('type is invalid, must not contain spaces') }, - read: (req) => {}, + read: (req) => { + req.checkQuery('id') + .trim() + .optional() + .notEmpty() + .withMessage('id param is empty') + .isNumeric() + .withMessage('id param is invalid, must be an integer') + + req.checkQuery('value') + .trim() + .optional() + .notEmpty() + .withMessage('value field is empty') + .matches(/^[A-Za-z0-9 ]+$/) + .withMessage('value is invalid, must not contain spaces') + }, delete: (req) => { req.checkParams('id').notEmpty().withMessage('id param is empty') From 3ef5e2c9994bc1cb1d0cd2105b0d11f52550ec24 Mon Sep 17 00:00:00 2001 From: Nevil Date: Tue, 23 Jan 2024 12:50:53 +0530 Subject: [PATCH 101/109] updated entity type queries --- src/services/account.js | 3 +++ src/services/user.js | 2 ++ 2 files changed, 5 insertions(+) diff --git a/src/services/account.js b/src/services/account.js index 066c087ae..ba1f81d94 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -450,13 +450,16 @@ module.exports = class AccountHelper { { attributes: ['id'] } ) let defaultOrgId = defaultOrg.id + const modelName = await userQueries.getModelName() let validationData = await entityTypeQueries.findUserEntityTypesAndEntities({ status: 'ACTIVE', organization_id: { [Op.in]: [user.organization_id, defaultOrgId], }, + model_names: { [Op.contains]: [modelName] }, }) + const prunedEntities = removeDefaultOrgEntityTypes(validationData, user.organization_id) user = utils.processDbResponse(user, prunedEntities) diff --git a/src/services/user.js b/src/services/user.js index e0eb1282d..27099668d 100644 --- a/src/services/user.js +++ b/src/services/user.js @@ -64,6 +64,7 @@ module.exports = class UserHelper { organization_id: { [Op.in]: [orgId, defaultOrgId], }, + model_names: { [Op.contains]: [await userQueries.getModelName()] }, } let validationData = await entityTypeQueries.findUserEntityTypesAndEntities(filter) const prunedEntities = removeDefaultOrgEntityTypes(validationData) @@ -194,6 +195,7 @@ module.exports = class UserHelper { organization_id: { [Op.in]: [user.organization_id, defaultOrgId], }, + model_names: { [Op.contains]: [await userQueries.getModelName()] }, }) const prunedEntities = removeDefaultOrgEntityTypes(validationData, user.organization_id) const processDbResponse = utils.processDbResponse(user, prunedEntities) From f651e4155754f970f421bafeb3dc81a17564d701 Mon Sep 17 00:00:00 2001 From: "priyanka@TL" Date: Tue, 23 Jan 2024 12:51:10 +0530 Subject: [PATCH 102/109] email issue fix for mentor request approval --- src/services/org-admin.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/services/org-admin.js b/src/services/org-admin.js index c53e5e5b8..478218982 100644 --- a/src/services/org-admin.js +++ b/src/services/org-admin.js @@ -264,7 +264,8 @@ module.exports = class OrgAdminHelper { id: requestDetails.requester_id, organization_id: tokenInformation.organization_id, }) - console.log(shouldSendEmail, 'shouldSendEmail') + + console.log(isApproved, 'isApproved') if (isApproved) { await updateRoleForApprovedRequest(requestDetails, user) } @@ -280,6 +281,7 @@ module.exports = class OrgAdminHelper { result: requestDetails, }) } catch (error) { + console.log(error, 'errorrrr') throw error } } @@ -494,7 +496,7 @@ async function sendRoleRequestStatusEmail(userDetails, status) { const payload = { type: common.notificationEmailType, email: { - to: userDetails.email, + to: emailEncryption.decrypt(userDetails.email), subject: templateData.subject, body: utils.composeEmailBody(templateData.body, { name: userDetails.name, From 1a0057353b446a1bd05efc0c0d878a6e31347a06 Mon Sep 17 00:00:00 2001 From: Nevil Date: Tue, 23 Jan 2024 14:03:54 +0530 Subject: [PATCH 103/109] updated name --- src/validators/v1/entity-type.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/validators/v1/entity-type.js b/src/validators/v1/entity-type.js index bad31c781..fca56b740 100644 --- a/src/validators/v1/entity-type.js +++ b/src/validators/v1/entity-type.js @@ -1,5 +1,5 @@ /** - * name : validators/v1/entity.js + * name : validators/v1/entity-type.js * author : Aman Gupta * Date : 04-Nov-2021 * Description : Validations of user entities controller From a6ffb9a342c298daa5afa2f21b486e43f61337e6 Mon Sep 17 00:00:00 2001 From: "priyanka@TL" Date: Tue, 23 Jan 2024 14:09:28 +0530 Subject: [PATCH 104/109] mentor role request issue fix --- src/database/queries/orgRoleRequest.js | 2 ++ src/services/org-admin.js | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/database/queries/orgRoleRequest.js b/src/database/queries/orgRoleRequest.js index 2b98a30f3..0e799d1a6 100644 --- a/src/database/queries/orgRoleRequest.js +++ b/src/database/queries/orgRoleRequest.js @@ -69,12 +69,14 @@ exports.requestDetails = async (filter, options = {}) => { const requester = await User.findOne({ where: { id: reqDetails.requester_id }, attributes: ['id', 'name'], + raw: true, }) const handler = reqDetails.handled_by ? await User.findOne({ where: { id: reqDetails.handled_by }, attributes: ['id', 'name'], + raw: true, }) : null diff --git a/src/services/org-admin.js b/src/services/org-admin.js index 478218982..25cd92c2c 100644 --- a/src/services/org-admin.js +++ b/src/services/org-admin.js @@ -241,6 +241,7 @@ module.exports = class OrgAdminHelper { { id: requestId, organization_id: tokenInformation.organization_id }, bodyData ) + if (rowsAffected === 0) { return common.failureResponse({ message: 'ORG_ROLE_REQ_FAILED', @@ -281,7 +282,7 @@ module.exports = class OrgAdminHelper { result: requestDetails, }) } catch (error) { - console.log(error, 'errorrrr') + console.log(error, 'error') throw error } } @@ -437,7 +438,8 @@ function updateRoleForApprovedRequest(requestDetails, user) { }, }) - let rolesToUpdate = [...requestDetails.role] + let rolesToUpdate = [requestDetails.role] + let currentUserRoleIds = _.map(userRoles, 'id') //remove mentee role from roles array @@ -467,6 +469,7 @@ function updateRoleForApprovedRequest(requestDetails, user) { success: true, }) } catch (error) { + console.log(error, 'error') return error } }) From ae5beaf782f94a76a1b5f2d04d922a26da3e7e41 Mon Sep 17 00:00:00 2001 From: "priyanka@TL" Date: Tue, 23 Jan 2024 16:31:17 +0530 Subject: [PATCH 105/109] roles issue fix in email --- src/services/userInvite.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/userInvite.js b/src/services/userInvite.js index e1bffb917..cbac38ffa 100644 --- a/src/services/userInvite.js +++ b/src/services/userInvite.js @@ -421,7 +421,7 @@ module.exports = class UserInviteHelper { const userData = { name, email, - role: roleToString, + roles: roleToString, org_name: user.org_name, } From 185a7d830daea8c0a27977631fe76cc20d3dd86e Mon Sep 17 00:00:00 2001 From: Nevil Date: Wed, 24 Jan 2024 13:05:08 +0530 Subject: [PATCH 106/109] fixed an issue with email decrypt --- src/services/user.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/services/user.js b/src/services/user.js index 94b8b4cfd..ee925391f 100644 --- a/src/services/user.js +++ b/src/services/user.js @@ -212,6 +212,7 @@ module.exports = class UserHelper { result: processDbResponse ? processDbResponse : {}, }) } else { + userDetails.email = emailEncryption.decrypt(userDetails.email) return common.successResponse({ statusCode: httpStatusCode.ok, message: 'PROFILE_FETCHED_SUCCESSFULLY', From c74fb59e5003013850c8dfef12eee53c0772618c Mon Sep 17 00:00:00 2001 From: "priyanka@TL" Date: Wed, 24 Jan 2024 18:11:44 +0530 Subject: [PATCH 107/109] clear env variables --- README.md | 9 --------- dev-ops/integration_test.env | 12 ------------ src/.env.sample | 15 --------------- src/configs/kafka.js | 2 +- src/envVariables.js | 21 --------------------- 5 files changed, 1 insertion(+), 58 deletions(-) diff --git a/README.md b/README.md index e60d0483f..02437da5e 100644 --- a/README.md +++ b/README.md @@ -170,9 +170,6 @@ Elevate user services can be setup in local using two methods: # Database connectivity url MONGODB_URL = mongodb://localhost:27017/db-name - # Number of rounds for encryption - SALT_ROUNDS = 10 - # Token secret to generate access token ACCESS_TOKEN_SECRET = 'access-token-secret' @@ -230,12 +227,6 @@ Elevate user services can be setup in local using two methods: # Internal access token for communicationcation between services via network call INTERNAL_ACCESS_TOKEN = 'internal-access-token' - # Mentor screct code for registering - MENTOR_SECRET_CODE = 'secret-code' - - #Enable logging of network request - ENABLE_LOG = true - # JWT Access Token expiry In Days ACCESS_TOKEN_EXPIRY = '1' diff --git a/dev-ops/integration_test.env b/dev-ops/integration_test.env index 2365ba6d1..9c9c6116c 100644 --- a/dev-ops/integration_test.env +++ b/dev-ops/integration_test.env @@ -9,10 +9,6 @@ APPLICATION_ENV = development # Database connectivity url MONGODB_URL = mongodb://mongo:27017/elevate-mentoring - -# Number of rounds for encryption -SALT_ROUNDS = 10 - # Token secret to generate access token ACCESS_TOKEN_SECRET = 'test' @@ -70,12 +66,6 @@ DEFAULT_AZURE_CONTAINER_NAME = 'azure-container-storage-name' # Internal access token for communicationcation between services via network call INTERNAL_ACCESS_TOKEN = 'internal-access-token' -# Mentor screct code for registering -MENTOR_SECRET_CODE = 'secret-code' - -#Enable logging of network request -ENABLE_LOG = true - # JWT Access Token expiry In Days ACCESS_TOKEN_EXPIRY = '1' @@ -102,8 +92,6 @@ SUPPORT_EMAIL_ID = 'support@xyz.com,team@xyz.com' #Email template code for reported issue. REPORT_ISSUE_EMAIL_TEMPLATE_CODE = 'user_issue_reported' -#kafka rating topic -RATING_KAFKA_TOPIC = 'Rating' #Internal cache expiry time INTERNAL_CACHE_EXP_TIME = 86400 diff --git a/src/.env.sample b/src/.env.sample index 35d04d684..3f3e71554 100644 --- a/src/.env.sample +++ b/src/.env.sample @@ -9,9 +9,6 @@ APPLICATION_ENV = development # Database connectivity url MONGODB_URL = mongodb://localhost:27017/db-name -# Number of rounds for encryption -SALT_ROUNDS = 10 - # Token secret to generate access token ACCESS_TOKEN_SECRET = 'access-token-secret' @@ -84,9 +81,6 @@ OCI_BUCKET_REGION= 'ap-hyderabad-1' # Internal access token for communicationcation between services via network call INTERNAL_ACCESS_TOKEN = 'internal-access-token' -# Mentor screct code for registering -MENTOR_SECRET_CODE = 'secret-code' - # JWT Access Token expiry In Days ACCESS_TOKEN_EXPIRY = '1' @@ -105,9 +99,6 @@ ENABLE_EMAIL_OTP_VERIFICATION = true # Api doc url API_DOC_URL = '/api-doc' -#kafka rating topic -RATING_KAFKA_TOPIC = 'Rating' - #Internal cache expiry time INTERNAL_CACHE_EXP_TIME = 86400 @@ -144,12 +135,6 @@ MENTORING_SERVICE_URL=http://localhost:3000 #Default queue for process invitee upload DEFAULT_QUEUE=user-queue -#Email template for mentor invitation -MENTOR_INVITATION_EMAIL_TEMPLATE_CODE=invite_mentor - -#Email template for mentee invitation -MENTEE_INVITATION_EMAIL_TEMPLATE_CODE=invite_mentee - #Email template for mentor role request accepted MENTOR_REQUEST_ACCEPTED_EMAIL_TEMPLATE_CODE=mentor_request_accepted diff --git a/src/configs/kafka.js b/src/configs/kafka.js index 173d96467..6e4017d6c 100644 --- a/src/configs/kafka.js +++ b/src/configs/kafka.js @@ -36,7 +36,7 @@ module.exports = async () => { }) const subscribeToConsumer = async () => { - await consumer.subscribe({ topics: [process.env.RATING_KAFKA_TOPIC, process.env.CLEAR_INTERNAL_CACHE] }) + await consumer.subscribe({ topics: [process.env.CLEAR_INTERNAL_CACHE] }) await consumer.run({ eachMessage: async ({ topic, partition, message }) => { try { diff --git a/src/envVariables.js b/src/envVariables.js index 44d5f78da..9e0bb7c2a 100644 --- a/src/envVariables.js +++ b/src/envVariables.js @@ -15,10 +15,6 @@ let enviromentVariables = { message: 'Required mongodb url', optional: false, }, - SALT_ROUNDS: { - message: 'Required salt rounds for encryption', - optional: false, - }, ACCESS_TOKEN_SECRET: { message: 'Required access token secret', optional: false, @@ -103,10 +99,6 @@ let enviromentVariables = { message: 'Required azure container name', optional: process.env.CLOUD_STORAGE === 'AZURE' ? false : true, }, - MENTOR_SECRET_CODE: { - message: 'Required mentor secret code', - optional: false, - }, ACCESS_TOKEN_EXPIRY: { message: 'Required access token expiry in days', optional: false, @@ -123,11 +115,6 @@ let enviromentVariables = { message: 'Internal Cache Expiry Time', optional: false, }, - - RATING_KAFKA_TOPIC: { - message: 'Kafka Rating Topic', - optional: false, - }, REDIS_HOST: { message: 'Redis Host Url', optional: false, @@ -189,14 +176,6 @@ let enviromentVariables = { message: 'Required Mentoring Service Url', optional: false, }, - MENTOR_INVITATION_EMAIL_TEMPLATE_CODE: { - message: 'Required mentor invitation email template code', - optional: false, - }, - MENTEE_INVITATION_EMAIL_TEMPLATE_CODE: { - message: 'Required mentee invitation email template code', - optional: false, - }, ADMIN_INVITEE_UPLOAD_EMAIL_TEMPLATE_CODE: { message: 'Required admin upload invitee email template code', optional: false, From f273e9fe4b488b9d31cc8a08060c95b256563c03 Mon Sep 17 00:00:00 2001 From: Nevil Date: Wed, 24 Jan 2024 19:40:29 +0530 Subject: [PATCH 108/109] removed all mongo related dependencies --- src/configs/index.js | 1 - src/configs/mongodb.js | 62 ---------- src/db/forms/model.js | 61 ---------- src/db/forms/queries.js | 57 --------- src/db/notification-template/model.js | 61 ---------- src/db/notification-template/query.js | 70 ----------- src/db/systemUsers/model.js | 40 ------- src/db/systemUsers/queries.js | 29 ----- src/db/userentities/model.js | 50 -------- src/db/userentities/query.js | 64 ---------- src/db/users/model.js | 92 -------------- src/db/users/queries.js | 166 -------------------------- src/health-checks/health-check.js | 7 -- src/health-checks/mongodb.js | 25 ---- src/package.json | 7 -- src/scripts/apEmailTemp.js | 67 ----------- src/scripts/updateEmailTemplates.js | 28 ----- src/services/account.js | 1 - src/services/mentors.js | 84 ------------- 19 files changed, 972 deletions(-) delete mode 100644 src/configs/mongodb.js delete mode 100644 src/db/forms/model.js delete mode 100644 src/db/forms/queries.js delete mode 100644 src/db/notification-template/model.js delete mode 100644 src/db/notification-template/query.js delete mode 100644 src/db/systemUsers/model.js delete mode 100644 src/db/systemUsers/queries.js delete mode 100644 src/db/userentities/model.js delete mode 100644 src/db/userentities/query.js delete mode 100644 src/db/users/model.js delete mode 100644 src/db/users/queries.js delete mode 100644 src/health-checks/mongodb.js delete mode 100644 src/scripts/apEmailTemp.js delete mode 100644 src/scripts/updateEmailTemplates.js delete mode 100644 src/services/mentors.js diff --git a/src/configs/index.js b/src/configs/index.js index dbf0e6e1c..dcca37b71 100644 --- a/src/configs/index.js +++ b/src/configs/index.js @@ -6,7 +6,6 @@ */ //Dependencies -require('./mongodb')() require('./kafka')() require('./cache')() require('./aes256cbc')() diff --git a/src/configs/mongodb.js b/src/configs/mongodb.js deleted file mode 100644 index 32badace2..000000000 --- a/src/configs/mongodb.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * name : configs/mongodb - * author : Aman - * Date : 07-Oct-2021 - * Description : Mongodb connections configurations - */ - -//Dependencies -const mongoose = require('mongoose') -const mongoose_autopopulate = require('mongoose-autopopulate') -const mongoose_timestamp = require('mongoose-timestamp') - -/* -Uses MongoDB v4.1.4, which has an OSI Compliant License (GNU Affero General Public License, version 3) -MongoDB v4.1.4 repository: https://github.com/mongodb/mongo/tree/r4.1.4 -MongoDB v4.1.4 License: https://github.com/mongodb/mongo/blob/r4.1.4/LICENSE-Community.txt -*/ - -const { elevateLog } = require('elevate-logger') -const logger = elevateLog.init() - -module.exports = function () { - // Added to remove depreciation warnings from logs. - - let parameters = '' - if (process.env.REPLICA_SET_NAME) { - parameters = '?replicaSet=' + process.env.REPLICA_SET_NAME - } - if (process.env.REPLICA_SET_NAME && process.env.REPLICA_SET_READ_PREFERENCE) { - parameters = parameters + '&readPreference=' + process.env.REPLICA_SET_READ_PREFERENCE - } - - let db - if (!parameters) { - db = mongoose.createConnection(process.env.MONGODB_URL, { - useNewUrlParser: true, - }) - } else { - db = mongoose.createConnection(process.env.MONGODB_URL + parameters, { - useNewUrlParser: true, - }) - } - - db.on('error', function () { - logger.error('Database connection error:', { - triggerNotification: true, - }) - }) - - db.once('open', function () { - logger.info('Connected to DB') - }) - - mongoose.plugin(mongoose_timestamp, { - createdAt: 'createdAt', - updatedAt: 'updatedAt', - }) - - mongoose.plugin(mongoose_autopopulate) - - global.db = db -} diff --git a/src/db/forms/model.js b/src/db/forms/model.js deleted file mode 100644 index dfe495ecf..000000000 --- a/src/db/forms/model.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * name : db/forms/model - * author : Aman Gupta - * Date : 03-Nov-2021 - * Description : Forms schema - */ - -// Dependencies -const mongoose = require('mongoose') -const Schema = mongoose.Schema - -const mongooseLeanGetter = require('mongoose-lean-getters') - -const formSchema = new Schema({ - type: { - type: String, - required: true, - unique: true, - }, - subType: { - type: String, - required: true, - }, - action: { - type: String, - required: true, - }, - data: { - templateName: { - type: String, - required: true, - }, - fields: { - type: Object, - required: true, - }, - }, -}) -formSchema.plugin(mongooseLeanGetter) - -formSchema.pre('updateOne', function () { - const update = this.getUpdate() - - if (update.__v != null) { - delete update.__v - } - const keys = ['$set', '$setOnInsert'] - for (const key of keys) { - if (update[key] != null && update[key].__v != null) { - delete update[key].__v - if (Object.keys(update[key]).length === 0) { - delete update[key] - } - } - } - update.$inc = update.$inc || {} - update.$inc.__v = 1 -}) -const Forms = db.model('forms', formSchema) - -module.exports = Forms diff --git a/src/db/forms/queries.js b/src/db/forms/queries.js deleted file mode 100644 index 569bf438f..000000000 --- a/src/db/forms/queries.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * name : models/forms/query - * author : Aman karki - * Date : 07-Oct-2021 - * Description : Users database operations - */ - -const Forms = require('./model') - -module.exports = class FormsData { - static async createForm(data) { - try { - await new Forms(data).save() - return true - } catch (error) { - return error - } - } - - static async findOneForm(filter, projection = {}) { - try { - const formData = await Forms.findOne(filter, projection) - return formData - } catch (error) { - return error - } - } - - static async updateOneForm(filter, update, options = {}) { - try { - const res = await Forms.updateOne(filter, update, options) - if ((res.n === 1 && res.nModified === 1) || (res.matchedCount === 1 && res.modifiedCount === 1)) { - return 'FORM_UPDATED' - } else if ((res.n === 1 && res.nModified === 0) || (res.matchedCount === 1 && res.modifiedCount === 0)) { - return 'FORM_ALREADY_EXISTS' - } else { - return 'FORM_NOT_FOUND' - } - } catch (error) { - return error - } - } - - static async findAllTypeFormVersion() { - const projection = { - _id: 1, - type: 1, - __v: 1, - } - try { - const formData = await Forms.find({}, projection) - return formData - } catch (error) { - return error - } - } -} diff --git a/src/db/notification-template/model.js b/src/db/notification-template/model.js deleted file mode 100644 index 82bb951e8..000000000 --- a/src/db/notification-template/model.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * name : db/users/model - * author : Aman Gupta - * Date : 06-Dec-2021 - * Description : Template notification model - */ - -// Dependencies -const mongoose = require('mongoose') - -const Schema = mongoose.Schema - -const mongooseLeanGetter = require('mongoose-lean-getters') - -const notificationTemplateSchema = new Schema({ - type: { - type: String, - required: true, - }, - code: { - type: String, - required: true, - unique: true, - index: true, - }, - subject: { - type: String, - required: true, - }, - body: { - type: String, - required: true, - }, - status: { - type: String, - required: true, - }, - deleted: { - type: Boolean, - default: false, - }, - createdBy: { - type: mongoose.Types.ObjectId, - required: true, - index: true, - }, - updatedBy: { - type: mongoose.Types.ObjectId, - required: true, - }, - emailHeader: { - type: String, - }, - emailFooter: { - type: String, - }, -}) -notificationTemplateSchema.plugin(mongooseLeanGetter) -const Users = db.model('notificationtemplates', notificationTemplateSchema, 'notificationTemplates') - -module.exports = Users diff --git a/src/db/notification-template/query.js b/src/db/notification-template/query.js deleted file mode 100644 index 7f0f2e0b1..000000000 --- a/src/db/notification-template/query.js +++ /dev/null @@ -1,70 +0,0 @@ -/** - * name : models/notification-template/query - * author : Aman Gupta - * Date : 06-Dec-2021 - * Description : Notification template database operations - */ - -// Dependencies -const NotificationTemplate = require('./model') - -module.exports = class NotificationTemplateData { - static async findOneEmailTemplate(code) { - const filter = { - code, - type: 'email', - deleted: false, - status: 'active', - } - - try { - const templateData = await NotificationTemplate.findOne(filter).lean() - if (templateData && templateData.emailHeader) { - const header = await this.getEmailHeader(templateData.emailHeader) - if (header && header.body) { - templateData['body'] = header.body + templateData['body'] - } - } - - if (templateData && templateData.emailFooter) { - const footer = await this.getEmailFooter(templateData.emailFooter) - if (footer && footer.body) { - templateData['body'] = templateData['body'] + footer.body - } - } - return templateData - } catch (error) { - return error - } - } - static async getEmailHeader(header) { - try { - const filterEmailHeader = { - code: header, - type: 'emailHeader', - deleted: false, - status: 'active', - } - const headerData = await NotificationTemplate.findOne(filterEmailHeader).lean() - - return headerData - } catch (error) { - return error - } - } - static async getEmailFooter(footer) { - try { - const filterEmailFooter = { - code: footer, - type: 'emailFooter', - deleted: false, - status: 'active', - } - const footerData = await NotificationTemplate.findOne(filterEmailFooter).lean() - - return footerData - } catch (error) { - return error - } - } -} diff --git a/src/db/systemUsers/model.js b/src/db/systemUsers/model.js deleted file mode 100644 index 2dd6806da..000000000 --- a/src/db/systemUsers/model.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * name : db/users/model - * author : Aman Karki - * Date : 10-Nov-2021 - * Description : System User schema data - */ - -// Dependencies -const mongoose = require('mongoose') -const Schema = mongoose.Schema -const mongooseLeanGetter = require('mongoose-lean-getters') - -const userSchema = new Schema({ - email: { - address: { - type: String, - index: { - unique: true, - }, - required: true, - }, - verified: { - type: Boolean, - default: false, - }, - }, - password: { - type: String, - required: true, - }, - name: { - type: String, - required: true, - }, - role: String, -}) -userSchema.plugin(mongooseLeanGetter) -const SystemUsers = db.model('systemUsers', userSchema, 'systemUsers') - -module.exports = SystemUsers diff --git a/src/db/systemUsers/queries.js b/src/db/systemUsers/queries.js deleted file mode 100644 index 3b1def1d7..000000000 --- a/src/db/systemUsers/queries.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * name : models/systemUsers/queries - * author : Aman karki - * Date : 07-Oct-2021 - * Description : System Users database operations - */ - -const SystemUsers = require('./model') - -module.exports = class SystemUsersData { - static async findUsersByEmail(email) { - try { - const userData = await SystemUsers.findOne({ email: email }).lean() - - return userData - } catch (error) { - return error - } - } - - static async create(data) { - try { - await new SystemUsers(data).save() - return true - } catch (error) { - return error - } - } -} diff --git a/src/db/userentities/model.js b/src/db/userentities/model.js deleted file mode 100644 index 7a0fe8861..000000000 --- a/src/db/userentities/model.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * name : db/userentities/model - * author : Aman Gupta - * Date : 04-Nov-2021 - * Description : User Entity schema - */ - -// Dependencies -const mongoose = require('mongoose') - -const Schema = mongoose.Schema -const mongooseLeanGetter = require('mongoose-lean-getters') - -const userEntitySchema = new Schema({ - value: { - type: String, - required: true, - }, - label: { - type: String, - required: true, - }, - status: { - type: String, - default: 'ACTIVE', - required: true, - }, - deleted: { - type: Boolean, - default: false, - required: true, - }, - type: { - type: String, - required: true, - index: true, - }, - createdBy: { - type: mongoose.Types.ObjectId, - required: true, - }, - updatedBy: { - type: mongoose.Types.ObjectId, - required: true, - }, -}) -userEntitySchema.plugin(mongooseLeanGetter) -const UserEntities = db.model('userEntities', userEntitySchema, 'userEntities') - -module.exports = UserEntities diff --git a/src/db/userentities/query.js b/src/db/userentities/query.js deleted file mode 100644 index adbbf26aa..000000000 --- a/src/db/userentities/query.js +++ /dev/null @@ -1,64 +0,0 @@ -/** - * name : models/entities/query - * author : Aman Gupta - * Date : 04-Nov-2021 - * Description : Users entities database operations - */ - -// Dependencies -const UserEntities = require('./model') - -module.exports = class UserEntityData { - static async createEntity(data) { - try { - const userEntityDataRes = await new UserEntities(data).save() - return userEntityDataRes - } catch (error) { - return error - } - } - - static async findOneEntity(filter, projection = {}) { - try { - const userEntityData = await UserEntities.findOne(filter, projection) - return userEntityData - } catch (error) { - return error - } - } - - static async findAllEntities(filter, projection = {}) { - try { - const userEntitiesData = await UserEntities.find(filter, projection) - return userEntitiesData - } catch (error) { - return error - } - } - - static async updateOneEntity(filter, update, options = {}) { - try { - const res = await UserEntities.updateOne(filter, update, options) - if ((res.n === 1 && res.nModified === 1) || (res.matchedCount === 1 && res.modifiedCount === 1)) { - resolve('ENTITY_UPDATED') - } else if ((res.n === 1 && res.nModified === 0) || (res.matchedCount === 1 && res.modifiedCount === 0)) { - return 'ENTITY_ALREADY_EXISTS' - } else { - return 'ENTITY_NOT_FOUND' - } - } catch (error) { - return error - } - } - - static async findOne(_id) { - try { - const filter = { - _id: ObjectId(_id), - } - return await UserEntities.findOne(filter) - } catch (error) { - return error - } - } -} diff --git a/src/db/users/model.js b/src/db/users/model.js deleted file mode 100644 index 570f1bd27..000000000 --- a/src/db/users/model.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * name : db/users/model - * author : Aman Karki - * Date : 07-Oct-2021 - * Description : User schema data - */ - -// Dependencies -const mongoose = require('mongoose') -const { aes256cbc } = require('elevate-encryption') -const Schema = mongoose.Schema -// Adding the package -const mongooseLeanGetter = require('mongoose-lean-getters') - -const userSchema = new Schema( - { - email: { - address: { - type: String, - set: aes256cbc.encrypt, - get: aes256cbc.decrypt, - index: { - unique: true, - }, - required: true, - }, - verified: { - type: Boolean, - default: false, - }, - }, - password: { - type: String, - required: true, - }, - name: { - type: String, - required: true, - }, - gender: String, - designation: [{ value: String, label: String }], - location: [{ value: String, label: String }], - about: String, - shareLink: String, - areasOfExpertise: [{ value: String, label: String }], - image: String, - experience: String, - lastLoggedInAt: Date, - isAMentor: { - type: Boolean, - default: false, - index: true, - }, - hasAcceptedTAndC: { - type: Boolean, - default: false, - }, - deleted: { - type: Boolean, - default: false, - required: true, - }, - educationQualification: { - type: String, - default: null, - }, - refreshTokens: [{ token: String, exp: Number }], - otpInfo: { - otp: Number, - exp: Number, - }, - languages: [{ value: String, label: String }], - rating: { - type: Object, - }, - preferredLanguage: { - type: String, - default: 'en', - }, - deletedAt: Date, - }, - { - versionKey: false, - toObject: { getters: true, setters: true }, - toJSON: { getters: true, setters: true }, - runSettersOnQuery: true, - } -) -userSchema.plugin(mongooseLeanGetter) -const Users = db.model('users', userSchema) - -module.exports = Users diff --git a/src/db/users/queries.js b/src/db/users/queries.js deleted file mode 100644 index 76b8fd603..000000000 --- a/src/db/users/queries.js +++ /dev/null @@ -1,166 +0,0 @@ -/** - * name : models/users/query - * author : Aman karki - * Date : 07-Oct-2021 - * Description : Users database operations - */ - -// Dependencies -const ObjectId = require('mongoose').Types.ObjectId -const Users = require('./model') - -module.exports = class UsersData { - static async findOne(filter, projection = {}) { - try { - const userData = await Users.findOne(filter, projection).lean({ - getters: true, - }) - return userData - } catch (error) { - return error - } - } - - static async findAllUsers(filter, projection = {}) { - try { - const usersData = await Users.find(filter, projection).lean({ - getters: true, - }) - return usersData - } catch (error) { - return error - } - } - - static async createUser(data) { - try { - await new Users(data).save() - return true - } catch (error) { - return error - } - } - - static async updateOneUser(filter, update, options = {}) { - try { - const res = await Users.updateOne(filter, update, options) - if ((res.n === 1 && res.nModified === 1) || (res.matchedCount === 1 && res.modifiedCount === 1)) { - return true - } else { - return false - } - } catch (error) { - return error - } - } - - static async searchMentors(page, limit, search, userId, match) { - try { - if (match == 'startsWith') { - search = '^' + search - } else if (match == 'endsWith') { - search = search + '$' - } - - let users = await Users.aggregate([ - { - $match: { - deleted: false, - isAMentor: true, - _id: { - $ne: ObjectId(userId), - }, - $or: [{ name: new RegExp(search, 'i') }], - }, - }, - { - $project: { - name: 1, - image: 1, - areasOfExpertise: 1, - about: 1, - designation: 1, - rating: 1, - }, - }, - { - $sort: { name: 1 }, - }, - { - $facet: { - totalCount: [{ $count: 'count' }], - data: [{ $skip: limit * (page - 1) }, { $limit: limit }], - }, - }, - { - $project: { - data: 1, - count: { - $arrayElemAt: ['$totalCount.count', 0], - }, - }, - }, - ]).collation({ locale: 'en', caseLevel: false }) - - return users - } catch (error) { - return error - } - } - static async listUsers(type, page, limit, search) { - try { - let isAMentorFlag = true - if (type === 'mentor') { - isAMentorFlag = true - } else if (type === 'mentee') { - isAMentorFlag = false - } - let users = await Users.aggregate([ - { - $match: { - deleted: false, - isAMentor: isAMentorFlag, - $or: [{ name: new RegExp(search, 'i') }], - }, - }, - { - $project: { - name: 1, - image: 1, - areasOfExpertise: 1, - }, - }, - { - $sort: { name: 1 }, - }, - { - $facet: { - totalCount: [{ $count: 'count' }], - data: [{ $skip: limit * (page - 1) }, { $limit: limit }], - }, - }, - { - $project: { - data: 1, - count: { - $arrayElemAt: ['$totalCount.count', 0], - }, - }, - }, - ]).collation({ locale: 'en', caseLevel: false }) - - return users - } catch (error) { - return error - } - } - - static async findOneAndReplace(filter, update) { - try { - const res = await Users.findOneAndReplace(filter, update) - return res - } catch (error) { - return error - } - } -} diff --git a/src/health-checks/health-check.js b/src/health-checks/health-check.js index 70691071d..74a870978 100644 --- a/src/health-checks/health-check.js +++ b/src/health-checks/health-check.js @@ -8,15 +8,9 @@ // Dependencies const { v1: uuidv1 } = require('uuid') -const mongodbHealthCheck = require('./mongodb') const kafkaHealthCheck = require('./kafka') const obj = { - MONGO_DB: { - NAME: 'Mongo.db', - FAILED_CODE: 'MONGODB_HEALTH_FAILED', - FAILED_MESSAGE: 'Mongo db is not connected', - }, KAFKA: { NAME: 'kafka', FAILED_CODE: 'KAFKA_HEALTH_FAILED', @@ -28,7 +22,6 @@ const obj = { let health_check = async function (req, res) { let checks = [] - let mongodbConnection = await mongodbHealthCheck.health_check() let kafkaServiceStatus = await kafkaHealthCheck.health_check() checks.push(checkResult('MONGO_DB', mongodbConnection)) diff --git a/src/health-checks/mongodb.js b/src/health-checks/mongodb.js deleted file mode 100644 index b12809415..000000000 --- a/src/health-checks/mongodb.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * name : mongodb.js. - * author : Aman Karki. - * created-date : 17--2021. - * Description : Mongodb health check. - */ - -// Dependencies -const mongoose = require('mongoose') - -function health_check() { - const db = mongoose.createConnection(process.env.MONGODB_URL) - db.on('error', function () { - return false - }) - - db.once('open', function () { - db.close(function () {}) - return true - }) -} - -module.exports = { - health_check: health_check, -} diff --git a/src/package.json b/src/package.json index b7da86789..43288d152 100644 --- a/src/package.json +++ b/src/package.json @@ -60,13 +60,6 @@ "module-alias": "^2.2.3", "moment": "^2.29.1", "moment-timezone": "^0.5.34", - "mongodb": "^4.1.2", - "mongoose": "^6.1.6", - "mongoose-autopopulate": "^0.16.0", - "mongoose-delete": "^0.5.4", - "mongoose-lean-getters": "^0.3.5", - "mongoose-paginate-v2": "^1.4.2", - "mongoose-timestamp": "^0.6.0", "p-each-series": "^2.1.0", "path-to-regexp": "^6.2.1", "pg": "^8.11.0", diff --git a/src/scripts/apEmailTemp.js b/src/scripts/apEmailTemp.js deleted file mode 100644 index a93904ba0..000000000 --- a/src/scripts/apEmailTemp.js +++ /dev/null @@ -1,67 +0,0 @@ -const mongoose = require('mongoose') -require('dotenv').config({ path: '../.env' }) -require('../configs/mongodb')() -const NotificationTemplate = require('../db/notification-template/model') - -const updates = [ - { - body: '

    Dear {name},

    Welcome to {appName}. You have taken your first step towards connecting, learning, and solving with members of your community and we are excited to have you here!', - subject: 'AP-MentorED - Registration Successful!', - code: 'registration', - }, - { - body: '

    Dear {name},

    Your OTP to reset your password is {otp}. Please enter the OTP to reset your password. For security, please do not share this OTP with anyone.', - subject: 'AP-MentorED - Reset Otp', - code: 'emailotp', - }, - { - body: '

    Dear {name},

    Your OTP to complete the registration process is {otp}. Please enter the OTP to complete the registration. For security, please do not share this OTP with anyone.
    ', - subject: 'Your OTP to sign-up on AP-MentorED', - code: 'registrationotp', - }, - { - body: "
    Regards,
    Team AP-MentorED
    Note: Do not reply to this email. This email is sent from an unattended mailbox. Replies will not be read.
    For any queries, please feel free to reach out to us at apmentored-support@shikshalokam.org
    ", - code: 'email_footer', - subject: null, - }, - { - body: "

    AP-MentorED

    ", - code: 'email_header', - subject: null, - }, - { - body: '

    Hi Team,

    {role} {name} is facing issue in {description}-{userEmailId} in 2.1 version of AP-MentorED.
    ', - subject: 'Support request for AP-MentorED', - code: 'user_issue_reported', - }, -] - -async function updateDocuments() { - try { - for (const update of updates) { - const { code, subject, body } = update - - const filter = { code: code } - const updateDoc = { - $set: { - subject: subject, - body: body, - }, - } - - const result = await NotificationTemplate.findOneAndUpdate(filter, updateDoc) - - if (result) { - console.log(`Updated document with code ${code}`) - } else { - console.log(`Document with code ${code} not found`) - } - } - } catch (err) { - console.error('Error updating documents:', err) - } finally { - mongoose.disconnect() - } -} - -updateDocuments() diff --git a/src/scripts/updateEmailTemplates.js b/src/scripts/updateEmailTemplates.js deleted file mode 100644 index 64539c2c9..000000000 --- a/src/scripts/updateEmailTemplates.js +++ /dev/null @@ -1,28 +0,0 @@ -const mongoose = require('mongoose') -require('dotenv').config({ path: '../.env' }) -require('../configs/mongodb')() -const NotificationTemplate = require('../db/notification-template/model') - -const updateNotificationTemplate = async (code, newBody) => { - try { - const filter = { code } - const update = { body: newBody } - const options = { new: true } - const updatedDoc = await NotificationTemplate.findOneAndUpdate(filter, update, options) - - if (!updatedDoc) { - console.log('Document not found') - } else { - console.log('Updated document:', updatedDoc) - } - } catch (error) { - console.error('Error updating the document:', error) - } finally { - mongoose.disconnect() - } -} - -// Usage: -const newBodyContent = - "

    MentorED

    " -updateNotificationTemplate('email_header', newBodyContent) diff --git a/src/services/account.js b/src/services/account.js index 43ef54961..98e5590c8 100644 --- a/src/services/account.js +++ b/src/services/account.js @@ -870,7 +870,6 @@ module.exports = class AccountHelper { ) await utilsHelper.redisDel(encryptedEmailId) - /* Mongoose schema is in strict mode, so can not delete otpInfo directly */ delete user.password delete user.otpInfo diff --git a/src/services/mentors.js b/src/services/mentors.js deleted file mode 100644 index 4c3960595..000000000 --- a/src/services/mentors.js +++ /dev/null @@ -1,84 +0,0 @@ -/** - * name : mentors.js - * author : Aman - * created-date : 12-Nov-2021 - * Description : User Profile Service Helper. - */ - -// Dependencies -const usersData = require('@db/users/queries') -const common = require('@constants/common') -const httpStatusCode = require('@generics/http-status') -const utilsHelper = require('@generics/utils') - -module.exports = class MentorsHelper { - /** - * List of mentors - * @method - * @name list - * @param {string} pageNo -page number. - * @param {string} pageSize -request data. - * @param {string} searchText - search text. - * @param {string} userId - logged in user id. - * @returns {Array} - Mentors list - */ - static async list(page, limit, search, userId, match) { - try { - const mentors = await usersData.searchMentors(page, limit, search, userId, match) - - if (mentors[0].data.length < 1) { - return common.successResponse({ - statusCode: httpStatusCode.ok, - message: 'MENTOR_LIST', - result: { - data: [], - count: 0, - }, - }) - } - - let foundKeys = {} - let result = [] - - /* Required to resolve all promises first before preparing response object else sometime - it will push unresolved promise object if you put this logic in below for loop */ - - await Promise.all( - mentors[0].data.map(async (mentor) => { - /* Assigned image url from the stored location */ - if (mentor.image) { - mentor.image = await utilsHelper.getDownloadableUrl(mentor.image) - } - return mentor - }) - ) - - for (let mentor of mentors[0].data) { - let firstChar = mentor.name.charAt(0) - firstChar = firstChar.toUpperCase() - - if (!foundKeys[firstChar]) { - result.push({ - key: firstChar, - values: [mentor], - }) - foundKeys[firstChar] = result.length - } else { - let index = foundKeys[firstChar] - 1 - result[index].values.push(mentor) - } - } - - return common.successResponse({ - statusCode: httpStatusCode.ok, - message: 'MENTOR_LIST', - result: { - data: result, - count: mentors[0].count, - }, - }) - } catch (error) { - throw error - } - } -} From 40bbe1750c2fd1955923874f79c4ab4b19768a29 Mon Sep 17 00:00:00 2001 From: rakeshSgr Date: Thu, 25 Jan 2024 10:39:39 +0530 Subject: [PATCH 109/109] integration test env --- dev-ops/integration_test.env | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/dev-ops/integration_test.env b/dev-ops/integration_test.env index c43bfb306..29e1dbee6 100644 --- a/dev-ops/integration_test.env +++ b/dev-ops/integration_test.env @@ -6,40 +6,48 @@ APPLICATION_ENV=development #APPLICATION_PORT=3001 +#CLOUD SERVICE DETAILS AWS_ACCESS_KEY_ID= "test" AWS_BUCKET_ENDPOINT= "s3.ap-south-1.amazonaws.com" AWS_BUCKET_REGION= "ap-south-1" AWS_SECRET_ACCESS_KEY= "/0UfS/0ooVQAwQMcwaW9yi" + AZURE_ACCOUNT_KEY=test AZURE_ACCOUNT_NAME=mentoring CLEAR_INTERNAL_CACHE=userinternal CLOUD_STORAGE=AWS + DEFAULT_AWS_BUCKET_NAME=mentoring-dev-storage DEFAULT_AZURE_CONTAINER_NAME=mentoring-images DEFAULT_GCP_BUCKET_NAME=mentoring-dev-storage ENABLE_EMAIL_OTP_VERIFICATION=false -ENABLE_LOG=true + GCP_PATH=gcp.json GCP_PROJECT_ID=sl-dev-project INTERNAL_ACCESS_TOKEN=internal_access_token INTERNAL_CACHE_EXP_TIME=86400 IV=LHYOA5YnTonqcgrm15k3/Q== + +#KAFKA KAFKA_GROUP_ID=mentoring KAFKA_TOPIC= mentoring #KAFKA_URL= localhost:9092 KEY=E/m3RD/aM3Ed3lLfYVcKizakG9R+bFybAPZSLjIP2hY= -MENTOR_SECRET_CODE=4567 -MONGODB_URL=mongodb://localhost:27017/elevate-users + NOTIFICATION_KAFKA_TOPIC=dev.notifications OTP_EMAIL_TEMPLATE_CODE=emailotp OTP_EXP_TIME=86400 -RATING_KAFKA_TOPIC=dev.mentor_rating + #REDIS_HOST=redis://localhost:6379 + +#refresh tokens deatils REFRESH_TOKEN_EXPIRY=183 REFRESH_TOKEN_SECRET=371hkjkjady2y3ihdkajshdkiq23iuekw71yekhaskdvkvegavy23t78veqwexqvxveit6ttxyeeytt62tx236vv + +#EMAIL TEMPLATES REGISTRATION_EMAIL_TEMPLATE_CODE=registration REGISTRATION_OTP_EMAIL_TEMPLATE_CODE=registrationotp -SALT_ROUNDS=10 + DEFAULT_OCI_BUCKET_NAME= dev-mentoring OCI_ACCESS_KEY_ID= 23b90f80de10cc226f7a4d617e0f4012a544d01d @@ -47,9 +55,6 @@ OCI_BUCKET_ENDPOINT= https://axgqmpkrpmt5.compat.objectstorage.ap-hyderabad-1.or OCI_BUCKET_REGION= ap-hyderabad-1 OCI_SECRET_ACCESS_KEY= 22levMw5Cinz6/NsAKXXakZMpzCet9yu6nn4dVeSmNE= -#REPLICA_SET_NAME = mongo-rs -#REPLICA_SET_READ_PREFERENCE = secondaryPreferred -#MONGODB_URL= mongodb://localhost:27017/elevate-users ERROR_LOG_LEVEL= silly DISABLE_LOG= false