diff --git a/Dockerfile b/Dockerfile index b4d2676..13af966 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16 +FROM node:20 WORKDIR /opt/core diff --git a/generics/services/form.js b/generics/services/form.js index 8145db7..45a2a0f 100644 --- a/generics/services/form.js +++ b/generics/services/form.js @@ -31,10 +31,16 @@ const configForStateLocation = function ( stateLocationCode, entityKey ) { let subEntityData = subEntitiesDetails.data.form.data.fields.filter((fieldInstance)=>{ return fieldInstance.code == constants.common.PERSONA })[0].children.administrator; + + let allowedLocationFields = ["state", "district", "block", "cluster", "school"]; //Entity type is stored in a key called code - let subEntities = subEntityData.map( subEntity => { - return subEntity.code; - }) + let subEntities = subEntityData.filter( subEntity => { + if(allowedLocationFields.includes(subEntity.code)){ + return true; + }else { + return false; + } + }).map(subEntity => subEntity.code) //set cache data for given state let setCache = cache.setValue(entityKey, subEntities, constants.common.CACHE_TTL); return resolve(subEntities);