Skip to content

Commit

Permalink
Add project in env
Browse files Browse the repository at this point in the history
  • Loading branch information
mbayopanda committed Nov 17, 2021
1 parent ba23912 commit d4235b9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
5 changes: 1 addition & 4 deletions client/src/modules/odk/odk.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@ OdkService.$inject = ['PrototypeApiService'];
function OdkService(Api) {
const baseUrl = '/odk/central';
const service = new Api(baseUrl);

// Nutrition project and form in Central
const PROJECT_ID = 16;
const FORM_ID = 'pcima_pv_reception';

service.loadNutritionReceptions = loadNutritionReceptions;

function loadNutritionReceptions() {
const url = baseUrl.concat(`/projects/${PROJECT_ID}/forms/${FORM_ID}`);
const url = baseUrl.concat(`/forms/${FORM_ID}`);
return service.$http.get(url)
.then(service.util.unwrapHttpResponse);
}
Expand Down
2 changes: 1 addition & 1 deletion server/config/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -1106,5 +1106,5 @@ exports.configure = function configure(app) {
app.delete('/configuration_analysis_tools/:id', configurationAnalysisTools.delete);

// ODK CENTRAL HANDLER
app.get('/odk/central/projects/:projectId/forms/:formId', odkImport.loadData);
app.get('/odk/central/forms/:formId', odkImport.loadData);
};
3 changes: 2 additions & 1 deletion server/controllers/odk/import.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ exports.loadData = loadData;

// Perfoms actions based on project and form id
async function loadData(req, res, next) {
const { projectId, formId } = req.params;
const { formId } = req.params;
const projectId = process.env.ODK_CENTRAL_PROJECT_ID;

const mapActions = {
pcima_pv_reception : loadFosaData,
Expand Down

0 comments on commit d4235b9

Please sign in to comment.