From 5a57506bbf115b8c6a3e7f2830b8a345c5d8dbca Mon Sep 17 00:00:00 2001 From: Akash Shah Date: Mon, 30 Sep 2024 18:38:38 +0530 Subject: [PATCH 1/4] Update README.md --- README.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c7b0690c9..ba3ca2b9c 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@
-The Mentor building block enables effective mentoring interactions between mentors and mentees. The capability aims to create a transparent eco-system to learn, connect, solve, and share within communities. Mentor is an open-source mentoring application that facilitates peer learning and professional development by creating a community of mentors and mentees. +The User service block enables secure and highly extensible user management and organization management capabilities - User registration, Live and JWT basesd session management, Delete user, Forgot password with email notifications.
@@ -742,13 +742,11 @@ npm test # Used in -This project was built to be used with [Mentor Service](https://github.com/ELEVATE-Project/mentoring.git). +This project was built to be used with [Mentoring Service](https://github.com/ELEVATE-Project/mentoring.git), [Project Service](https://github.com/ELEVATE-Project/project-service.git), [Survey Service](https://github.com/ELEVATE-Project/samiksha-service.git), [User Service](https://github.com/ELEVATE-Project/user.git). -Notification service repo can be found [here](https://github.com/ELEVATE-Project/notification.git). +The frontend/mobile application for Mentoring [repo](https://github.com/ELEVATE-Project/mentoring-mobile-app) and Projects and Survey [repo](https://github.com/ELEVATE-Project/observation-survey-projects-pwa) -The PWA [repo](https://github.com/ELEVATE-Project/mentoring-mobile-app). - -You can learn more about the full implementation of Mentor [here](https://elevate-docs.shikshalokam.org/.mentorEd/intro) . +You can learn more about the full implementation of various capabilities of ELEVATE [here](https://elevate-docs.shikshalokam.org) .
# Team @@ -761,7 +759,7 @@ You can learn more about the full implementation of Mentor [here](https://elevat # Open Source Dependencies -Several open source dependencies that have aided user service development: +Several open-source dependencies have aided user service development: ![NodeJS](https://img.shields.io/badge/node.js-6DA55F?style=for-the-badge&logo=node.js&logoColor=white) ![MongoDB](https://img.shields.io/badge/MongoDB-%234ea94b.svg?style=for-the-badge&logo=mongodb&logoColor=white) From 2ad8e0f3bada17cd15d179aada73e32650000caa Mon Sep 17 00:00:00 2001 From: Rocky <49852443+rakeshSgr@users.noreply.github.com> Date: Thu, 5 Dec 2024 18:00:45 +0530 Subject: [PATCH 2/4] Update package.json --- src/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/package.json b/src/package.json index 4aa21d6eb..c7832005c 100644 --- a/src/package.json +++ b/src/package.json @@ -16,7 +16,7 @@ "elevate-migrations": "module/migrations/bin/migrations.js", "integration": "node app.js", "test:integration": "jest --verbose ./integration-test --config=integrationJest.config.js --runInBand", - "db:init": "sequelize-cli db:create && sequelize-cli db:migrate ", + "db:init": "sequelize-cli db:create || echo 'Database already exists or some issue while creating db, Please check' && sequelize-cli db:migrate ", "db:seed:all": "sequelize-cli db:seed:all" }, "author": "Aman Kumar Gupta ", From 77edc9e9c190dd42d4471301c3a72242189b52b7 Mon Sep 17 00:00:00 2001 From: Rocky <49852443+rakeshSgr@users.noreply.github.com> Date: Wed, 11 Dec 2024 15:39:18 +0530 Subject: [PATCH 3/4] Update package.json --- src/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/package.json b/src/package.json index c7832005c..24bb8e16c 100644 --- a/src/package.json +++ b/src/package.json @@ -17,7 +17,7 @@ "integration": "node app.js", "test:integration": "jest --verbose ./integration-test --config=integrationJest.config.js --runInBand", "db:init": "sequelize-cli db:create || echo 'Database already exists or some issue while creating db, Please check' && sequelize-cli db:migrate ", - "db:seed:all": "sequelize-cli db:seed:all" + "db:seed:all": "sequelize-cli db:seed:all || echo 'Seeded data already exists or some issue while seeding the data, Please check' " }, "author": "Aman Kumar Gupta ", "license": "ISC", From cbc12183c74304774449a415a72559e6564590d2 Mon Sep 17 00:00:00 2001 From: PraveenDass Date: Tue, 12 Aug 2025 18:37:07 +0530 Subject: [PATCH 4/4] relatedorg changes --- src/database/models/organization.js | 6 ++++++ src/database/queries/organization.js | 32 +++++++++++++++++----------- src/services/organization.js | 12 ++++++++++- 3 files changed, 37 insertions(+), 13 deletions(-) diff --git a/src/database/models/organization.js b/src/database/models/organization.js index fc2140f84..c80b51122 100644 --- a/src/database/models/organization.js +++ b/src/database/models/organization.js @@ -87,6 +87,12 @@ module.exports = (sequelize, DataTypes) => { sourceKey: 'code', as: 'organizationRegistrationCodes', }) + + Organization.hasMany(models.Organization, { + as: 'relatedOrgsDetails', + foreignKey: 'id', + constraints: false, + }) } return Organization diff --git a/src/database/queries/organization.js b/src/database/queries/organization.js index 0e6d4d9ee..dd5b1cc1f 100644 --- a/src/database/queries/organization.js +++ b/src/database/queries/organization.js @@ -52,24 +52,32 @@ exports.create = async (data) => { } exports.findOne = async (filter, options = {}) => { try { + let includes = [...(options.include || [])] if (options?.isAdmin) { - options = { - ...options, - include: [ - { - model: OrganizationRegistrationCode, - as: 'organizationRegistrationCodes', - attributes: ['registration_code'], - where: { status: 'ACTIVE', deleted_at: null, tenant_code: filter.tenant_code }, - required: false, - }, - ], - } + includes.push({ + model: OrganizationRegistrationCode, + as: 'organizationRegistrationCodes', + attributes: ['registration_code'], + where: { status: 'ACTIVE', deleted_at: null, tenant_code: filter.tenant_code }, + required: false, + }) + } + + if (options?.getRelatedOrgIdAndCode) { + includes.push({ + model: Organization, + as: 'relatedOrgsDetails', + attributes: ['id', 'code'], + required: false, + on: sequelize.literal(`"relatedOrgsDetails"."id" = ANY("Organization"."related_orgs")`), + }) } delete options.isAdmin + delete options?.getRelatedOrgIdAndCode let organization = await Organization.findOne({ where: filter, ...options, + include: includes, nest: true, }) if (!organization) return null diff --git a/src/services/organization.js b/src/services/organization.js index 377dc0ecf..baa0c9445 100644 --- a/src/services/organization.js +++ b/src/services/organization.js @@ -410,7 +410,8 @@ module.exports = class OrganizationsHelper { if (tenantCode.trim()) filter.tenant_code = tenantCode } - const organisationDetails = await organizationQueries.findOne(filter) + const organisationDetails = await organizationQueries.findOne(filter, { getRelatedOrgIdAndCode: true }) + if (!organisationDetails) { return responses.failureResponse({ message: 'ORGANIZATION_NOT_FOUND', @@ -419,6 +420,15 @@ module.exports = class OrganizationsHelper { }) } + // if(organisationDetails.related_orgs && organisationDetails.related_orgs.length >0){ + // let orgFilters = {id:{[Op.in]:organisationDetails.related_orgs}} + // const relatedOrgsIdAndCode = await organizationQueries.findAll(orgFilters) + // organisationDetails.relatedOrgsIdAndCode = relatedOrgsIdAndCode.map(eachOrg => ({ + // id: eachOrg.id, + // code: eachOrg.code + // })); + // } + return responses.successResponse({ statusCode: httpStatusCode.ok, message: 'ORGANIZATION_FETCHED_SUCCESSFULLY',