Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions constants/interface-routes/elevate-project/configs.json
Original file line number Diff line number Diff line change
Expand Up @@ -1521,6 +1521,20 @@
],
"service": "project"
},
{
"sourceRoute": "/project/v1/userProjects/createProjectPlan",
"type": "POST",
"priority": "MUST_HAVE",
"inSequence": false,
"orchestrated": false,
"targetPackages": [
{
"basePackageName": "project",
"packageName": "elevate-project"
}
],
"service": "project"
},
{
"sourceRoute": "/project/v1/userProjects/update",
"type": "POST",
Expand Down
61 changes: 61 additions & 0 deletions controllers/v1/userProjects.js
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,67 @@ module.exports = class UserProjects extends Abstract {
}
*/

/**
* @api {post} /project/v1/userProjects/createProjectPlan
* @apiVersion 1.0.0
* @apiGroup User Projects
* @apiName createProjectPlan
* @apiParamExample {json} Request:
* {
* "templates": [
* {
* "templateId": "5f5b32cef16777642d51aaf0",
* "targetTaskName": "Social Empowerment",
* "customTasks": []
* }
* ],
* "userId": "participantId",
* "entityId": "participantEntityId",
* "programName": "Program Name",
* "projectConfig": {
* "name": "IDP Name",
* "description": "IDP Description"
* }
* }
* @apiSuccessExample {json} Response:
* {
* "message": "Project Plan created successfully",
* "status": 200,
* "result": {
* "projectId": "master-project-id"
* }
* }
* @apiUse successBody
* @apiUse errorBody
*/
/**
* Create project plan.
* @method
* @name createProjectPlan
* @param {Object} req - request data.
* @returns {JSON} Project Plan created successfully.
*/
async createProjectPlan(req) {
return new Promise(async (resolve, reject) => {
try {
let result = await userProjectsHelper.createProjectPlan(
req.body,
req.userDetails.userInformation.userId,
req.userDetails.userToken,
req.userDetails
)

return resolve(result)
} catch (error) {
return reject({
status: error.status || HTTP_STATUS_CODE.internal_server_error.status,
message: error.message || HTTP_STATUS_CODE.internal_server_error.message,
errorObject: error,
})
}
})
}

/**
* Add entities in project.
* @method
Expand Down
1 change: 1 addition & 0 deletions generics/constants/api-responses.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ module.exports = {
TASK_MANDATORY_FIELDS_MISSING: 'Task mandatoru fields missing',
PROGRAM_NOT_FOUND: 'Program not found',
PROJECTS_CREATED: 'Projects created successfully',
PROJECT_PLAN_CREATED: 'Project Plan created successfully',
CATEGORY_ALREADY_EXISTS: 'Category already exists',
REQUIRED_FIELDS_NOT_PRESENT_FOR_THE_TASK_UPDATE:
'Required minimum fields _id or name are not present for the task creation.',
Expand Down
Loading