-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create an endpoint through which users may create a new project Update typescript-eslint to a version that supports decorators closes #1246 Co-authored-by: horatio <[email protected]>
- Loading branch information
1 parent
e0965b5
commit ef11f66
Showing
8 changed files
with
300 additions
and
92 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
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
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 |
---|---|---|
|
@@ -64,7 +64,7 @@ export class ProjectsService { | |
any(o: | ||
o/_dcp_applicant_customer_value eq '${contactId}' | ||
and o/statuscode eq ${APPLICANT_ACTIVE_STATUS_CODE} | ||
) | ||
) | ||
and ( | ||
dcp_visibility eq ${PROJECT_VISIBILITY_APPLICANT_ONLY} | ||
or dcp_visibility eq ${PROJECT_VISIBILITY_GENERAL_PUBLIC} | ||
|
@@ -95,6 +95,45 @@ export class ProjectsService { | |
} | ||
} | ||
|
||
/** | ||
* Create a project, including the contact id for the primary contact and applicant | ||
* Lead planner is automatically assigned by CRM based on the borough | ||
* | ||
* @param body | ||
*/ | ||
public async create(attributes: { | ||
dcp_projectname: string; | ||
dcp_borough: string; | ||
dcp_applicanttype: string; | ||
dcp_projectbrief: string; | ||
_dcp_applicant_customer_value: string; | ||
_dcp_applicantadministrator_customer_value: string; | ||
}) { | ||
try { | ||
const data = { | ||
dcp_projectname: attributes.dcp_projectname, | ||
dcp_borough: attributes.dcp_borough, | ||
dcp_applicanttype: attributes.dcp_applicanttype, | ||
dcp_projectbrief: attributes.dcp_projectbrief, | ||
'[email protected]': `/contacts(${attributes._dcp_applicant_customer_value})`, | ||
'[email protected]': `/contacts(${attributes._dcp_applicantadministrator_customer_value})`, | ||
}; | ||
const { dcp_projectid } = await this.crmService.create( | ||
'dcp_projects', | ||
data, | ||
); | ||
return { | ||
dcp_projectid, | ||
}; | ||
} catch (e) { | ||
console.debug('error creating project', e); | ||
throw new HttpException( | ||
'Unable to create project', | ||
HttpStatus.INTERNAL_SERVER_ERROR, | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* Gets a Project for given dcp_projectid and contactid | ||
* | ||
|
@@ -123,19 +162,19 @@ export class ProjectsService { | |
$filter= statuscode eq ${APPLICANT_ACTIVE_STATUS_CODE} | ||
), | ||
dcp_dcp_project_dcp_dcpprojectteam_project, | ||
dcp_dcp_project_dcp_package_project( | ||
$filter= | ||
( | ||
dcp_visibility eq ${PACKAGE_VISIBILITY.APPLICANT_ONLY} | ||
or dcp_visibility eq ${PACKAGE_VISIBILITY.GENERAL_PUBLIC} | ||
) | ||
and ( | ||
statuscode eq ${PACKAGE_STATUSCODE.PACKAGE_PREPARATION} | ||
or statuscode eq ${PACKAGE_STATUSCODE.SUBMITTED} | ||
or statuscode eq ${PACKAGE_STATUSCODE.UNDER_REVIEW} | ||
or statuscode eq ${PACKAGE_STATUSCODE.REVIEWED_NO_REVISIONS_REQUIRED} | ||
or statuscode eq ${PACKAGE_STATUSCODE.REVIEWED_REVISION_REQUIRED} | ||
) | ||
dcp_dcp_project_dcp_package_project( | ||
$filter= | ||
( | ||
dcp_visibility eq ${PACKAGE_VISIBILITY.APPLICANT_ONLY} | ||
or dcp_visibility eq ${PACKAGE_VISIBILITY.GENERAL_PUBLIC} | ||
) | ||
and ( | ||
statuscode eq ${PACKAGE_STATUSCODE.PACKAGE_PREPARATION} | ||
or statuscode eq ${PACKAGE_STATUSCODE.SUBMITTED} | ||
or statuscode eq ${PACKAGE_STATUSCODE.UNDER_REVIEW} | ||
or statuscode eq ${PACKAGE_STATUSCODE.REVIEWED_NO_REVISIONS_REQUIRED} | ||
or statuscode eq ${PACKAGE_STATUSCODE.REVIEWED_REVISION_REQUIRED} | ||
) | ||
), | ||
dcp_dcp_project_dcp_projectmilestone_project( | ||
$select=${MILESTONE_ATTRS.join(',')}; | ||
|
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
Oops, something went wrong.