-
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.
cherrypick changes from ty/1254/upload-documents
- Loading branch information
1 parent
247514f
commit 33bc5aa
Showing
7 changed files
with
48 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,8 @@ jobs: | |
- uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: server | ||
- name: 'Install Heroku CLI' | ||
run: curl https://cli-assets.heroku.com/install.sh | sh | ||
- uses: akhileshns/[email protected] | ||
name: Deploy server to Heroku | ||
with: | ||
|
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 |
---|---|---|
|
@@ -40,6 +40,8 @@ jobs: | |
with: | ||
ref: 'main' | ||
sparse-checkout: server | ||
- name: 'Install Heroku CLI' | ||
run: curl https://cli-assets.heroku.com/install.sh | sh | ||
- uses: akhileshns/[email protected] | ||
name: Deploy server to Heroku | ||
with: | ||
|
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 |
---|---|---|
|
@@ -130,4 +130,4 @@ | |
The size limit for each file is 50 MB. You can upload up to 1 GB of files. | ||
</p> | ||
</fieldset> | ||
</div> | ||
</div> |
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 |
---|---|---|
|
@@ -124,60 +124,42 @@ export class ProjectsService { | |
'[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, | ||
// ); | ||
const crmResponse = await this.crmService.get( | ||
|
||
const { records } = await this.crmService.get( | ||
'dcp_projects', | ||
// 3e5 = created within 5 minutes | ||
|
||
` | ||
$filter= | ||
dcp_projectname eq '${data.dcp_projectname}' | ||
dcp_projectname eq '${encodeURIComponent(data.dcp_projectname)}' | ||
and createdon ge '${new Date(Date.now() - 3e5).toISOString()}' | ||
` | ||
) | ||
const { records } = crmResponse; | ||
console.debug('LOGGER: crm response', crmResponse); | ||
try { | ||
if (records.length > 0) { | ||
console.log('Project already exists'); | ||
throw new Error('Project already exists'); | ||
} | ||
} catch (e) { | ||
|
||
} | ||
console.debug('LOGGER: crm records', records); | ||
if (records.length > 0) throw new Error('Project already exists'); | ||
|
||
|
||
const project = await this.crmService.create( | ||
'dcp_projects', | ||
data, | ||
); | ||
const project = await this.crmService.create('dcp_projects', data); | ||
// console.debug("LOGGER: (service) project", project); | ||
const { dcp_projectid } = project; | ||
|
||
// const { dcp_artifactsid } = | ||
// await this.artifactService.createProjectInitiationArtifacts( | ||
// dcp_projectid, | ||
// ); | ||
const dcpProjectId = project['dcp_projectid']; | ||
if (dcpProjectId === undefined) throw new Error('Failed to create project'); | ||
|
||
const artifact = | ||
await this.artifactService.createProjectInitiationArtifacts( | ||
dcp_projectid, | ||
); | ||
await this.artifactService.createProjectInitiationArtifacts(dcpProjectId); | ||
|
||
// console.debug('LOGGER: (service) artifact', artifact); | ||
const { dcp_artifactsid } = artifact; | ||
const dcpArtifactsId = artifact['dcp_artifactsid']; | ||
if (dcpArtifactsId === undefined) throw new Error('Failed to create artifact for project'); | ||
|
||
const requestEndTime = Date.now(); | ||
console.debug(`LOGGER: POST (service) request in the service to took ${requestEndTime - requestStartTime} ms`); | ||
requestCounter++; | ||
console.log(`LOGGER: [Total Requests Made in the service] ${requestCounter}`); | ||
return { | ||
dcp_projectid, | ||
dcp_artifactsid, | ||
dcp_projectid: dcpProjectId, | ||
dcp_artifactsid: dcpArtifactsId, | ||
}; | ||
} catch (e) { | ||
console.debug('(service) error creating project', e); | ||
console.error('(service) error creating project', e); | ||
throw new HttpException( | ||
'Unable to create project', | ||
HttpStatus.INTERNAL_SERVER_ERROR, | ||
|