Skip to content

Commit

Permalink
Issue #CO-754 merge: Merge pull request #331 from shubhambansaltarent…
Browse files Browse the repository at this point in the history
…o/fb/CO-754

Issue #CO-754: Project Filter and reviewer TOC
  • Loading branch information
vinukumar-vs authored Feb 5, 2024
2 parents 760631d + 9f326bc commit cf97d8d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/service/programService.js
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,7 @@ async function programList(req, response) {
res_limit = (data.request.limit < queryRes_Max) ? data.request.limit : (queryRes_Max);
}

const filtersOnConfig = ['medium', 'subject', 'gradeLevel'];
const filtersOnConfig = data.request.frameworkCategoryFields || [];
const filters = {};
filters[Op.and] = _.compact(_.map(data.request.filters, (value, key) => {
const res = {};
Expand Down Expand Up @@ -1082,6 +1082,11 @@ async function programList(req, response) {
return response.status(200).send(successResponse(rspObj));
}
else {
let fieldsInConfig = (data.request.frameworkCategoryFields || []).concat(['defaultContributeOrgReview', 'framework', 'frameworkObj'])
let configFieldsInclude = _.map(fieldsInConfig, (field) => {
return [Sequelize.json(`config.${field}`), `${field}`]
});

if (data.request.filters && data.request.filters.role && data.request.filters.user_id) {
const promises = [];
const roles = data.request.filters.role;
Expand All @@ -1100,6 +1105,9 @@ async function programList(req, response) {
...data.request.filters,
...filters
},
attributes:{
include : configFieldsInclude,
},
offset: res_offset,
limit: res_limit,
order: [
Expand All @@ -1120,12 +1128,7 @@ async function programList(req, response) {
loggerService.exitLog({responseCode: rspObj.responseCode}, logObject);
return response.status(200).send(successResponse(rspObj));
} else {
let fieldsInConfig = (data.request.frameworkCategoryFields || []).concat(['defaultContributeOrgReview', 'framework', 'frameworkObj'])
/*let configFields = ['subject', 'gradeLevel', 'board', 'medium', 'defaultContributeOrgReview', 'framework', 'frameworkObj'];*/
let configFieldsInclude = _.map(fieldsInConfig, (field) => {
return [Sequelize.json(`config.${field}`), `${field}`]
});


const res = await model.program.findAll({
where: {
...filters,
Expand Down

0 comments on commit cf97d8d

Please sign in to comment.