-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #164 from shikshalokam/master
PII Changes for Project
- Loading branch information
Showing
8 changed files
with
211 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,3 +69,4 @@ config/credentials/* | |
*.DS_Store | ||
|
||
package-lock.json | ||
keycloak-public-keys/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* name : programUsers.js | ||
* author : Ankit Shahu | ||
* created-date : 9-Jan-2023 | ||
* Description : PII data related controller. | ||
*/ | ||
|
||
/** | ||
* programUsers | ||
* @class | ||
*/ | ||
module.exports = class ProgramUsers extends Abstract { | ||
constructor() { | ||
super("programUsers"); | ||
} | ||
|
||
static get name() { | ||
return "programUsers"; | ||
} | ||
|
||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* name : programUsers.js | ||
* author : Ankit Shahu | ||
* created-date : 07-04-2023 | ||
* Description : program users helper for DB interactions. | ||
*/ | ||
module.exports = class programUsers { | ||
|
||
/** | ||
* program users details. | ||
* @method | ||
* @name programUsersDocument | ||
* @param {Array} [filterData = "all"] - program users filter query. | ||
* @param {Array} [fieldsArray = "all"] - projected fields. | ||
* @param {Array} [skipFields = "none"] - field not to include | ||
* @returns {Array} program users details. | ||
*/ | ||
|
||
static programUsersDocument( | ||
filterData = "all", | ||
fieldsArray = "all", | ||
skipFields = "none" | ||
) { | ||
return new Promise(async (resolve, reject) => { | ||
try { | ||
|
||
let queryObject = (filterData != "all") ? filterData : {}; | ||
let projection = {} | ||
|
||
if (fieldsArray != "all") { | ||
fieldsArray.forEach(field => { | ||
projection[field] = 1; | ||
}); | ||
} | ||
|
||
if( skipFields !== "none" ) { | ||
skipFields.forEach(field=>{ | ||
projection[field] = 0; | ||
}); | ||
} | ||
|
||
let programJoinedData = await database.models.programUsers | ||
.find(queryObject, projection) | ||
.lean(); | ||
return resolve(programJoinedData); | ||
} catch (error) { | ||
return reject(error); | ||
} | ||
}); | ||
} | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module.exports = { | ||
name: "programUsers", | ||
schema: { | ||
programId: { | ||
type : "ObjectId", | ||
required: true, | ||
index: true | ||
}, | ||
userId: { | ||
type: String, | ||
index: true, | ||
required: true, | ||
}, | ||
resourcesStarted: { | ||
type: Boolean, | ||
index: true, | ||
default: false | ||
}, | ||
userProfile: { | ||
type : Object, | ||
required: true | ||
}, | ||
userRoleInformation: Object, | ||
appInformation: Object | ||
}, | ||
compoundIndex: [ | ||
{ | ||
"name" :{ userId: 1, programId: 1 }, | ||
"indexType" : { unique: true } | ||
} | ||
] | ||
}; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters